From 6c9b3ec8c91d49c3dcd1469bb09b6693c96beef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Wed, 3 Apr 2024 12:45:09 +0200 Subject: [PATCH] Create a test suite for Gwenview --- tests/applications/gwenview/aaa_setup.pm | 52 +++++++++++++++++++ tests/applications/gwenview/about.pm | 27 ++++++++++ tests/applications/gwenview/basic_view.pm | 30 +++++++++++ tests/applications/gwenview/browse.pm | 27 ++++++++++ tests/applications/gwenview/fullscreen.pm | 28 ++++++++++ tests/applications/gwenview/help.pm | 26 ++++++++++ .../applications/gwenview/pic_to_wallpaper.pm | 33 ++++++++++++ tests/applications/gwenview/rotate.pm | 27 ++++++++++ tests/applications/gwenview/shortcuts.pm | 26 ++++++++++ tests/applications/gwenview/zoom.pm | 27 ++++++++++ 10 files changed, 303 insertions(+) create mode 100644 tests/applications/gwenview/aaa_setup.pm create mode 100644 tests/applications/gwenview/about.pm create mode 100644 tests/applications/gwenview/basic_view.pm create mode 100644 tests/applications/gwenview/browse.pm create mode 100644 tests/applications/gwenview/fullscreen.pm create mode 100644 tests/applications/gwenview/help.pm create mode 100644 tests/applications/gwenview/pic_to_wallpaper.pm create mode 100644 tests/applications/gwenview/rotate.pm create mode 100644 tests/applications/gwenview/shortcuts.pm create mode 100644 tests/applications/gwenview/zoom.pm diff --git a/tests/applications/gwenview/aaa_setup.pm b/tests/applications/gwenview/aaa_setup.pm new file mode 100644 index 00000000..96527d5c --- /dev/null +++ b/tests/applications/gwenview/aaa_setup.pm @@ -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: diff --git a/tests/applications/gwenview/about.pm b/tests/applications/gwenview/about.pm new file mode 100644 index 00000000..7b1dd0b1 --- /dev/null +++ b/tests/applications/gwenview/about.pm @@ -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: diff --git a/tests/applications/gwenview/basic_view.pm b/tests/applications/gwenview/basic_view.pm new file mode 100644 index 00000000..53bb529f --- /dev/null +++ b/tests/applications/gwenview/basic_view.pm @@ -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: diff --git a/tests/applications/gwenview/browse.pm b/tests/applications/gwenview/browse.pm new file mode 100644 index 00000000..7eec97fc --- /dev/null +++ b/tests/applications/gwenview/browse.pm @@ -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: diff --git a/tests/applications/gwenview/fullscreen.pm b/tests/applications/gwenview/fullscreen.pm new file mode 100644 index 00000000..35b2f39b --- /dev/null +++ b/tests/applications/gwenview/fullscreen.pm @@ -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: diff --git a/tests/applications/gwenview/help.pm b/tests/applications/gwenview/help.pm new file mode 100644 index 00000000..12b43237 --- /dev/null +++ b/tests/applications/gwenview/help.pm @@ -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: diff --git a/tests/applications/gwenview/pic_to_wallpaper.pm b/tests/applications/gwenview/pic_to_wallpaper.pm new file mode 100644 index 00000000..4c28a3df --- /dev/null +++ b/tests/applications/gwenview/pic_to_wallpaper.pm @@ -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: diff --git a/tests/applications/gwenview/rotate.pm b/tests/applications/gwenview/rotate.pm new file mode 100644 index 00000000..64dd334a --- /dev/null +++ b/tests/applications/gwenview/rotate.pm @@ -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: diff --git a/tests/applications/gwenview/shortcuts.pm b/tests/applications/gwenview/shortcuts.pm new file mode 100644 index 00000000..ce8c7ba2 --- /dev/null +++ b/tests/applications/gwenview/shortcuts.pm @@ -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: diff --git a/tests/applications/gwenview/zoom.pm b/tests/applications/gwenview/zoom.pm new file mode 100644 index 00000000..d497604f --- /dev/null +++ b/tests/applications/gwenview/zoom.pm @@ -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: