summaryrefslogtreecommitdiffstats
path: root/menu/tests
diff options
context:
space:
mode:
authorMark McLoughlin <mark@skynet.ie>2004-08-29 12:33:51 +0000
committerMark McLoughlin <mark@skynet.ie>2004-08-29 12:33:51 +0000
commitabbe4db525c4da32067204c371161959f594decd (patch)
tree0607c0cfe30b2e1191901e3d671d29e5c9a9bb02 /menu/tests
parent2a3b70fd794c64aac1dfc9d8ba567888195d0903 (diff)
downloadxdg-specs-abbe4db525c4da32067204c371161959f594decd.tar.xz
test for NoDisplay=true behavious in .desktop and .directory files.
2004-08-29 Mark McLoughlin <mark@skynet.ie> * tests/m: test for NoDisplay=true behavious in .desktop and .directory files. * data/hidden.desktop, data/hidden.directory: add. * data/apps.directory: add Type=Directory. * menutest: actually generate a test result if one doesn't exist - makes it easier to write new tests.
Diffstat (limited to 'menu/tests')
-rw-r--r--menu/tests/ChangeLog13
-rw-r--r--menu/tests/data/apps.directory1
-rw-r--r--menu/tests/data/hidden.desktop8
-rw-r--r--menu/tests/data/hidden.directory5
-rwxr-xr-xmenu/tests/menutest18
-rw-r--r--menu/tests/tests/m/result4
-rw-r--r--menu/tests/tests/m/test35
7 files changed, 78 insertions, 6 deletions
diff --git a/menu/tests/ChangeLog b/menu/tests/ChangeLog
index 42f1b1c..b5079f0 100644
--- a/menu/tests/ChangeLog
+++ b/menu/tests/ChangeLog
@@ -1,3 +1,16 @@
+2004-08-29 Mark McLoughlin <mark@skynet.ie>
+
+ * tests/m: test for NoDisplay=true behavious in .desktop and
+ .directory files.
+
+ * data/hidden.desktop,
+ data/hidden.directory: add.
+
+ * data/apps.directory: add Type=Directory.
+
+ * menutest: actually generate a test result if one doesn't
+ exist - makes it easier to write new tests.
+
2003-10-23 Havoc Pennington <hp@redhat.com>
* tests/f/test: remove <OnlyUnallocated/> from inside <Include>
diff --git a/menu/tests/data/apps.directory b/menu/tests/data/apps.directory
index 8981d7a..d54b4bd 100644
--- a/menu/tests/data/apps.directory
+++ b/menu/tests/data/apps.directory
@@ -61,5 +61,6 @@ Name[xh]=Izicelo
Name[zh_CN]=应用程序
Name[zh_TW]=應用程式
Name[zu]=Abayaleli
+Type=Directory
Icon=package_applications
diff --git a/menu/tests/data/hidden.desktop b/menu/tests/data/hidden.desktop
new file mode 100644
index 0000000..dbbbff9
--- /dev/null
+++ b/menu/tests/data/hidden.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Hidden
+Comment=You shouldn't see this
+Exec=hidden
+Type=Application
+Categories=GNOME;Application;TextEditor;
+NoDisplay=true
diff --git a/menu/tests/data/hidden.directory b/menu/tests/data/hidden.directory
new file mode 100644
index 0000000..5f1e776
--- /dev/null
+++ b/menu/tests/data/hidden.directory
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Hidden
+Type=Directory
+NoDisplay=true
diff --git a/menu/tests/menutest b/menu/tests/menutest
index c932fac..6c2ca0e 100755
--- a/menu/tests/menutest
+++ b/menu/tests/menutest
@@ -36,10 +36,7 @@ for TEST in ${TESTS}; do
mkdir ${MENUTESTDIR}
RESULT=tests/${TEST}/result
- if [ ! -e ${RESULT} ]; then
- echo '!!! Result file ('${RESULT}') for '${TEST}' missing'
- else
- (
+ (
echo ">>> Running test ${TEST}"
# Some predefined values
@@ -60,9 +57,18 @@ for TEST in ${TESTS}; do
. tests/${TEST}/test
$MENUTEST > ${MENUTESTDIR}/result1 2> ${MENUTESTDIR}/log
- ./expand ${RESULT} > ${MENUTESTDIR}/result2
- )
+ if [ -e ${RESULT} ]; then
+ ./expand ${RESULT} > ${MENUTESTDIR}/result2
+ fi
+ )
+
+ if [ ! -e ${RESULT} ]; then
+ echo '!!! Result file ('${RESULT}') for '${TEST}' missing'
+ echo '>>> Failed'
+ FAILED="${FAILED} ${TEST}"
+
+ else
if diff -q ${MENUTESTDIR}/result1 ${MENUTESTDIR}/result2 > /dev/null; then
echo '>>> OK'
SUCCEEDED="${SUCCEEDED} ${TEST}"
diff --git a/menu/tests/tests/m/result b/menu/tests/tests/m/result
new file mode 100644
index 0000000..82b7efb
--- /dev/null
+++ b/menu/tests/tests/m/result
@@ -0,0 +1,4 @@
+Other/ kwrite.desktop /tmp/menutestdir/xdg_data_dir/applications/kwrite.desktop
+Other/ freecell.desktop /tmp/menutestdir/xdg_data_dir/applications/freecell.desktop
+Other/ KEdit.desktop /tmp/menutestdir/xdg_data_dir/applications/KEdit.desktop
+Other/ kate.desktop /tmp/menutestdir/xdg_data_dir/applications/kate.desktop
diff --git a/menu/tests/tests/m/test b/menu/tests/tests/m/test
new file mode 100644
index 0000000..19e4ba0
--- /dev/null
+++ b/menu/tests/tests/m/test
@@ -0,0 +1,35 @@
+echo ">>> NoDisplay desktop entry values"
+
+# Generate applications.menu
+mkdir -p ${XDG_CONFIG_DIR}/menus
+./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+
+ <Menu>
+ <Name>Shouldn't see this</Name>
+ <Directory>hidden.directory</Directory>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+
+ <Menu>
+ <Name>Other</Name>
+ <OnlyUnallocated/>
+ <Include>
+ <All/>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+# Install .desktop files
+installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop freecell.desktop hidden.desktop
+installData ${XDG_DATA_DIR}/desktop-directories hidden.directory