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_simple_menu_item_system_install() { |
| 9 ## Begin the test. |
| 10 test_start "$FUNCNAME: verify a desktop file is installed in the system applicat
ions menu" |
| 11 test_purpose "A basic desktop file is installed into the menu." |
| 12 |
| 13 # Dependencies section |
| 14 test_init |
| 15 |
| 16 # Generate .desktop file |
| 17 USERPATH="${XDG_DATA_DIRS-/usr/local/share:/usr/share}:${XDG_CONFIG_DIRS-/etc/xd
g}" |
| 18 |
| 19 require_root |
| 20 set_no_display |
| 21 |
| 22 use_file "$XDG_TEST_DIR/xdg-desktop-menu/data/menu_item_category.desktop" DESKTO
P |
| 23 edit_file "$DESKTOP" 'xdg-test-menu-item-install.tmp' CREATEFILE |
| 24 edit_file "$DESKTOP" 'Test Menu Categories' ITEM_TEXT "TEST $XDG_TEST_SHORTID" |
| 25 edit_file "$DESKTOP" '/tmp' WORK_DIR "$XDG_TEST_TMPDIR" |
| 26 |
| 27 assert_file "$DESKTOP" |
| 28 |
| 29 # Verify the test icon is not installed already. |
| 30 assert_file_not_in_path "$DESKTOP" "$USERPATH" |
| 31 |
| 32 # Test steps section |
| 33 test_procedure |
| 34 |
| 35 assert_exit 0 xdg-desktop-menu install --mode system "$DESKTOP" |
| 36 assert_nostdout |
| 37 assert_nostderr |
| 38 |
| 39 assert_file_in_path "$DESKTOP" "$USERPATH" |
| 40 |
| 41 if [ -z "$XDG_TEST_NO_INTERACTIVE" ]; then |
| 42 assert_interactive "Is an item called '$ITEM_TEXT' somewhere in the menu tree, p
ossibly in a menu dedicated to 'Development'?" y |
| 43 assert_interactive "Please select the menu item '$ITEM_TEXT'" |
| 44 |
| 45 ## Double clicking will result in the command 'touch xdg-test-menu-item-install.
tmp' to be run |
| 46 assert_file "$WORK_DIR/$CREATEFILE" |
| 47 |
| 48 fi |
| 49 |
| 50 assert_exit 0 xdg-desktop-menu uninstall --mode system "$DESKTOP" |
| 51 assert_nostdout |
| 52 assert_nostderr |
| 53 |
| 54 assert_file_not_in_path "$DESKTOP" "$USERPATH" |
| 55 |
| 56 assert_interactive_notroot "Is the menu item '$ITEM_TEXT' still present?" n |
| 57 |
| 58 test_result |
| 59 } |
| 60 |
| 61 run_test test_simple_menu_item_system_install |
OLD | NEW |