Debian Codegraph @

tests/xdg-desktop-menu/t.10-simple_menu_item_user_install

raw
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_user_install() {
9 ## Begin the test.
10 test_start "$FUNCNAME: verify a basic desktop file is installed in the user's applications 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="$HOME/.local"
18
19 set_no_display
20
21 use_file "$XDG_TEST_DIR/xdg-desktop-menu/data/menu_item_category.desktop" DESKTOP
22 edit_file "$DESKTOP" 'xdg-test-menu-item-install.tmp' CREATEFILE
23 edit_file "$DESKTOP" 'Test Menu Categories' ITEM_TEXT "TEST $XDG_TEST_SHORTID"
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 --mode user "$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, possibly 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 fi
48
49 assert_exit 0 xdg-desktop-menu uninstall --mode user "$DESKTOP"
50 assert_nostdout
51 assert_nostderr
52
53 assert_file_not_in_path "$DESKTOP" "$USERPATH"
54
55 assert_interactive_notroot "Is the menu item '$ITEM_TEXT' still present?" n
56
57 test_result
58 }
59
60 run_test test_simple_menu_item_user_install