summaryrefslogtreecommitdiff
path: root/tests/xdg-desktop-menu/t.21-simple_menu_item_system_uninstall
blob: f7abefc6380e724e17c191aa692cd432424ea5ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash

## Include utility functions.
. "$XDG_TEST_DIR/include/testassertions.sh"
. "$XDG_TEST_DIR/include/testcontrol.sh"

## Test function
test_simple_menu_item_system_uninstall() {
## Begin the test.
test_start "$FUNCNAME: verify a desktop file is uninstalled from the system applications menu"
test_purpose "A basic desktop file (no category defined) is installed into the menu. It should show up somewhere, but this behavior is not well defined by the spec. This test fails for many systems. This is the corresponding uninstall test."
test_note "Because this behavior is not well defined this test will WARN instead of FAIL"


# Dependencies section
test_init

# Generate .desktop file
USERPATH="${XDG_DATA_DIRS-/usr/local/share:/usr/share}:${XDG_CONFIG_DIRS-/etc/xdg}"

require_root
set_no_display

use_file "$XDG_TEST_DIR/xdg-desktop-menu/data/menu_item_test.desktop" DESKTOP
edit_file "$DESKTOP" 'xdg-test-menu-item-install.tmp' CREATEFILE
edit_file "$DESKTOP" 'Test Menu Item Install' ITEM_TEXT "TEST $XDG_TEST_SHORTID"

assert_file "$DESKTOP"

assert_exit 0 xdg-desktop-menu install --mode system "$DESKTOP"

assert_file_in_path "$DESKTOP" "$USERPATH"
assert_interactive "Is an item called '$ITEM_TEXT' somewhere in the menu tree, possibly in a generic location?\n\t(NOTE: If you are using KDE, it may take a few seconds to appear.)" y


# Test steps section
test_procedure

assert_exit 0 xdg-desktop-menu uninstall --mode system "$DESKTOP"
assert_nostdout
assert_nostderr

assert_file_not_in_path "$DESKTOP" "$USERPATH"

assert_interactive "Is the menu item '$ITEM_TEXT' still present?\n\t(NOTE: see above about KDE)" n

# Desktop file not totally OK.
test_failoverride WARN
test_result
} 

run_test test_simple_menu_item_system_uninstall