File: fix-tests.patch

package info (click to toggle)
rust-freedesktop-icons 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 268 kB
  • sloc: makefile: 2
file content (128 lines) | stat: -rw-r--r-- 4,879 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
From f49135271102227f26dbb02810da55f6d978fb60 Mon Sep 17 00:00:00 2001
From: NoisyCoil <noisycoil@tutanota.com>
Date: Tue, 29 Oct 2024 01:00:49 +0100
Subject: [PATCH] Replace icons and themes with ones more suitable to Debian
Forwarded: not-needed

Tests use icon themes and applications which either do not exist in
Debian, or would pull in a lot of dependencies. Replace them with
Debian icons and existing themes.
---
 src/lib.rs         | 21 ++++++++++++---------
 src/theme/mod.rs   | 10 ++++++----
 src/theme/parse.rs |  7 ++-----
 3 files changed, 20 insertions(+), 18 deletions(-)

--- a/src/lib.rs
+++ b/src/lib.rs
@@ -385,13 +385,14 @@
 
     #[test]
     fn simple_lookup() {
-        let firefox = lookup("firefox").find();
+        // The firefox icon used for testing does not exist in Debian, use the Debian emblem instead
+        let debian_emblem = lookup("emblem-debian").find();
 
         asserting!("Lookup with no parameters should return an existing icon")
-            .that(&firefox)
+            .that(&debian_emblem)
             .is_some()
             .is_equal_to(PathBuf::from(
-                "/usr/share/icons/hicolor/22x22/apps/firefox.png",
+                "/usr/share/icons/hicolor/22x22/emblems/emblem-debian.png",
             ));
     }
 
@@ -409,11 +410,12 @@
 
     #[test]
     fn should_fallback_to_parent_theme() {
+        // Debian does not package the Arc icon theme, and Adwaita's icon's path is different
         let icon = lookup("video-single-display-symbolic")
-            .with_theme("Arc")
+            .with_theme("HighContrast")
             .find();
 
-        asserting!("Lookup for an icon in the Arc theme should find the icon in its parent")
+        asserting!("Lookup for an icon in the HighContrast theme should find the icon in its parent")
             .that(&icon)
             .is_some()
             .is_equal_to(PathBuf::from(
@@ -423,16 +425,17 @@
 
     #[test]
     fn should_fallback_to_pixmaps_utlimately() {
-        let archlinux_logo = lookup("archlinux-logo")
+        // Debian does not package the ArchLinux logo. Use the Debian security logo instead
+        let debian_security = lookup("debian-security")
             .with_size(16)
             .with_scale(1)
             .with_theme("Papirus")
             .find();
 
         asserting!("When lookup fail in theme, icon should be found in '/usr/share/pixmaps'")
-            .that(&archlinux_logo)
+            .that(&debian_security)
             .is_some()
-            .is_equal_to(PathBuf::from("/usr/share/pixmaps/archlinux-logo.png"));
+            .is_equal_to(PathBuf::from("/usr/share/pixmaps/debian-security.png"));
     }
 
     /*#[test]
--- a/src/theme/mod.rs
+++ b/src/theme/mod.rs
@@ -236,25 +236,27 @@
 
     #[test]
     fn should_get_png_first() {
+        // Blueman pulls in a ton of dependencies, use the Debian emblem instead
         let themes = THEMES.get("hicolor").unwrap();
         let icon = themes.iter().find_map(|t| {
             let file = crate::theme::read_ini_theme(&t.index);
-            t.try_get_icon_exact_size(file.as_str(), "blueman", 24, 1, true)
+            t.try_get_icon_exact_size(file.as_str(), "emblem-debian", 24, 1, true)
         });
         assert_that!(icon).is_some().is_equal_to(PathBuf::from(
-            "/usr/share/icons/hicolor/22x22/apps/blueman.png",
+            "/usr/share/icons/hicolor/22x22/emblems/emblem-debian.png",
         ));
     }
 
     #[test]
     fn should_get_svg_first() {
+        // Blueman pulls in a ton of dependencies, use the Debian emblem instead
         let themes = THEMES.get("hicolor").unwrap();
         let icon = themes.iter().find_map(|t| {
             let file = crate::theme::read_ini_theme(&t.index);
-            t.try_get_icon_exact_size(file.as_str(), "blueman", 24, 1, false)
+            t.try_get_icon_exact_size(file.as_str(), "emblem-debian", 24, 1, false)
         });
         assert_that!(icon).is_some().is_equal_to(PathBuf::from(
-            "/usr/share/icons/hicolor/22x22/apps/blueman.png",
+            "/usr/share/icons/hicolor/22x22/emblems/emblem-debian.png",
         ));
     }
 }
--- a/src/theme/parse.rs
+++ b/src/theme/parse.rs
@@ -126,18 +126,15 @@
 
     #[test]
     fn should_get_theme_parents() {
-        for theme in THEMES.get("Arc").unwrap() {
+        // Debian does not package the Arc icon theme, use HighContrast instead
+        for theme in THEMES.get("HighContrast").unwrap() {
             let file = crate::theme::read_ini_theme(&theme.index);
             let parents = theme.inherits(&file);
 
             assert_that!(parents).does_not_contain("hicolor");
 
             assert_that!(parents).is_equal_to(vec![
-                "Moka",
-                "Faba",
-                "elementary",
                 "Adwaita",
-                "gnome",
             ]);
         }
     }