mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-06 09:01:04 +01:00
tests/gtk: expand testing for new customization
We can now customize a lot more in the gtk module. Test more scenarios to ensure a user has more control over what gets generated. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
d9915499e3
commit
18ff4e1e11
5 changed files with 204 additions and 0 deletions
49
tests/modules/misc/gtk/gtk4-theme-css-injection.nix
Normal file
49
tests/modules/misc/gtk/gtk4-theme-css-injection.nix
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
# Test GTK4 theme CSS injection with both theme and custom CSS
|
||||
gtk = {
|
||||
enable = true;
|
||||
|
||||
gtk4 = {
|
||||
theme = {
|
||||
name = "Adwaita-dark";
|
||||
package = pkgs.gnome-themes-extra;
|
||||
};
|
||||
extraCss = ''
|
||||
/* Custom user CSS */
|
||||
window {
|
||||
background-color: #2d2d2d;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 8px;
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
# GTK4 CSS should exist and contain both theme import and custom CSS
|
||||
assertFileExists home-files/.config/gtk-4.0/gtk.css
|
||||
|
||||
# Check for theme import comment and URL
|
||||
assertFileRegex home-files/.config/gtk-4.0/gtk.css '/\*\*'
|
||||
assertFileRegex home-files/.config/gtk-4.0/gtk.css 'GTK 4 reads the theme configured by gtk-theme-name, but ignores it'
|
||||
assertFileRegex home-files/.config/gtk-4.0/gtk.css '@import url("file://.*/share/themes/Adwaita-dark/gtk-4.0/gtk.css")'
|
||||
|
||||
# Check for custom CSS
|
||||
assertFileRegex home-files/.config/gtk-4.0/gtk.css 'Custom user CSS'
|
||||
assertFileRegex home-files/.config/gtk-4.0/gtk.css 'background-color: #2d2d2d'
|
||||
assertFileRegex home-files/.config/gtk-4.0/gtk.css 'border-radius: 8px'
|
||||
|
||||
# Verify the theme import comes before custom CSS
|
||||
css_content=$(cat home-files/.config/gtk-4.0/gtk.css)
|
||||
import_line=$(echo "$css_content" | grep -n "@import" | cut -d: -f1)
|
||||
custom_line=$(echo "$css_content" | grep -n "Custom user CSS" | cut -d: -f1)
|
||||
|
||||
if [ "$import_line" -ge "$custom_line" ]; then
|
||||
echo "Theme import should come before custom CSS"
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue