Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shattered-pixel-dungeon: 0.8.1a -> 0.8.2, add test #95007

Merged
merged 2 commits into from
Aug 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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")
'';
})

9 changes: 7 additions & 2 deletions pkgs/games/shattered-pixel-dungeon/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ stdenv
, makeWrapper
, fetchFromGitHub
, nixosTests
, gradle_5
, perl
, jre
Expand All @@ -9,13 +10,13 @@

let
pname = "shattered-pixel-dungeon";
version = "0.8.1a";
version = "0.8.2";

src = fetchFromGitHub {
owner = "00-Evan";
repo = "shattered-pixel-dungeon";
rev = "v${version}";
sha256 = "0cfrcjvnn2j4p7zbz252qbn2jacgwhzaja8lqvif0x1vszyl41v7";
sha256 = "1ra697237vnpx8nsy7dzk958vlyf6jpx1k5dpbr8ybg6vgc3kqx3";
};

postPatch = ''
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