From abbe4db525c4da32067204c371161959f594decd Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Sun, 29 Aug 2004 12:33:51 +0000 Subject: test for NoDisplay=true behavious in .desktop and .directory files. 2004-08-29 Mark McLoughlin * 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. --- menu/tests/ChangeLog | 13 +++++++++++++ menu/tests/data/apps.directory | 1 + menu/tests/data/hidden.desktop | 8 ++++++++ menu/tests/data/hidden.directory | 5 +++++ menu/tests/menutest | 18 ++++++++++++------ menu/tests/tests/m/result | 4 ++++ menu/tests/tests/m/test | 35 +++++++++++++++++++++++++++++++++++ 7 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 menu/tests/data/hidden.desktop create mode 100644 menu/tests/data/hidden.directory create mode 100644 menu/tests/tests/m/result create mode 100644 menu/tests/tests/m/test 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 + + * 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 * tests/f/test: remove from inside 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 < + + + KDE + + + + + + Shouldn't see this + hidden.directory + + TextEditor + + + + + Other + + + + + + +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 -- cgit v1.2.3-70-g09d2