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_user_uninstall() { |
| 9 ## Begin the test. |
| 10 test_start "$FUNCNAME: verify a user menu is removed correctly" |
| 11 |
| 12 # Dependencies section |
| 13 test_init |
| 14 |
| 15 USERPATH="$HOME/.local:$HOME/.config:$HOME/.gnome:$HOME/.kde" |
| 16 |
| 17 set_no_display |
| 18 |
| 19 # Generate .desktop file |
| 20 use_file "$XDG_TEST_DIR/xdg-desktop-menu/data/menu_item_test.desktop" DESKTOP |
| 21 use_file "$XDG_TEST_DIR/xdg-desktop-menu/data/menu_item_dummy.desktop" DESKTOP2 |
| 22 use_file "$XDG_TEST_DIR/xdg-desktop-menu/data/menu_install.directory" DIRECTORY |
| 23 |
| 24 edit_file "$DIRECTORY" 'XDG UTILS TEST' MENU_NAME "MENU $XDG_TEST_SHORTID" |
| 25 |
| 26 edit_file "$DESKTOP" 'xdg-test-menu-item-install.tmp' CREATEFILE |
| 27 edit_file "$DESKTOP" 'Test Menu Item Install' ITEM_TEXT "TEST $XDG_TEST_SHORTID" |
| 28 |
| 29 assert_file "$DESKTOP" |
| 30 assert_file "$DIRECTORY" |
| 31 |
| 32 assert_exit 0 xdg-desktop-menu install --mode user "$DIRECTORY" "$DESKTOP" "$DES
KTOP2" |
| 33 |
| 34 assert_file_in_path "$DESKTOP" "$USERPATH" |
| 35 assert_file_in_path "$DESKTOP" "$USERPATH2" |
| 36 assert_file_in_path "$DIRECTORY" "$USERPATH" |
| 37 |
| 38 assert_interactive_notroot "Is the menu '<main>/$MENU_NAME present with items 'E
XTRA_ITEM' and '$ITEM_TEXT'\n\t(NOTE: If you are using KDE, it may take a few se
conds to appear.)" y |
| 39 |
| 40 # Test steps section |
| 41 test_procedure |
| 42 |
| 43 assert_exit 0 xdg-desktop-menu uninstall --mode user "$DIRECTORY" "$DESKTOP" "$D
ESKTOP2" |
| 44 assert_nostdout |
| 45 assert_nostderr |
| 46 |
| 47 assert_file_not_in_path "$DESKTOP" "$USERPATH" |
| 48 assert_file_not_in_path "$DESKTOP2" "$USERPATH" |
| 49 assert_file_not_in_path "$DIRECTORY" "$USERPATH" |
| 50 |
| 51 assert_interactive_notroot "Is the menu '<main>/$MENU_NAME' still present?" n |
| 52 assert_interactive_notroot "Is '$ITEM_TEXT' present anywhere in the menu tree?"
n |
| 53 |
| 54 test_result |
| 55 |
| 56 # Cleanup |
| 57 xdg-desktop-menu uninstall --mode user "$DIRECTORY" "$DESKTOP" "$DESKTOP2" > /de
v/null 2> /dev/null |
| 58 |
| 59 } |
| 60 |
| 61 run_test test_menu_user_uninstall |
OLD | NEW |