Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
shattered-pixel-dungeon: add nixos test
  • Loading branch information
fgaz authored and jonringer committed Aug 9, 2020
1 parent 86a347d commit 6cfda0e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Expand Up @@ -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 {};
Expand Down
29 changes: 29 additions & 0 deletions 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")
'';
})

5 changes: 5 additions & 0 deletions pkgs/games/shattered-pixel-dungeon/default.nix
@@ -1,6 +1,7 @@
{ stdenv
, makeWrapper
, fetchFromGitHub
, nixosTests
, gradle_5
, perl
, jre
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 6cfda0e

Please sign in to comment.