Create a test suite for Gwenview

This commit is contained in:
Lukáš Růžička 2024-04-03 12:45:09 +02:00
parent ca376906ce
commit 6c9b3ec8c9
10 changed files with 303 additions and 0 deletions

View File

@ -0,0 +1,52 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will download the test data for EoG, start the application,
# and set a milestone as a starting point for the other Loupe tests.
sub run {
my $self = shift;
# Switch to console
$self->root_console(tty => 3);
# Perform git test
check_and_install_git();
# Download the test data
download_testdata();
# Exit the terminal
desktop_vt;
# Set the update notification timestamp
set_update_notification_timestamp();
# Start the application
menu_launch_type("image viewer");
# Check that is started
assert_screen 'apps_run_imageviewer';
# Fullsize the Loupe window.
send_key("super-up");
# Open the test file to create a starting point for the other EoG tests.
send_key("ctrl-o");
# Open the Pictures folder.
assert_and_click("gnome_dirs_pictures", button => "left", timeout => 30);
# Select the image.jpg file.
assert_and_click("loupe_file_select_jpg", button => "left", timeout => 30);
# Hit enter to open it.
send_key("ret");
# Check that the file has been successfully opened.
assert_screen("loupe_image_default");
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,27 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests if EoG can show the About window.
sub run {
my $self = shift;
# Open the menu
send_key("f10");
# Click on the About item
assert_and_click("loupe_menu_about");
assert_screen("loupe_about_shown");
# Click on Credits
assert_and_click("loupe_about_credits");
assert_screen("loupe_credits_shown");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,30 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests if the application basic layout shows basic info.
sub run {
my $self = shift;
# Check that the picture name is shown
assert_screen "loupe_picture_name";
# Check that the Side panel is visible, try to make it visible if it is not.
if (!check_screen("loupe_side_panel")) {
send_key("f9");
}
assert_screen("loupe_side_panel");
# Check that info on side panel is correct
assert_screen("loupe_img_info");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,27 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests if the application can navigate through the current folder.
sub run {
my $self = shift;
# wait to settle from snapshot
wait_still_screen 3;
# Go to next picture.
send_key("right");
assert_screen("loupe_image_next", timeout => 90);
# Go to previous picture
send_key("left");
assert_and_click("loupe_image_default", timeout => 90);
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,28 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests if the application can be switched to full screen.
sub run {
my $self = shift;
# Toggle full screen
send_key("f11");
wait_still_screen 2;
assert_screen("loupe_fullscreen_on");
# Return to normal mode
send_key("f11");
wait_still_screen 2;
assert_screen("loupe_image_default");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,26 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests if the application can show help.
sub run {
my $self = shift;
sleep 2;
# Open the shortcuts
send_key("f1");
assert_screen("loupe_help_shown", timeout => 120);
# Try another screen
assert_and_click("loupe_help_image_view", timeout => 60);
assert_screen("loupe_help_view_shown");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,33 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests if the application can put an image as a wallpaper.
sub run {
my $self = shift;
sleep 2;
# Go to the menu
send_key("f10");
# Set as background
assert_and_click("loupe_menu_set_wallpaper");
wait_still_screen(2);
# Confirm
assert_and_click("loupe_set_wallpaper");
wait_still_screen(2);
# Close the application
send_key("alt-f4");
# Check that the wallpaper was set
assert_screen("loupe_image_background");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,27 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests if the application can rotate the displayed picture.
sub run {
my $self = shift;
# Rotate left
send_key("shift-ctrl-r");
wait_still_screen(3);
assert_screen("loupe_image_rotated_left");
# Rotate right
send_key("ctrl-r");
wait_still_screen(3);
assert_and_click("loupe_image_default");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,26 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests if the application can show the shortcuts.
sub run {
my $self = shift;
sleep 2;
# Open the shortcuts
send_key("ctrl-?");
assert_screen("loupe_shortcuts_shown");
# Try another screen
assert_and_click("loupe_shortcuts_alt_page");
assert_screen("loupe_shortcuts_alt_shown");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,27 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests if the application can change the zoom for the displayed picture.
sub run {
my $self = shift;
sleep 2;
assert_screen("loupe_image_default");
# Let us increase the image using the plus key
mouse_set("500", "350");
send_key("+");
send_key("+");
wait_still_screen(2);
assert_screen("loupe_image_zoomed_in");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et: