From 09304026aecad607199bbc0cc4d7fb010820e22a Mon Sep 17 00:00:00 2001 From: Nikita Uvarov Date: Tue, 26 May 2020 14:19:13 +0200 Subject: [PATCH] autorandr: add basic configuration test --- tests/default.nix | 1 + .../autorandr/basic-configuration.conf | 9 ++++ .../autorandr/basic-configuration.nix | 47 +++++++++++++++++++ tests/modules/programs/autorandr/default.nix | 1 + 4 files changed, 58 insertions(+) create mode 100644 tests/modules/programs/autorandr/basic-configuration.conf create mode 100644 tests/modules/programs/autorandr/basic-configuration.nix create mode 100644 tests/modules/programs/autorandr/default.nix diff --git a/tests/default.nix b/tests/default.nix index f8cf92dc2..d7f5222c8 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -64,6 +64,7 @@ import nmt { ./modules/misc/xdg ./modules/misc/xsession ./modules/programs/abook + ./modules/programs/autorandr ./modules/programs/firefox ./modules/programs/getmail ./modules/services/lieer diff --git a/tests/modules/programs/autorandr/basic-configuration.conf b/tests/modules/programs/autorandr/basic-configuration.conf new file mode 100644 index 000000000..980d4d718 --- /dev/null +++ b/tests/modules/programs/autorandr/basic-configuration.conf @@ -0,0 +1,9 @@ +output DP1 +off + +output DP2 +pos 0x0 +primary +mode 1920x1080 +transform 0.600000,0.000000,0.000000,0.000000,0.600000,0.000000,0.000000,0.000000,1.000000 +scale 2x4 \ No newline at end of file diff --git a/tests/modules/programs/autorandr/basic-configuration.nix b/tests/modules/programs/autorandr/basic-configuration.nix new file mode 100644 index 000000000..852094c03 --- /dev/null +++ b/tests/modules/programs/autorandr/basic-configuration.nix @@ -0,0 +1,47 @@ +{ config, pkgs, ... }: + +{ + config = { + programs.autorandr = { + enable = true; + profiles = { + default = { + fingerprint = { + DP1 = "XXX"; + DP2 = "YYY"; + }; + config = { + DP1.enable = false; + DP2 = { + primary = true; + position = "0x0"; + mode = "1920x1080"; + scale = { + x = 2; + y = 4; + }; + transform = [ + [ 0.6 0.0 0.0 ] # a b c + [ 0.0 0.6 0.0 ] # d e f + [ 0.0 0.0 1.0 ] # g h i + ]; + }; + }; + }; + }; + }; + + nmt.script = '' + config=home-files/.config/autorandr/default/config + setup=home-files/.config/autorandr/default/setup + + assertFileExists $setup + assertFileRegex $setup 'DP1 XXX' + assertFileRegex $setup 'DP2 YYY' + + assertFileExists $config + assertFileContent $config \ + ${./basic-configuration.conf} + ''; + }; +} diff --git a/tests/modules/programs/autorandr/default.nix b/tests/modules/programs/autorandr/default.nix new file mode 100644 index 000000000..5f12d4093 --- /dev/null +++ b/tests/modules/programs/autorandr/default.nix @@ -0,0 +1 @@ +{ autorandr-basic-configuration = ./basic-configuration.nix; }