2022-02-10 09:29:17 +00:00
use base "installedtest" ;
use strict ;
use testapi ;
use utils ;
# Toggle and untoggle the side panel.
sub run {
my $ self = shift ;
2022-07-28 20:32:57 +00:00
# It seems that the following checks run so quickly that the tested
2022-02-10 09:29:17 +00:00
# virtual machine is unable to properly reload from the previous test
# and it keeps failing.
# Let's give it some time to settle.
sleep ( 5 ) ;
2022-07-28 20:32:57 +00:00
2022-02-10 09:29:17 +00:00
my $ side_panel = 0 ;
if ( check_screen ( "nautilus_side_panel" ) ) {
2022-07-28 20:32:57 +00:00
$ side_panel = 1 ;
2022-02-10 09:29:17 +00:00
}
2022-07-28 20:32:57 +00:00
2022-02-10 09:29:17 +00:00
# Switch off the side panel
send_key ( "f9" ) ;
wait_still_screen ( 2 ) ;
2022-07-28 20:32:57 +00:00
2022-02-10 09:29:17 +00:00
# Recheck if side panel is visible
my $ off_panel = 0 ;
if ( check_screen ( "nautilus_side_panel" ) ) {
$ off_panel = 1 ;
}
2022-07-28 20:32:57 +00:00
2022-02-10 09:29:17 +00:00
# Compare the results, they should be different.
if ( $ off_panel == $ side_panel ) {
2022-07-28 20:32:57 +00:00
die ( "The side panel visibility should have been toggled and it is not. That indicates that the keyboard shortcut to toggle it does not work properly." ) ;
2022-02-10 09:29:17 +00:00
}
2022-07-28 20:32:57 +00:00
2022-02-10 09:29:17 +00:00
# Use menu to toggle the side panel back.
assert_and_click ( "gnome_burger_menu" ) ;
wait_still_screen ( 2 ) ;
assert_and_click ( "nautilus_show_sidebar" ) ;
wait_still_screen ( 2 ) ;
2022-07-28 20:32:57 +00:00
2022-02-10 09:29:17 +00:00
# Recheck if side panel is visible
if ( check_screen ( "nautilus_side_panel" ) ) {
$ off_panel = 1 ;
}
2022-07-28 20:32:57 +00:00
2022-02-10 09:29:17 +00:00
# Compare the results. If everything has been ok until now, the values should not be different.
if ( $ off_panel != $ side_panel ) {
2022-07-28 20:32:57 +00:00
die ( "The side panel visibility should have been toggled back, but it has not been. That indicates that the menu item to toggle it does not work properly." ) ;
2022-02-10 09:29:17 +00:00
}
2022-07-28 20:32:57 +00:00
2022-02-10 09:29:17 +00:00
}
sub test_flags {
# Rollback to the previous state to make space for other parts.
return { always_rollback = > 1 } ;
}
1 ;