summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Kenji Okada <thiagokokada@gmail.com>2021-11-15 08:46:20 -0300
committerThiago Kenji Okada <thiagokokada@gmail.com>2021-11-16 13:09:02 -0300
commit63b4b8616b69dd1ee0be4b3d2098d9332ceee357 (patch)
tree53a4521831547d760675870952fc4c08807b898b
parentc7a180ab0ce358f032755f536e8208fa206e5e64 (diff)
nixos/libinput: add module tests
-rw-r--r--nixos/tests/all-tests.nix3
-rw-r--r--nixos/tests/libinput.nix38
-rw-r--r--pkgs/development/libraries/libinput/default.nix5
3 files changed, 45 insertions, 1 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 985dbd3b6767..a74792d3d2eb 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.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 {};
diff --git a/nixos/tests/libinput.nix b/nixos/tests/libinput.nix
new file mode 100644
index 000000000000..2f84aaadcd0b
--- /dev/null
+++ b/nixos/tests/libinput.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")
+ '';
+})
diff --git a/pkgs/development/libraries/libinput/default.nix b/pkgs/development/libraries/libinput/default.nix
index baee67cb826d..54843486e137 100644
--- a/pkgs/development/libraries/libinput/default.nix
+++ b/pkgs/development/libraries/libinput/default.nix
@@ -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/";