Skip to content

Commit 7bd4999

Browse files
committed
Refactor integration tests to use new mounting functions and update shortcut paths
1 parent c9b160e commit 7bd4999

File tree

2 files changed

+33
-64
lines changed

2 files changed

+33
-64
lines changed

Modules/Executables/Shell/Graphical/Tests/Integration_test.rs

+28-64
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ use Graphical_shell::Shell_executable_type;
1111
#[test]
1212
fn main() {
1313
use Drivers::Native::Window_screen;
14-
use File_system::{Flags_type, Open_type, Permissions_type};
14+
use Executable::Mount_static_executables;
15+
use File_system::{Flags_type, Open_type};
1516
use Graphics::{Get_minimal_buffer_size, Input_type_type, Point_type};
1617
use Users::Group_identifier_type;
1718

18-
use Virtual_file_system::File_type;
19+
use Virtual_file_system::{File_type, Mount_static_devices};
1920

2021
// - Initialize the task manager.
2122
let Task_instance = Task::Initialize().unwrap();
@@ -60,57 +61,34 @@ fn main() {
6061
Virtual_file_system::Create_default_hierarchy(Virtual_file_system::Get_instance(), Task)
6162
.unwrap();
6263

63-
Virtual_file_system::Get_instance()
64-
.Mount_static_device(
65-
Task,
66-
&"/Binaries/Graphical_shell",
67-
Create_device!(Shell_executable_type),
68-
)
69-
.unwrap();
70-
71-
Virtual_file_system::Get_instance()
72-
.Mount_static_device(
73-
Task,
74-
&"/Binaries/Command_line_shell",
75-
Create_device!(Shell_executable_type),
76-
)
77-
.unwrap();
78-
79-
Virtual_file_system::Get_instance()
80-
.Set_permissions("/Binaries/Command_line_shell", Permissions_type::Executable)
81-
.unwrap();
82-
83-
Virtual_file_system::Get_instance()
84-
.Create_directory(&"/Configuration/Graphical_shell", Task)
85-
.unwrap();
64+
Mount_static_executables!(
65+
Virtual_file_system::Get_instance(),
66+
Task,
67+
&[(&"/Binaries/Graphical_shell", Shell_executable_type),]
68+
)
69+
.unwrap();
8670

8771
Virtual_file_system::Get_instance()
88-
.Create_directory(&"/Configuration/Graphical_shell/Shortcuts", Task)
72+
.Create_directory(&"/Configuration/Shared/Shortcuts", Task)
8973
.unwrap();
9074

9175
Drivers::Native::Console::Mount_devices(Task, Virtual_file_system::Get_instance()).unwrap();
9276

93-
Virtual_file_system::Get_instance()
94-
.Mount_static_device(
95-
Task,
96-
&"/Devices/Random",
97-
Create_device!(Drivers::Native::Random_device_type),
98-
)
99-
.unwrap();
100-
101-
Virtual_file_system::Get_instance()
102-
.Mount_static_device(
103-
Task,
104-
&"/Devices/Null",
105-
Create_device!(Drivers::Common::Null_device_type),
106-
)
107-
.unwrap();
77+
Mount_static_devices!(
78+
Virtual_file_system::Get_instance(),
79+
Task,
80+
&[
81+
(&"/Devices/Random", Drivers::Native::Random_device_type),
82+
(&"/Devices/Null", Drivers::Common::Null_device_type),
83+
]
84+
)
85+
.unwrap();
10886

10987
// Add fake shortcuts.
11088
for i in 0..20 {
11189
File_type::Open(
11290
Virtual_file_system::Get_instance(),
113-
format!("/Configuration/Graphical_shell/Shortcuts/Test{}.json", i).as_str(),
91+
format!("/Configuration/Shared/Shortcuts/Test{}.json", i).as_str(),
11492
Flags_type::New(Mode_type::Write_only, Some(Open_type::Create), None),
11593
)
11694
.unwrap()
@@ -122,7 +100,8 @@ fn main() {
122100
"Command": "/Binaries/?",
123101
"Arguments": "",
124102
"Terminal": false,
125-
"Icon_string": "T!"
103+
"Icon_string": "T!",
104+
"Icon_color": [255, 0, 0]
126105
}}
127106
"#,
128107
i
@@ -150,29 +129,14 @@ fn main() {
150129
)
151130
.unwrap();
152131

153-
let Standard_in = Virtual_file_system::Get_instance()
154-
.Open(&"/Devices/Standard_in", Mode_type::Read_only.into(), Task)
155-
.unwrap();
156-
157-
let Standard_out = Virtual_file_system::Get_instance()
158-
.Open(&"/Devices/Standard_out", Mode_type::Write_only.into(), Task)
159-
.unwrap();
160-
161-
let Standard_error = Virtual_file_system::Get_instance()
162-
.Open(
163-
&"/Devices/Standard_error",
164-
Mode_type::Write_only.into(),
165-
Task,
166-
)
167-
.unwrap();
168-
169-
let Standard = Standard_type::New(
170-
Standard_in,
171-
Standard_out,
172-
Standard_error,
132+
let Standard = Standard_type::Open(
133+
&"/Devices/Standard_in",
134+
&"/Devices/Standard_out",
135+
&"/Devices/Standard_error",
173136
Task,
174137
Virtual_file_system::Get_instance(),
175-
);
138+
)
139+
.unwrap();
176140

177141
Task_instance
178142
.Set_environment_variable(Task, "Paths", "/")

Modules/Executables/Shell/Graphical/src/Desk.rs

+5
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,11 @@ impl Desk_type {
417417
}
418418
// If the target is a dock icon, move the window to the foreground
419419
else if unsafe { LVGL::lv_obj_get_parent(Event.Get_target()) == self.Dock } {
420+
// Ignore the main button
421+
if Event.Get_target() == self.Main_button {
422+
continue;
423+
}
424+
420425
let Window_identifier =
421426
unsafe { LVGL::lv_obj_get_user_data(Event.Get_target()) as usize };
422427

0 commit comments

Comments
 (0)