iconsmaker 0.1.2

Generate platform icon bundles (macOS, Windows, Linux) from a single SVG
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
use std::path::Path;

use crate::cli::Cli;
use crate::config::{
    AppConfig, Config, EffectsConfig, InputConfig, LinuxConfig, OutputConfig, PackagingConfig,
    PlatformConfig, RawConfig,
};

// ============================================================================
// The validation grid.
//
// `resolve` merges CLI flags over the config file (flags win), works out which
// platforms are selected, then evaluates a requirement grid that depends on that
// selection. Missing HARD requirements block with an aggregated, fix-oriented
// message; missing SOFT recommendations warn (and, under --strict, become hard).
// ============================================================================

#[derive(Clone, Copy)]
pub struct Selection {
    pub macos: bool,
    pub windows: bool,
    pub linux: bool,
    pub snap: bool,
    pub flatpak: bool,
    pub appimage: bool,
}

/// All settings after merging CLI over config — the input to the grid. Kept as a
/// plain struct (no clap, no fs) so the grid can be unit-tested directly.
struct Merged {
    svg: Option<String>,
    svg_exists: bool,
    symbolic: Option<String>,

    id: Option<String>,
    name: Option<String>,
    exec: Option<String>,
    generic_name: Option<String>,
    comment: Option<String>,
    description: Option<String>,
    categories: Vec<String>,
    keywords: Vec<String>,
    startup_wm_class: Option<String>,
    mime_types: Vec<String>,
    license: Option<String>,
    metadata_license: Option<String>,
    homepage_url: Option<String>,
    developer_name: Option<String>,

    output_dir: String,
    hicolor_sizes: Vec<u32>,
    squircle_power: f32,
    squircle_depth: bool,
    gloss_strength: f32,
    depth_blur: f32,
    deb: bool,

    sel: Selection,
}

struct HardProblem {
    headline: String,
    detail: Vec<(&'static str, String)>,
}

impl HardProblem {
    fn new(headline: impl Into<String>, detail: Vec<(&'static str, String)>) -> Self {
        Self { headline: headline.into(), detail }
    }
}

struct SoftProblem {
    headline: String,
    hint: String,
}

struct Problems {
    hard: Vec<HardProblem>,
    soft: Vec<SoftProblem>,
}

// ── Public entry point ───────────────────────────────────────────────────────

/// Merge, resolve platform selection, run the grid, and lower into a concrete
/// `Config`. On hard failure returns an Err whose Display is the full formatted
/// error block (main prints it verbatim). Warnings are printed to stderr here.
pub fn resolve(cli: &Cli, raw: RawConfig, config_loaded: bool) -> anyhow::Result<Config> {
    // Selection precedence:
    //   1. any platform/packaging flag  → the CLI drives selection
    //   2. else a config was loaded     → its [platforms]/[packaging] drive it
    //   3. else (flags-only, none given) → nothing selected → "no platform" error
    let sel = if cli.controls_selection() {
        Selection {
            macos: cli.all || cli.macos,
            windows: cli.all || cli.windows,
            linux: cli.all || cli.linux,
            snap: cli.snap,
            flatpak: cli.flatpak,
            appimage: cli.appimage,
        }
    } else if config_loaded {
        Selection {
            macos: raw.platforms.macos,
            windows: raw.platforms.windows,
            linux: raw.platforms.linux,
            snap: raw.packaging.snap,
            flatpak: raw.packaging.flatpak,
            appimage: raw.packaging.appimage,
        }
    } else {
        Selection {
            macos: false,
            windows: false,
            linux: false,
            snap: false,
            flatpak: false,
            appimage: false,
        }
    };

    // Merge flags over config (flag.or(config); lists replace wholesale).
    let svg = cli.resolve_input()?.or(raw.input.svg);
    let svg_exists = svg.as_deref().is_some_and(|p| Path::new(p).exists());

    let m = Merged {
        svg,
        svg_exists,
        symbolic: cli.symbolic.clone().or(raw.input.symbolic_svg),
        id: cli.id.clone().or(raw.app.id),
        name: cli.name.clone().or(raw.app.name),
        exec: cli.exec.clone().or(raw.app.exec),
        generic_name: cli.generic_name.clone().or(raw.app.generic_name),
        comment: cli.comment.clone().or(raw.app.comment),
        description: cli.description.clone().or(raw.app.description),
        categories: cli.categories.clone().unwrap_or(raw.app.categories),
        keywords: cli.keywords.clone().unwrap_or(raw.app.keywords),
        startup_wm_class: cli.startup_wm_class.clone().or(raw.app.startup_wm_class),
        mime_types: cli.mime_types.clone().unwrap_or(raw.app.mime_types),
        license: cli.license.clone().or(raw.app.license),
        metadata_license: cli.metadata_license.clone().or(raw.app.metadata_license),
        homepage_url: cli.homepage_url.clone().or(raw.app.homepage_url),
        developer_name: cli.developer_name.clone().or(raw.app.developer_name),
        output_dir: cli.output.clone().unwrap_or(raw.output.dir),
        hicolor_sizes: cli.hicolor_sizes.clone().unwrap_or(raw.linux.hicolor_sizes),
        squircle_power: cli.squircle_power.unwrap_or(raw.effects.squircle_power),
        squircle_depth: cli.depth_override().unwrap_or(raw.effects.squircle_depth),
        gloss_strength: cli.gloss_strength.unwrap_or(raw.effects.gloss_strength),
        depth_blur: cli.depth_blur.unwrap_or(raw.effects.depth_blur),
        deb: raw.packaging.deb,
        sel,
    };

    let mut problems = evaluate(&m);

    // --strict: promote every soft warning to a hard error.
    if cli.strict {
        for sp in problems.soft.drain(..) {
            problems
                .hard
                .push(HardProblem::new(sp.headline, vec![line("fix", sp.hint)]));
        }
    }

    if !problems.hard.is_empty() {
        anyhow::bail!("{}", render_hard(&problems.hard));
    }
    if !problems.soft.is_empty() {
        eprint!("{}", render_soft(&problems.soft));
    }

    Ok(build_config(m))
}

// ── The grid (pure; unit-tested) ─────────────────────────────────────────────

fn evaluate(m: &Merged) -> Problems {
    let mut hard = Vec::new();
    let mut soft = Vec::new();
    let sel = m.sel;
    let any_os = sel.macos || sel.windows || sel.linux;

    // Global: at least one OS target.
    if !any_os {
        hard.push(HardProblem::new(
            "no platform selected",
            vec![
                line("because", "nothing would be generated"),
                line("provide", "--macos / --windows / --linux / --all"),
                line("or in config", "[platforms] macos = true"),
            ],
        ));
    }

    // Packaging requires Linux.
    let pkgs: Vec<&str> = [
        (sel.snap, "--snap"),
        (sel.flatpak, "--flatpak"),
        (sel.appimage, "--appimage"),
    ]
    .iter()
    .filter(|(on, _)| *on)
    .map(|(_, f)| *f)
    .collect();
    if !pkgs.is_empty() && !sel.linux {
        let verb = if pkgs.len() == 1 { "requires" } else { "require" };
        hard.push(HardProblem::new(
            format!("{} {verb} --linux", pkgs.join(", ")),
            vec![
                line(
                    "because",
                    "packaging bundles are built from the Linux hicolor tree + metadata",
                ),
                line("fix", "add --linux (or set [platforms] linux = true)"),
            ],
        ));
    }

    // Input SVG — needed whenever any OS is selected.
    if any_os {
        if !filled(&m.svg) {
            hard.push(HardProblem::new(
                "no input SVG",
                vec![
                    line("because", "there is nothing to render"),
                    line("provide", "--input path/to/master.svg  (or a positional SVG)"),
                    line("or in config", "[input] svg = \"icons/master.svg\""),
                ],
            ));
        } else if !m.svg_exists {
            hard.push(HardProblem::new(
                "input SVG not found",
                vec![
                    line("path", m.svg.clone().unwrap_or_default()),
                    line("fix", "check the path passed to --input / [input] svg"),
                ],
            ));
        }
    }

    // Required identity fields (HARD), gated by which selected targets need them.
    require(
        &mut hard,
        by(&sel, true, true, true),
        filled(&m.name),
        "application name",
        "names the .icns/.ico file, .desktop Name= and AppStream <name>",
        "--name \"My App\"",
        "[app] name = \"My App\"",
    );
    require(
        &mut hard,
        by(&sel, true, false, true),
        filled(&m.id),
        "application id (reverse-DNS)",
        "names every asset, the .desktop Icon= and AppStream <id>",
        "--id com.example.MyApp",
        "[app] id = \"com.example.MyApp\"",
    );
    require(
        &mut hard,
        by(&sel, false, false, true),
        filled(&m.exec),
        "exec command",
        "the .desktop Exec= launch command",
        "--exec \"myapp %F\"",
        "[app] exec = \"myapp %F\"",
    );

    // Recommended Linux metadata (SOFT) — omitting these fails validators.
    if sel.linux {
        recommend(&mut soft, filled(&m.comment), "comment (summary) missing",
            "--comment \"One-line summary\"", "[app] comment = \"\"");
        recommend(&mut soft, filled(&m.description), "description missing",
            "--description \"\"", "[app] description = \"\"");
        recommend(&mut soft, !m.categories.is_empty(), "categories missing",
            "--categories Utility", "[app] categories = [\"Utility\"]");
        recommend(&mut soft, filled(&m.metadata_license), "metadata_license missing",
            "--metadata-license CC0-1.0", "[app] metadata_license = \"CC0-1.0\"");
        recommend(&mut soft, filled(&m.license), "license missing",
            "--license GPL-3.0-or-later", "[app] license = \"GPL-3.0-or-later\"");
        recommend(&mut soft, filled(&m.developer_name), "developer_name missing",
            "--developer-name \"Your Name\"", "[app] developer_name = \"Your Name\"");
    }

    // Format lints (SOFT).
    if let Some(id) = m.id.as_deref()
        && !id.trim().is_empty()
        && !looks_reverse_dns(id)
    {
        soft.push(SoftProblem {
            headline: format!("id \"{id}\" is not reverse-DNS"),
            hint: "use e.g. --id com.example.MyApp".to_string(),
        });
    }
    if sel.linux && !m.categories.is_empty() {
        let bad: Vec<&str> = m
            .categories
            .iter()
            .map(String::as_str)
            .filter(|c| !REGISTERED_CATEGORIES.contains(c))
            .collect();
        if !bad.is_empty() {
            soft.push(SoftProblem {
                headline: format!("unregistered categories: {}", bad.join(", ")),
                hint: "use values from the freedesktop menu spec, e.g. Utility, AudioVideo"
                    .to_string(),
            });
        }
    }

    // Effects ranges (HARD) — only relevant when macOS is selected.
    if sel.macos {
        if m.squircle_power < 2.0 {
            hard.push(HardProblem::new(
                "invalid squircle_power",
                vec![
                    line("value", m.squircle_power.to_string()),
                    line("allowed", ">= 2.0 (below 2 is non-convex)"),
                    line("fix", "--squircle-power 5.0"),
                ],
            ));
        }
        if !(0.0..=1.0).contains(&m.gloss_strength) {
            hard.push(HardProblem::new(
                "invalid gloss_strength",
                vec![
                    line("value", m.gloss_strength.to_string()),
                    line("allowed", "0.0 – 1.0"),
                    line("fix", "--gloss-strength 0.35"),
                ],
            ));
        }
        if !(0.0..=1.0).contains(&m.depth_blur) {
            hard.push(HardProblem::new(
                "invalid depth_blur",
                vec![
                    line("value", m.depth_blur.to_string()),
                    line("allowed", "0.0 – 1.0"),
                    line("fix", "--depth-blur 0.12"),
                ],
            ));
        }
    }

    Problems { hard, soft }
}

// ── Helpers ──────────────────────────────────────────────────────────────────

fn filled(o: &Option<String>) -> bool {
    o.as_deref().is_some_and(|s| !s.trim().is_empty())
}

fn line(key: &'static str, value: impl Into<String>) -> (&'static str, String) {
    (key, value.into())
}

/// Which of the currently-selected targets require a given field.
fn by(sel: &Selection, macos: bool, windows: bool, linux: bool) -> Vec<&'static str> {
    let mut v = Vec::new();
    if macos && sel.macos {
        v.push("--macos");
    }
    if windows && sel.windows {
        v.push("--windows");
    }
    if linux && sel.linux {
        v.push("--linux");
    }
    v
}

#[allow(clippy::too_many_arguments)]
fn require(
    hard: &mut Vec<HardProblem>,
    required_by: Vec<&str>,
    present: bool,
    label: &str,
    because: &str,
    provide: &str,
    config: &str,
) {
    if required_by.is_empty() || present {
        return;
    }
    hard.push(HardProblem::new(
        label.to_string(),
        vec![
            line("required by", required_by.join(", ")),
            line("because", because.to_string()),
            line("provide", provide.to_string()),
            line("or in config", config.to_string()),
        ],
    ));
}

fn recommend(soft: &mut Vec<SoftProblem>, present: bool, headline: &str, flag: &str, config: &str) {
    if present {
        return;
    }
    soft.push(SoftProblem {
        headline: headline.to_string(),
        hint: format!("{flag}   |   {config}"),
    });
}

fn looks_reverse_dns(s: &str) -> bool {
    s.contains('.')
        && !s.chars().any(char::is_whitespace)
        && s.chars()
            .all(|c| c.is_ascii_alphanumeric() || matches!(c, '.' | '-' | '_'))
}

fn render_hard(hard: &[HardProblem]) -> String {
    let mut s = String::from("error: cannot generate the requested icons\n\n");
    for p in hard {
        s.push_str(&format!("{}\n", p.headline));
        for (k, v) in &p.detail {
            s.push_str(&format!("      {k:<13}{v}\n"));
        }
        s.push('\n');
    }
    s.push_str("run `iconsmaker --help` for the full option list.");
    s
}

fn render_soft(soft: &[SoftProblem]) -> String {
    let mut s = format!("warning: {} recommended setting(s) to review\n", soft.len());
    for p in soft {
        s.push_str(&format!("{}{}\n", p.headline, p.hint));
    }
    s.push_str("  (pass --strict to treat these as errors)\n");
    s
}

fn build_config(m: Merged) -> Config {
    Config {
        app: AppConfig {
            id: m.id.unwrap_or_default(),
            name: m.name.unwrap_or_default(),
            generic_name: m.generic_name,
            comment: m.comment,
            exec: m.exec.unwrap_or_default(),
            categories: m.categories,
            keywords: m.keywords,
            startup_wm_class: m.startup_wm_class,
            mime_types: m.mime_types,
            license: m.license,
            metadata_license: m.metadata_license,
            description: m.description,
            homepage_url: m.homepage_url,
            developer_name: m.developer_name,
        },
        input: InputConfig {
            svg: m.svg.unwrap_or_default(),
            symbolic_svg: m.symbolic,
        },
        output: OutputConfig { dir: m.output_dir },
        platforms: PlatformConfig {
            macos: m.sel.macos,
            windows: m.sel.windows,
            linux: m.sel.linux,
        },
        linux: LinuxConfig {
            hicolor_sizes: m.hicolor_sizes,
        },
        effects: EffectsConfig {
            squircle_power: m.squircle_power,
            squircle_depth: m.squircle_depth,
            gloss_strength: m.gloss_strength,
            depth_blur: m.depth_blur,
        },
        packaging: PackagingConfig {
            snap: m.sel.snap,
            flatpak: m.sel.flatpak,
            appimage: m.sel.appimage,
            deb: m.deb,
        },
    }
}

/// freedesktop menu-spec registered categories (main + additional). Used only to
/// lint `[app] categories`; unknown values warn but do not block.
const REGISTERED_CATEGORIES: &[&str] = &[
    // Main
    "AudioVideo", "Audio", "Video", "Development", "Education", "Game", "Graphics",
    "Network", "Office", "Science", "Settings", "System", "Utility",
    // Additional
    "Building", "Debugger", "IDE", "GUIDesigner", "Profiling", "RevisionControl",
    "Translation", "Calendar", "ContactManagement", "Database", "Dictionary", "Chart",
    "Email", "Finance", "FlowChart", "PDA", "ProjectManagement", "Presentation",
    "Spreadsheet", "WordProcessor", "2DGraphics", "VectorGraphics", "RasterGraphics",
    "3DGraphics", "Scanning", "OCR", "Photography", "Publishing", "Viewer", "TextTools",
    "DesktopSettings", "HardwareSettings", "Printing", "PackageManager", "Dialup",
    "InstantMessaging", "Chat", "IRCClient", "Feed", "FileTransfer", "HamRadio", "News",
    "P2P", "RemoteAccess", "Telephony", "TelephonyTools", "VideoConference", "WebBrowser",
    "WebDevelopment", "Midi", "Mixer", "Sequencer", "Tuner", "TV", "AudioVideoEditing",
    "Player", "Recorder", "DiscBurning", "ActionGame", "AdventureGame", "ArcadeGame",
    "BoardGame", "BlocksGame", "CardGame", "KidsGame", "LogicGame", "RolePlaying",
    "Shooter", "Simulation", "SportsGame", "StrategyGame", "Music", "Amusement",
    "Archiving", "Compression", "Electronics", "Emulator", "Engineering", "FileTools",
    "FileManager", "TerminalEmulator", "Filesystem", "Monitor", "Security",
    "Accessibility", "Calculator", "Clock", "TextEditor", "Documentation", "Adult",
    "Core", "KDE", "GNOME", "XFCE", "GTK", "Qt", "Motif", "Java", "ConsoleOnly",
    "Screensaver", "TrayIcon", "Applet", "Shell",
];

// ============================================================================
// Tests
// ============================================================================

#[cfg(test)]
mod tests {
    use super::*;

    fn none() -> Selection {
        Selection { macos: false, windows: false, linux: false, snap: false, flatpak: false, appimage: false }
    }

    /// A Merged with a valid SVG and default effects; identity all empty.
    fn stub(sel: Selection) -> Merged {
        Merged {
            svg: Some("master.svg".into()),
            svg_exists: true,
            symbolic: None,
            id: None,
            name: None,
            exec: None,
            generic_name: None,
            comment: None,
            description: None,
            categories: Vec::new(),
            keywords: Vec::new(),
            startup_wm_class: None,
            mime_types: Vec::new(),
            license: None,
            metadata_license: None,
            homepage_url: None,
            developer_name: None,
            output_dir: "dist".into(),
            hicolor_sizes: vec![16, 32],
            squircle_power: 5.0,
            squircle_depth: true,
            gloss_strength: 0.35,
            depth_blur: 0.12,
            deb: false,
            sel,
        }
    }

    fn has_hard(p: &Problems, needle: &str) -> bool {
        p.hard.iter().any(|h| h.headline.contains(needle))
    }
    fn has_soft(p: &Problems, needle: &str) -> bool {
        p.soft.iter().any(|s| s.headline.contains(needle))
    }

    #[test]
    fn macos_only_requires_id_and_name_but_not_exec() {
        let sel = Selection { macos: true, ..none() };
        let p = evaluate(&stub(sel));
        assert!(has_hard(&p, "application id"));
        assert!(has_hard(&p, "application name"));
        assert!(!has_hard(&p, "exec command"));
        // No Linux metadata demanded when Linux isn't selected.
        assert!(!has_soft(&p, "description missing"));
    }

    #[test]
    fn windows_only_does_not_require_id() {
        let sel = Selection { windows: true, ..none() };
        let mut m = stub(sel);
        m.name = Some("App".into());
        let p = evaluate(&m);
        assert!(!has_hard(&p, "application id"));
        assert!(p.hard.is_empty());
    }

    #[test]
    fn linux_with_identity_warns_on_missing_metadata() {
        let sel = Selection { linux: true, ..none() };
        let mut m = stub(sel);
        m.id = Some("com.example.App".into());
        m.name = Some("App".into());
        m.exec = Some("app".into());
        let p = evaluate(&m);
        assert!(p.hard.is_empty(), "identity satisfied → no hard errors");
        assert!(has_soft(&p, "description missing"));
        assert!(has_soft(&p, "metadata_license missing"));
    }

    #[test]
    fn packaging_without_linux_errors() {
        let sel = Selection { macos: true, snap: true, ..none() };
        let mut m = stub(sel);
        m.id = Some("com.example.App".into());
        m.name = Some("App".into());
        let p = evaluate(&m);
        assert!(has_hard(&p, "--snap requires --linux"));
    }

    #[test]
    fn no_platform_selected_errors() {
        let p = evaluate(&stub(none()));
        assert!(has_hard(&p, "no platform selected"));
        // Field requirements stay quiet when nothing is selected.
        assert!(!has_hard(&p, "application id"));
    }

    #[test]
    fn non_reverse_dns_id_warns() {
        let sel = Selection { linux: true, ..none() };
        let mut m = stub(sel);
        m.id = Some("MyApp".into());
        m.name = Some("App".into());
        m.exec = Some("app".into());
        let p = evaluate(&m);
        assert!(has_soft(&p, "is not reverse-DNS"));
    }

    #[test]
    fn unregistered_category_warns() {
        let sel = Selection { linux: true, ..none() };
        let mut m = stub(sel);
        m.id = Some("com.example.App".into());
        m.name = Some("App".into());
        m.exec = Some("app".into());
        m.categories = vec!["Utility".into(), "Bogus".into()];
        let p = evaluate(&m);
        assert!(has_soft(&p, "unregistered categories: Bogus"));
    }

    #[test]
    fn bad_effects_error_only_for_macos() {
        let mut m = stub(Selection { macos: true, ..none() });
        m.id = Some("com.example.App".into());
        m.name = Some("App".into());
        m.gloss_strength = 5.0;
        assert!(has_hard(&evaluate(&m), "invalid gloss_strength"));

        // Same bad value, but macOS not selected → ignored.
        let mut w = stub(Selection { windows: true, ..none() });
        w.name = Some("App".into());
        w.gloss_strength = 5.0;
        assert!(!has_hard(&evaluate(&w), "invalid gloss_strength"));
    }
}