| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
## Include utility functions. |
| 4 |
. "$XDG_TEST_DIR/include/testassertions.sh" |
| 5 |
. "$XDG_TEST_DIR/include/testcontrol.sh" |
| 6 |
|
| 7 |
## Test function |
| 8 |
test_menu_install_category() { |
| 9 |
## Begin the test. |
| 10 |
test_start "$FUNCNAME: verify that the menu properly supports the '$CATEGORY' category" |
| 11 |
|
| 12 |
# Dependencies section |
| 13 |
test_init |
| 14 |
|
| 15 |
# Generate .desktop file |
| 16 |
#USERPATH="$HOME/.local" |
| 17 |
|
| 18 |
set_no_display |
| 19 |
|
| 20 |
use_file "$XDG_TEST_DIR/xdg-desktop-menu/data/menu_item_category.desktop" DESKTOP |
| 21 |
edit_file "$DESKTOP" 'xdg-test-menu-item-install.tmp' CREATEFILE |
| 22 |
edit_file "$DESKTOP" 'Test Menu Categories' ITEM_TEXT "TEST $XDG_TEST_SHORTID" |
| 23 |
edit_file "$DESKTOP" 'Development' TMP "$CATEGORY" |
| 24 |
edit_file "$DESKTOP" '/tmp' WORK_DIR "$XDG_TEST_TMPDIR" |
| 25 |
|
| 26 |
assert_file "$DESKTOP" |
| 27 |
|
| 28 |
# Verify the test icon is not installed already. |
| 29 |
#assert_file_not_in_path "$DESKTOP" "$USERPATH" |
| 30 |
|
| 31 |
# Test steps section |
| 32 |
test_procedure |
| 33 |
|
| 34 |
assert_exit 0 xdg-desktop-menu install "$DESKTOP" |
| 35 |
assert_nostdout |
| 36 |
assert_nostderr |
| 37 |
|
| 38 |
#assert_file_in_path "$DESKTOP" "$USERPATH" |
| 39 |
|
| 40 |
#if [ -z "$XDG_TEST_NO_INTERACTIVE" -a `whoami` != 'root' ]; then |
| 41 |
|
| 42 |
assert_interactive "Is an item called '$ITEM_TEXT' somewhere in the menu tree?\n\tThe item is probably in a menu that is related to '$CATEGORY'?" y |
| 43 |
#fi |
| 44 |
|
| 45 |
## Cleanup |
| 46 |
assert_exit 0 xdg-desktop-menu uninstall "$DESKTOP" |
| 47 |
assert_nostdout |
| 48 |
assert_nostderr |
| 49 |
|
| 50 |
test_result |
| 51 |
} |
| 52 |
|
| 53 |
repeat_test test_menu_install_category 1 CATEGORY AudioVideo Game Office System Education Graphics Network Utility |