summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTom Whipple <tw@tomwhipple.com>2006-08-11 04:49:49 +0000
committerTom Whipple <tw@tomwhipple.com>2006-08-11 04:49:49 +0000
commit2dc3e2fb59e7a780921f339379a83455ed29d5b5 (patch)
treebc8c679dc23330ed65bc04e765a0bb49aaff1552 /tests
parent11c2711196671cfb0967ada260590be9bdfea290 (diff)
add category test
Diffstat (limited to 'tests')
-rwxr-xr-xtests/xdg-desktop-menu/data/menu_item_category.desktop6
-rwxr-xr-xtests/xdg-desktop-menu/t.14-menu_install_category54
2 files changed, 60 insertions, 0 deletions
diff --git a/tests/xdg-desktop-menu/data/menu_item_category.desktop b/tests/xdg-desktop-menu/data/menu_item_category.desktop
new file mode 100755
index 0000000..6d0f3da
--- /dev/null
+++ b/tests/xdg-desktop-menu/data/menu_item_category.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Type=Application
+Name=Test Menu Categories
+Exec=touch /tmp/xdg-test-menu-item-install.tmp
+Categories=Development
+StartupNotify=false
diff --git a/tests/xdg-desktop-menu/t.14-menu_install_category b/tests/xdg-desktop-menu/t.14-menu_install_category
new file mode 100755
index 0000000..1209bd9
--- /dev/null
+++ b/tests/xdg-desktop-menu/t.14-menu_install_category
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+## Include utility functions.
+. "$XDG_TEST_DIR/include/testassertions.sh"
+. "$XDG_TEST_DIR/include/testcontrol.sh"
+
+## Test function
+test_menu_install_category() {
+## Begin the test.
+test_start "$FUNCNAME: verify a desktop file is installed in the correct category"
+
+# Dependencies section
+test_init
+
+# Generate .desktop file
+#USERPATH="$HOME/.local"
+
+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 Categories' ITEM_TEXT "TEST $XDG_TEST_SHORTID"
+edit_file "$DESKTOP" '/tmp' WORK_DIR "$XDG_TEST_TMPDIR"
+
+assert_file "$DESKTOP"
+
+# Verify the test icon is not installed already.
+#assert_file_not_in_path "$DESKTOP" "$USERPATH"
+
+# Test steps section
+test_procedure
+
+assert_exit 0 xdg-desktop-menu install "$DESKTOP"
+assert_nostdout
+assert_nostderr
+
+#assert_file_in_path "$DESKTOP" "$USERPATH"
+
+#if [ -z "$XDG_TEST_NO_INTERACTIVE" -a `whoami` != 'root' ]; then
+
+assert_interactive "Is an item called '$ITEM_TEXT' somewhere in the menu tree, (probably under 'Development')?\n\t(NOTE: If you are using KDE, it may take a few seconds to appear.)" y
+assert_interactive "Please select the menu item '$ITEM_TEXT'"
+
+## Double clicking will result in the command 'touch xdg-test-menu-item-install.tmp' to be run
+assert_file "$WORK_DIR/$CREATEFILE"
+#fi
+
+## Cleanup
+xdg-desktop-menu uninstall --mode user "$DESKTOP" >/dev/null 2>&1
+
+test_result
+}
+
+run_test test_menu_install_category