Debian Codegraph @

tests/xdg-icon-resource/t.icon_nonexist_uninstall

raw
1 #!/bin/bash
2
3 ## Include utility functions.
4 . "$XDG_TEST_DIR/include/testassertions.sh"
5
6 . "$XDG_TEST_DIR/include/testcontrol.sh"
7
8 ## Test function
9 test_icon_nonexist_uninstall() {
10 test_start "$FUNCNAME: verify $ICON is uninstalled correctly even if it is not installed"
11
12 ## Begin the test.
13 userpath="$HOME/.icons:$HOME/.local:$XDG_DATA_HOME"
14
15 # Dependencies section
16 test_init
17
18 set_no_display
19 use_file "$XDG_TEST_DIR/icons/$ICON" ICON_FILE
20 assert_file "$ICON_FILE"
21
22 # Verify the test icon is not installed already.
23 assert_file_not_in_path "$ICON_FILE" "$userpath"
24
25 # Test steps section
26 test_procedure
27
28 assert_exit 0 xdg-icon-resource uninstall --mode user --size "$SIZE" "$ICON_FILE"
29 assert_nostdout
30 assert_nostderr
31
32 assert_file_not_in_path "$ICON_FILE" "$userpath"
33
34 test_result
35 }
36
37 repeat_test test_icon_nonexist_uninstall 2 ICON SIZE 'red-16.png' 'red-22.png' 'red-24.png' 'red-32.png' 16 22 24 32
38 repeat_test test_icon_nonexist_uninstall 2 ICON SIZE 'red-48.png' 'red-64.png' 'red-128.png' 48 64 128