diff options
author | Francesco Gazzetta <fgaz@fgaz.me> | 2020-08-09 15:20:17 +0200 |
---|---|---|
committer | Jon <jonringer@users.noreply.github.com> | 2020-08-09 15:34:30 -0700 |
commit | 6cfda0e92c3043f99acc95c2bb1d57e4d0463413 (patch) | |
tree | 3a9a56b871598b03b3422c9ce44d705e965ef6a4 | |
parent | 86a347d81686dc727f0cd9fe93925b733bdd73d3 (diff) | |
download | nixpkgs-6cfda0e92c3043f99acc95c2bb1d57e4d0463413.tar nixpkgs-6cfda0e92c3043f99acc95c2bb1d57e4d0463413.tar.gz nixpkgs-6cfda0e92c3043f99acc95c2bb1d57e4d0463413.tar.bz2 nixpkgs-6cfda0e92c3043f99acc95c2bb1d57e4d0463413.tar.lz nixpkgs-6cfda0e92c3043f99acc95c2bb1d57e4d0463413.tar.xz nixpkgs-6cfda0e92c3043f99acc95c2bb1d57e4d0463413.tar.zst nixpkgs-6cfda0e92c3043f99acc95c2bb1d57e4d0463413.zip |
shattered-pixel-dungeon: add nixos test
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/shattered-pixel-dungeon.nix | 29 | ||||
-rw-r--r-- | pkgs/games/shattered-pixel-dungeon/default.nix | 5 |
3 files changed, 35 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 31dad3be814..d7e5d70328c 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -306,6 +306,7 @@ in sanoid = handleTest ./sanoid.nix {}; sddm = handleTest ./sddm.nix {}; service-runner = handleTest ./service-runner.nix {}; + shattered-pixel-dungeon = handleTest ./shattered-pixel-dungeon.nix {}; shiori = handleTest ./shiori.nix {}; signal-desktop = handleTest ./signal-desktop.nix {}; simple = handleTest ./simple.nix {}; diff --git a/nixos/tests/shattered-pixel-dungeon.nix b/nixos/tests/shattered-pixel-dungeon.nix new file mode 100644 index 00000000000..cf6ee8db80b --- /dev/null +++ b/nixos/tests/shattered-pixel-dungeon.nix @@ -0,0 +1,29 @@ +import ./make-test-python.nix ({ pkgs, ... }: { + name = "shattered-pixel-dungeon"; + meta = with pkgs.lib.maintainers; { + maintainers = [ fgaz ]; + }; + + machine = { config, pkgs, ... }: { + imports = [ + ./common/x11.nix + ]; + + services.xserver.enable = true; + environment.systemPackages = [ pkgs.shattered-pixel-dungeon ]; + }; + + enableOCR = true; + + testScript = + '' + machine.wait_for_x() + machine.execute("shattered-pixel-dungeon &") + machine.wait_for_window(r"Shattered Pixel Dungeon") + machine.sleep(5) + if "Enter" not in machine.get_screen_text(): + raise Exception("Program did not start successfully") + machine.screenshot("screen") + ''; +}) + diff --git a/pkgs/games/shattered-pixel-dungeon/default.nix b/pkgs/games/shattered-pixel-dungeon/default.nix index 3a87ec38562..76f6ecfb81a 100644 --- a/pkgs/games/shattered-pixel-dungeon/default.nix +++ b/pkgs/games/shattered-pixel-dungeon/default.nix @@ -1,6 +1,7 @@ { stdenv , makeWrapper , fetchFromGitHub +, nixosTests , gradle_5 , perl , jre @@ -66,6 +67,10 @@ in stdenv.mkDerivation rec { --add-flags "-jar $out/share/shattered-pixel-dungeon.jar" ''; + passthru.tests = { + shattered-pixel-dungeon-starts = nixosTests.shattered-pixel-dungeon; + }; + meta = with stdenv.lib; { homepage = "https://shatteredpixel.com/"; downloadPage = "https://github.com/00-Evan/shattered-pixel-dungeon/releases"; |