nixos/libinput: add module tests

main
Thiago Kenji Okada 3 years ago
parent c7a180ab0c
commit 63b4b8616b
  1. 3
      nixos/tests/all-tests.nix
  2. 38
      nixos/tests/libinput.nix
  3. 5
      pkgs/development/libraries/libinput/default.nix

@ -228,9 +228,10 @@ in
kubernetes = handleTestOn ["x86_64-linux"] ./kubernetes {};
latestKernel.login = handleTest ./login.nix { latestKernel = true; };
leaps = handleTest ./leaps.nix {};
libinput = handleTest ./libinput.nix {};
libreddit = handleTest ./libreddit.nix {};
lidarr = handleTest ./lidarr.nix {};
libreswan = handleTest ./libreswan.nix {};
lidarr = handleTest ./lidarr.nix {};
lightdm = handleTest ./lightdm.nix {};
limesurvey = handleTest ./limesurvey.nix {};
litestream = handleTest ./litestream.nix {};

@ -0,0 +1,38 @@
import ./make-test-python.nix ({ ... }:
{
name = "libinput";
machine = { ... }:
{
imports = [
./common/x11.nix
./common/user-account.nix
];
test-support.displayManager.auto.user = "alice";
services.xserver.libinput = {
enable = true;
mouse = {
naturalScrolling = true;
leftHanded = true;
middleEmulation = false;
horizontalScrolling = false;
};
};
};
testScript = ''
def expect_xserver_option(option, value):
machine.succeed(f"""cat /var/log/X.0.log | grep -F 'Option "{option}" "{value}"'""")
machine.start()
machine.wait_for_x()
machine.succeed("""cat /var/log/X.0.log | grep -F "Using input driver 'libinput'" """)
expect_xserver_option("NaturalScrolling", "on")
expect_xserver_option("LeftHanded", "on")
expect_xserver_option("MiddleEmulation", "off")
expect_xserver_option("HorizontalScrolling", "off")
'';
})

@ -3,6 +3,7 @@
, documentationSupport ? false, doxygen, graphviz # Documentation
, eventGUISupport ? false, cairo, glib, gtk3 # GUI event viewer support
, testsSupport ? false, check, valgrind, python3
, nixosTests
}:
let
@ -76,6 +77,10 @@ stdenv.mkDerivation rec {
doCheck = testsSupport && stdenv.hostPlatform == stdenv.buildPlatform;
passthru.tests = {
libinput-module = nixosTests.libinput;
};
meta = with lib; {
description = "Handles input devices in Wayland compositors and provides a generic X.Org input driver";
homepage = "https://www.freedesktop.org/wiki/Software/libinput/";

Loading…
Cancel
Save