| 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_system_as_nonroot() { |
| 10 |
ICON_PATH="$HOME/.icons:${XDG_DATA_DIRS-/usr/local/share:/usr/share}:/usr/share/pixmaps:$HOME/.local/icons:$XDG_DATA_HOME" |
| 11 |
|
| 12 |
## Begin the test. |
| 13 |
test_start "$FUNCNAME: verify error for --mode system when run as a normal user" |
| 14 |
|
| 15 |
# Dependencies section |
| 16 |
test_init |
| 17 |
|
| 18 |
require_notroot |
| 19 |
set_no_display |
| 20 |
|
| 21 |
use_file "$XDG_TEST_DIR/icons/red-32.png" ICONFILE |
| 22 |
assert_file "$ICONFILE" |
| 23 |
|
| 24 |
# Verify the test icon is not installed already. |
| 25 |
assert_file_not_in_path "$ICONFILE" "$ICON_PATH" |
| 26 |
|
| 27 |
# Test steps section |
| 28 |
test_procedure |
| 29 |
|
| 30 |
assert_exit 3 xdg-icon-resource install --mode system --size 32 "$ICONFILE" |
| 31 |
assert_nostdout |
| 32 |
assert_stderr |
| 33 |
|
| 34 |
assert_file_not_in_path "$ICONFILE" "$ICON_PATH" |
| 35 |
|
| 36 |
assert_exit 3 xdg-icon-resource uninstall --mode system --size 32 "$ICONFILE" |
| 37 |
assert_nostdout |
| 38 |
assert_stderr |
| 39 |
|
| 40 |
test_result |
| 41 |
} |
| 42 |
run_test test_icon_system_as_nonroot |