Skip to content

Commit

Permalink
hyprlock: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Apr 23, 2024
1 parent cae99a7 commit 1e00459
Show file tree
Hide file tree
Showing 5 changed files with 346 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ in import nmtSrc {
./modules/programs/getmail
./modules/programs/gnome-terminal
./modules/programs/hexchat
./modules/programs/hyprlock
./modules/programs/i3blocks
./modules/programs/i3status-rust
./modules/programs/imv
Expand Down
191 changes: 191 additions & 0 deletions tests/modules/programs/hyprlock/basic-configuration.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@


general {
disable_loading_bar = true
grace = 300
hide_cursor = true
no_fade_in = false
no_fade_out = false
ignore_empty_input = false
}

background {
monitor =
path = screenshot
color = rgba(25, 20, 20, 1.0)
blur_size = 8
blur_passes = 3
noise = 0.011700
contrast = 0.891700
brightness = 0.817200
vibrancy = 0.168600
vibrancy_darkness = 0.050000
}




image {
monitor =
path = /home/$USER/.face
size = 120
rounding = -1
border_size = 5
border_color = rgb(202, 211, 245)
rotate = 0.000000
reload_time = -1
reload_cmd =

position = 0, 45
halign = center
valign = center
}


input-field {
monitor =
size = 200, 50
outline_thickness = 5
dots_size = 0.330000
dots_spacing = 0.150000
dots_center = true
dots_rounding = -1
outer_color = rgb(24, 25, 38)
inner_color = rgb(91, 96, 120)
font_color = rgb(202, 211, 245)
fade_on_empty = false
fade_timeout = 2000
placeholder_text = <span foreground="##cad3f5">Password...</span>
hide_input = false
rounding = -1
shadow_passes = 2
shadow_size = 3
shadow_color = rgba(0, 0, 0, 1.0)
shadow_boost = 1.200000
check_color = rgb(204, 136, 34)
fail_color = rgb(204, 34, 34)
fail_text = <i>$FAIL</i>
fail_transition = 300
capslock_color = -1
numlock_color = -1
bothlock_color = -1
invert_numlock = false
swap_font_color = false

position = 0, -80
halign = center
valign = center
}


label {
monitor =
text = <span font_weight="ultrabold">$TIME</span>
text_align =
color = rgb(202, 211, 245)
font_size = 100
font_family = MonaspiceNe Nerd Font
rotate = 0.000000
shadow_passes = 2
shadow_size = 3
shadow_color = rgba(0, 0, 0, 1.0)
shadow_boost = 1.200000

position = 0, 330
halign = center
valign = center
}

label {
monitor =
text = <span font_weight="bold"> $USER</span>
text_align =
color = rgb(202, 211, 245)
font_size = 25
font_family = MonaspiceNe Nerd Font
rotate = 0.000000
shadow_passes = 1
shadow_size = 3
shadow_color = rgba(0, 0, 0, 1.0)
shadow_boost = 1.200000

position = 10, 0
halign = left
valign = top
}

label {
monitor =
text = <span font_weight="ultrabold">󰌾 </span>
text_align =
color = rgb(202, 211, 245)
font_size = 50
font_family = MonaspiceNe Nerd Font
rotate = 0.000000
shadow_passes = 1
shadow_size = 3
shadow_color = rgba(0, 0, 0, 1.0)
shadow_boost = 1.200000

position = 15, -350
halign = center
valign = center
}

label {
monitor =
text = <span font_weight="bold">Locked</span>
text_align =
color = rgb(202, 211, 245)
font_size = 25
font_family = MonaspiceNe Nerd Font
rotate = 0.000000
shadow_passes = 1
shadow_size = 3
shadow_color = rgba(0, 0, 0, 1.0)
shadow_boost = 1.200000

position = 0, -430
halign = center
valign = center
}

label {
monitor =
text = cmd[update:120000] echo "<span font_weight='bold'>$(date +'%a %d %B')</span>"
text_align =
color = rgb(202, 211, 245)
font_size = 30
font_family = MonaspiceNe Nerd Font
rotate = 0.000000
shadow_passes = 1
shadow_size = 3
shadow_color = rgba(0, 0, 0, 1.0)
shadow_boost = 1.200000

position = 0, 210
halign = center
valign = center
}

label {
monitor =
text = <span font_weight="ultrabold"> </span>
text_align =
color = rgb(202, 211, 245)
font_size = 25
font_family = MonaspiceNe Nerd Font
rotate = 0.000000
shadow_passes = 1
shadow_size = 3
shadow_color = rgba(0, 0, 0, 1.0)
shadow_boost = 1.200000

position = 5, 8
halign = right
valign = bottom
}




139 changes: 139 additions & 0 deletions tests/modules/programs/hyprlock/basic-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{ ... }: {
programs.hyprlock = {
enable = true;

general = {
disable_loading_bar = true;
hide_cursor = true;
grace = 300;
no_fade_in = false;
};

backgrounds = [{
path = "screenshot";
blur_passes = 3;
blur_size = 8;
}];

input-fields = [{
size = {
width = 200;
height = 50;
};
position = {
x = 0;
y = -80;
};
outline_thickness = 5;
dots_center = true;
outer_color = "rgb(24, 25, 38)";
inner_color = "rgb(91, 96, 120)";
font_color = "rgb(202, 211, 245)";
fade_on_empty = false;
placeholder_text = ''<span foreground="##cad3f5">Password...</span>'';
shadow_passes = 2;
}];

images = [{
size = 120;
position = {
x = 0;
y = 45;
};
path = "/home/$USER/.face";
border_color = "rgb(202, 211, 245)";
border_size = 5;
halign = "center";
valign = "center";
shadow_passes = 1;
}];

labels = [
{
text = ''<span font_weight="ultrabold">$TIME</span>'';
color = "rgb(202, 211, 245)";
font_size = 100;
font_family = "MonaspiceNe Nerd Font";
valign = "center";
halign = "center";
position = {
x = 0;
y = 330;
};
shadow_passes = 2;
}
{
text = ''<span font_weight="bold"> $USER</span>'';
color = "rgb(202, 211, 245)";
font_size = 25;
font_family = "MonaspiceNe Nerd Font";
valign = "top";
halign = "left";
position = {
x = 10;
y = 0;
};
shadow_passes = 1;
}
{
text = ''<span font_weight="ultrabold">󰌾 </span>'';
color = "rgb(202, 211, 245)";
font_size = 50;
font_family = "MonaspiceNe Nerd Font";
valign = "center";
halign = "center";
position = {
x = 15;
y = -350;
};
shadow_passes = 1;
}
{
text = ''<span font_weight="bold">Locked</span>'';
color = "rgb(202, 211, 245)";
font_size = 25;
font_family = "MonaspiceNe Nerd Font";
valign = "center";
halign = "center";
position = {
x = 0;
y = -430;
};
shadow_passes = 1;
}
{
text = ''
cmd[update:120000] echo "<span font_weight='bold'>$(date +'%a %d %B')</span>"'';
color = "rgb(202, 211, 245)";
font_size = 30;
font_family = "MonaspiceNe Nerd Font";
valign = "center";
halign = "center";
position = {
x = 0;
y = 210;
};
shadow_passes = 1;
}
{
text = ''<span font_weight="ultrabold"> </span>'';
color = "rgb(202, 211, 245)";
font_size = 25;
font_family = "MonaspiceNe Nerd Font";
valign = "bottom";
halign = "right";
position = {
x = 5;
y = 8;
};
shadow_passes = 1;
}
];
};

nmt.script = ''
assertFileContent \
home-files/.config/hypr/hyprlock.conf \
${./basic-configuration.conf}
'';
}
4 changes: 4 additions & 0 deletions tests/modules/programs/hyprlock/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
hyprlock-basic-configuration = ./basic-configuration.nix;
hyprlock-empty-settings = ./empty-settings.nix;
}
11 changes: 11 additions & 0 deletions tests/modules/programs/hyprlock/empty-settings.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ ... }:

{
programs.hyprlock.enable = true;

test.stubs.hyprlock = { };

nmt.script = ''
assertPathNotExists home-files/.config/hypr/hyprlock.conf
'';
}

0 comments on commit 1e00459

Please sign in to comment.