Skip to content

Commit

Permalink
Add test for The Battle For Wesnoth
Browse files Browse the repository at this point in the history
  • Loading branch information
clanig committed Mar 17, 2023
1 parent 78a1972 commit 2468b29
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
1 change: 1 addition & 0 deletions schedule/functional/extra_tests_gnome.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ conditional_schedule:
- '{{x86_64_tests}}'
- x11/multi_users_dm
- x11/gnucash
- gaming/wesnoth
- texlive/latexdiff
- appgeo/qgis
- x11/network/hwsim_wpa2_enterprise_setup
Expand Down
7 changes: 7 additions & 0 deletions schedule/functional/wesnoth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: wesnoth
description: >
Maintainer: [email protected]
Tests for the game Battle for Wesnoth
schedule:
- boot/boot_to_desktop
- gaming/wesnoth
80 changes: 80 additions & 0 deletions tests/gaming/wesnoth.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Copyright (C) 2022 SUSE LLC
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, see <http://www.gnu.org/licenses/>.
#
# Summary: The Battle for Wesnoth game test
# Maintainer: Christian Lanig <[email protected]>

use base "x11test";
use strict;
use warnings;
use testapi;

sub run {
select_console "x11";
ensure_installed "wesnoth", timeout => 600;
x11_start_program "wesnoth";

# Double click necessary to achieve focus on window
assert_and_click "wesnoth-preferences";
assert_and_click "wesnoth-preferences-display";
assert_and_click "wesnoth-preferences-display-anim-map";
assert_and_click "wesnoth-preferences-unit-standing-anim";
assert_and_click "wesnoth-preferences-display-idle-anim";
assert_and_click "wesnoth-preferences-close";
assert_and_click "wesnoth-campaign-button";
assert_and_click "wesnoth-campaign-brothers-select";
assert_and_click "wesnoth-play-btn";
assert_and_click "wesnoth-skip-btn";
assert_screen "wesnoth-ingame";

# Skip dialogue
for (1 .. 11) {
click_lastmatch;
}

assert_and_click "wesnoth-menu";
assert_and_click "wesnoth-save-game";
assert_and_click "wesnoth-save-btn";
assert_and_click "wesnoth-save-confirm";

# Sometimes mouse lands on the border shifting the displayed map area
mouse_set(100, 100);

# Focus display on lead figure
send_key "l";

assert_and_click "wesnoth-horseman";
assert_and_click "wesnoth-camp";
assert_screen "wesnoth-horseman-on-camp";
assert_and_click "wesnoth-fortress-field", button => "right";
assert_and_click "wesnoth-recruit";
assert_and_click "wesnoth-recruit-btn";
assert_screen "wesnoth-new-archer";
assert_and_click "wesnoth-menu";
assert_and_click "wesnoth-load-btn";
assert_and_click "wesnoth-load-confirm";

# Focus display on lead figure
send_key "l";

assert_screen "wesnoth-camp";
assert_and_click "wesnoth-endturn";
assert_and_click "wesnoth-confirm-endturn";
assert_screen "wesnoth-night";
assert_and_click "wesnoth-menu";
assert_and_click "wesnoth-menu-quit-to-desktop";
assert_and_click "wesnoth-menu-quit-to-desktop-confirm";
}
1;

0 comments on commit 2468b29

Please sign in to comment.