OLD | NEW |
(Empty) | |
| 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_system_uninstall() { |
| 9 ## Begin the test. |
| 10 test_start "$FUNCNAME: verify a system menu is removed correctly" |
| 11 |
| 12 # Dependencies section |
| 13 test_init |
| 14 |
| 15 require_root |
| 16 set_no_display |
| 17 |
| 18 USERPATH="${XDG_DATA_DIRS-/usr/local/share:/usr/share}:${XDG_CONFIG_DIRS-/etc/xd
g}" |
| 19 |
| 20 # Generate .desktop file |
| 21 use_file "$XDG_TEST_DIR/xdg-desktop-menu/data/menu_item_test.desktop" DESKTOP |
| 22 use_file "$XDG_TEST_DIR/xdg-desktop-menu/data/menu_item_dummy.desktop" DESKTOP2 |
| 23 use_file "$XDG_TEST_DIR/xdg-desktop-menu/data/menu_install.directory" DIRECTORY |
| 24 |
| 25 edit_file "$DIRECTORY" 'XDG UTILS TEST' MENU_NAME "MENU $XDG_TEST_SHORTID" |
| 26 |
| 27 edit_file "$DESKTOP" 'xdg-test-menu-item-install.tmp' CREATEFILE |
| 28 edit_file "$DESKTOP" 'Test Menu Item Install' ITEM_TEXT "TEST $XDG_TEST_SHORTID" |
| 29 |
| 30 assert_file "$DESKTOP" |
| 31 assert_file "$DIRECTORY" |
| 32 |
| 33 |
| 34 # Verify the test icon is not installed already. |
| 35 assert_file_not_in_path "$DESKTOP" "$USERPATH" |
| 36 assert_file_not_in_path "$DIRECTORY" "$USERPATH" |
| 37 |
| 38 assert_exit 0 xdg-desktop-menu install --mode system "$DIRECTORY" "$DESKTOP" "$D
ESKTOP2" |
| 39 |
| 40 assert_file_in_path "$DESKTOP" "$USERPATH" |
| 41 assert_file_in_path "$DESKTOP" "$USERPATH2" |
| 42 assert_file_in_path "$DIRECTORY" "$USERPATH" |
| 43 |
| 44 assert_interactive "Is the menu '<main>/$MENU_NAME present with items 'EXTRA_ITE
M' and '$ITEM_TEXT'.\n\t(NOTE: If you are using KDE, it may take a few seconds t
o appear.)" y |
| 45 |
| 46 # Test steps section |
| 47 test_procedure |
| 48 |
| 49 assert_exit 0 xdg-desktop-menu uninstall --mode system "$DIRECTORY" "$DESKTOP" "
$DESKTOP2" |
| 50 assert_nostdout |
| 51 assert_nostderr |
| 52 |
| 53 assert_file_not_in_path "$DESKTOP" "$USERPATH" |
| 54 assert_file_not_in_path "$DESKTOP2" "$USERPATH" |
| 55 assert_file_not_in_path "$DIRECTORY" "$USERPATH" |
| 56 |
| 57 assert_interactive "Is the menu '<main>/$MENU_NAME' still present?\n\t(NOTE: If
you are using KDE, it may take a few seconds to disappear.)" n |
| 58 assert_interactive "Is '$ITEM_TEXT' present anywhere in the menu tree?" n |
| 59 |
| 60 test_result |
| 61 |
| 62 # Cleanup |
| 63 xdg-desktop-menu uninstall --mode system "$DIRECTORY" "$DESKTOP" "$DESKTOP2" > /
dev/null 2> /dev/null |
| 64 |
| 65 } |
| 66 |
| 67 run_test test_menu_system_uninstall |
OLD | NEW |