From 612c49cc74998f1fcff39b1cfde6a01f3c18c069 Mon Sep 17 00:00:00 2001 From: Waldo Bastian Date: Fri, 19 Jan 2007 01:14:02 +0000 Subject: Added support for LSB's TET test framework Renamed tests to more * Added support for LSB's TET test framework * Renamed tests to more meaningful names (see ChangeLog for details) --- menu/ChangeLog | 51 +++- menu/tests/menutest | 265 +++++++++++++-------- menu/tests/tests/1/result | 3 - menu/tests/tests/1/test | 24 -- menu/tests/tests/2/result | 3 - menu/tests/tests/2/test | 42 ---- menu/tests/tests/3/result | 2 - menu/tests/tests/3/test | 34 --- menu/tests/tests/4/result | 2 - menu/tests/tests/4/test | 33 --- menu/tests/tests/5/result | 4 - menu/tests/tests/5/test | 25 -- menu/tests/tests/6/result | 1 - menu/tests/tests/6/test | 25 -- menu/tests/tests/7/result | 1 - menu/tests/tests/7/test | 28 --- menu/tests/tests/8/result | 4 - menu/tests/tests/8/test | 28 --- menu/tests/tests/9/result | 3 - menu/tests/tests/9/test | 31 --- menu/tests/tests/All/result | 4 + menu/tests/tests/All/test | 26 ++ menu/tests/tests/And/result | 1 + menu/tests/tests/And/test | 29 +++ menu/tests/tests/AppDir-relative/result | 3 + menu/tests/tests/AppDir-relative/test | 27 +++ menu/tests/tests/AppDir/test | 4 + menu/tests/tests/Category/result | 3 + menu/tests/tests/Category/test | 29 +++ menu/tests/tests/DefaultMergeDirs/result | 5 + menu/tests/tests/DefaultMergeDirs/test | 43 ++++ menu/tests/tests/Deleted/result | 2 + menu/tests/tests/Deleted/test | 35 +++ menu/tests/tests/DesktopFileID/result | 4 + menu/tests/tests/DesktopFileID/test | 26 ++ menu/tests/tests/Directory/result | 3 + menu/tests/tests/Directory/test | 29 +++ menu/tests/tests/DirectoryDir-relative/result | 3 + menu/tests/tests/DirectoryDir-relative/test | 28 +++ menu/tests/tests/DirectoryDir/test | 4 + menu/tests/tests/Exclude/result | 3 + menu/tests/tests/Exclude/test | 32 +++ menu/tests/tests/Filename/result | 1 + menu/tests/tests/Filename/test | 26 ++ menu/tests/tests/LegacyDir-Move/result | 2 + menu/tests/tests/LegacyDir-Move/test | 39 +++ menu/tests/tests/LegacyDir-relative/result | 9 + menu/tests/tests/LegacyDir-relative/test | 42 ++++ menu/tests/tests/Merge-combined/result | 1 + menu/tests/tests/Merge-combined/test | 46 ++++ menu/tests/tests/MergeDir-absolute/test | 3 + menu/tests/tests/MergeDir-relative/result | 5 + menu/tests/tests/MergeDir-relative/test | 61 +++++ menu/tests/tests/MergeFile-absolute/test | 3 + menu/tests/tests/MergeFile-parent/result | 5 + menu/tests/tests/MergeFile-parent/test | 61 +++++ menu/tests/tests/MergeFile-path/result | 5 + menu/tests/tests/MergeFile-path/test | 61 +++++ menu/tests/tests/MergeFile-recursive/result | 5 + menu/tests/tests/MergeFile-recursive/test | 58 +++++ menu/tests/tests/MergeFile-relative/result | 5 + menu/tests/tests/MergeFile-relative/test | 44 ++++ menu/tests/tests/MergeFile2/result | 5 + menu/tests/tests/MergeFile2/test | 57 +++++ menu/tests/tests/MergeFile3/result | 5 + menu/tests/tests/MergeFile3/test | 56 +++++ menu/tests/tests/Move-collapsing/result | 4 + menu/tests/tests/Move-collapsing/test | 40 ++++ menu/tests/tests/Move-ordering/result | 3 + menu/tests/tests/Move-ordering/test | 49 ++++ menu/tests/tests/Move-submenu/result | 1 + menu/tests/tests/Move-submenu/test | 32 +++ menu/tests/tests/Move/result | 2 + menu/tests/tests/Move/test | 34 +++ menu/tests/tests/NoDisplay/result | 1 + menu/tests/tests/NoDisplay/test | 37 +++ menu/tests/tests/NoDisplay2/result | 1 + menu/tests/tests/NoDisplay2/test | 38 +++ menu/tests/tests/NotOnlyUnallocated-default/result | 2 + menu/tests/tests/NotOnlyUnallocated-default/test | 33 +++ menu/tests/tests/OnlyUnallocated/result | 3 + menu/tests/tests/OnlyUnallocated/test | 44 ++++ menu/tests/tests/Or/result | 4 + menu/tests/tests/Or/test | 29 +++ menu/tests/tests/a/result | 4 - menu/tests/tests/a/test | 25 -- menu/tests/tests/b/result | 5 - menu/tests/tests/b/test | 35 --- menu/tests/tests/boolean-logic/result | 3 + menu/tests/tests/boolean-logic/test | 36 +++ menu/tests/tests/c/result | 3 - menu/tests/tests/c/test | 28 --- menu/tests/tests/d/result | 5 - menu/tests/tests/d/test | 31 --- menu/tests/tests/desktop-name-collision/result | 3 + menu/tests/tests/desktop-name-collision/test | 53 +++++ menu/tests/tests/e/result | 9 - menu/tests/tests/e/test | 45 ---- menu/tests/tests/f/result | 4 - menu/tests/tests/f/test | 39 --- menu/tests/tests/g/result | 3 - menu/tests/tests/g/test | 25 -- menu/tests/tests/h/result | 3 - menu/tests/tests/h/test | 28 --- menu/tests/tests/i/result | 5 - menu/tests/tests/i/test | 42 ---- menu/tests/tests/j/result | 5 - menu/tests/tests/j/test | 42 ---- menu/tests/tests/k/result | 5 - menu/tests/tests/k/test | 43 ---- menu/tests/tests/l/result | 5 - menu/tests/tests/l/test | 56 ----- menu/tests/tests/m/result | 1 - menu/tests/tests/m/test | 35 --- menu/tests/tests/menu-multiple-matching/result | 5 + menu/tests/tests/menu-multiple-matching/test | 36 +++ menu/tests/tests/n/result | 1 - menu/tests/tests/n/test | 36 --- menu/tests/tests/o/result | 3 - menu/tests/tests/o/test | 34 --- .../tests/official-categories/categories.list | 10 + menu/tests/tests/official-categories/test | 73 ++++++ .../tests/official-categories/unique-entry.desktop | 9 + menu/tests/tests/p/result | 5 - menu/tests/tests/p/test | 55 ----- menu/tests/tests/q/result | 5 - menu/tests/tests/q/test | 60 ----- menu/tests/tests/r/result | 5 - menu/tests/tests/r/test | 60 ----- menu/tests/tests/s/result | 3 - menu/tests/tests/s/test | 51 ---- menu/tests/tests/submenu-collision/result | 5 + menu/tests/tests/submenu-collision/test | 32 +++ menu/tests/tests/t/result | 3 - menu/tests/tests/t/test | 47 ---- menu/tests/tests/u/result | 5 - menu/tests/tests/u/test | 58 ----- menu/tests/tests/v/result | 2 - menu/tests/tests/v/test | 31 --- menu/tests/tests/w/result | 2 - menu/tests/tests/w/test | 38 --- menu/tests/tests/x/result | 1 - menu/tests/tests/x/test | 31 --- menu/tests/tests/y/result | 1 - menu/tests/tests/y/test | 45 ---- menu/tests/tet_menutest | 39 +++ menu/tet_scen | 5 + menu/tetexec.cfg | 1 + 148 files changed, 1833 insertions(+), 1504 deletions(-) delete mode 100644 menu/tests/tests/1/result delete mode 100644 menu/tests/tests/1/test delete mode 100644 menu/tests/tests/2/result delete mode 100644 menu/tests/tests/2/test delete mode 100644 menu/tests/tests/3/result delete mode 100644 menu/tests/tests/3/test delete mode 100644 menu/tests/tests/4/result delete mode 100644 menu/tests/tests/4/test delete mode 100644 menu/tests/tests/5/result delete mode 100644 menu/tests/tests/5/test delete mode 100644 menu/tests/tests/6/result delete mode 100644 menu/tests/tests/6/test delete mode 100644 menu/tests/tests/7/result delete mode 100644 menu/tests/tests/7/test delete mode 100644 menu/tests/tests/8/result delete mode 100644 menu/tests/tests/8/test delete mode 100644 menu/tests/tests/9/result delete mode 100644 menu/tests/tests/9/test create mode 100644 menu/tests/tests/All/result create mode 100644 menu/tests/tests/All/test create mode 100644 menu/tests/tests/And/result create mode 100644 menu/tests/tests/And/test create mode 100644 menu/tests/tests/AppDir-relative/result create mode 100644 menu/tests/tests/AppDir-relative/test create mode 100644 menu/tests/tests/AppDir/test create mode 100644 menu/tests/tests/Category/result create mode 100644 menu/tests/tests/Category/test create mode 100644 menu/tests/tests/DefaultMergeDirs/result create mode 100644 menu/tests/tests/DefaultMergeDirs/test create mode 100644 menu/tests/tests/Deleted/result create mode 100644 menu/tests/tests/Deleted/test create mode 100644 menu/tests/tests/DesktopFileID/result create mode 100644 menu/tests/tests/DesktopFileID/test create mode 100644 menu/tests/tests/Directory/result create mode 100644 menu/tests/tests/Directory/test create mode 100644 menu/tests/tests/DirectoryDir-relative/result create mode 100644 menu/tests/tests/DirectoryDir-relative/test create mode 100644 menu/tests/tests/DirectoryDir/test create mode 100644 menu/tests/tests/Exclude/result create mode 100644 menu/tests/tests/Exclude/test create mode 100644 menu/tests/tests/Filename/result create mode 100644 menu/tests/tests/Filename/test create mode 100644 menu/tests/tests/LegacyDir-Move/result create mode 100644 menu/tests/tests/LegacyDir-Move/test create mode 100644 menu/tests/tests/LegacyDir-relative/result create mode 100644 menu/tests/tests/LegacyDir-relative/test create mode 100644 menu/tests/tests/Merge-combined/result create mode 100644 menu/tests/tests/Merge-combined/test create mode 100644 menu/tests/tests/MergeDir-absolute/test create mode 100644 menu/tests/tests/MergeDir-relative/result create mode 100644 menu/tests/tests/MergeDir-relative/test create mode 100644 menu/tests/tests/MergeFile-absolute/test create mode 100644 menu/tests/tests/MergeFile-parent/result create mode 100644 menu/tests/tests/MergeFile-parent/test create mode 100644 menu/tests/tests/MergeFile-path/result create mode 100644 menu/tests/tests/MergeFile-path/test create mode 100644 menu/tests/tests/MergeFile-recursive/result create mode 100644 menu/tests/tests/MergeFile-recursive/test create mode 100644 menu/tests/tests/MergeFile-relative/result create mode 100644 menu/tests/tests/MergeFile-relative/test create mode 100644 menu/tests/tests/MergeFile2/result create mode 100644 menu/tests/tests/MergeFile2/test create mode 100644 menu/tests/tests/MergeFile3/result create mode 100644 menu/tests/tests/MergeFile3/test create mode 100644 menu/tests/tests/Move-collapsing/result create mode 100644 menu/tests/tests/Move-collapsing/test create mode 100644 menu/tests/tests/Move-ordering/result create mode 100644 menu/tests/tests/Move-ordering/test create mode 100644 menu/tests/tests/Move-submenu/result create mode 100644 menu/tests/tests/Move-submenu/test create mode 100644 menu/tests/tests/Move/result create mode 100644 menu/tests/tests/Move/test create mode 100644 menu/tests/tests/NoDisplay/result create mode 100644 menu/tests/tests/NoDisplay/test create mode 100644 menu/tests/tests/NoDisplay2/result create mode 100644 menu/tests/tests/NoDisplay2/test create mode 100644 menu/tests/tests/NotOnlyUnallocated-default/result create mode 100644 menu/tests/tests/NotOnlyUnallocated-default/test create mode 100644 menu/tests/tests/OnlyUnallocated/result create mode 100644 menu/tests/tests/OnlyUnallocated/test create mode 100644 menu/tests/tests/Or/result create mode 100644 menu/tests/tests/Or/test delete mode 100644 menu/tests/tests/a/result delete mode 100644 menu/tests/tests/a/test delete mode 100644 menu/tests/tests/b/result delete mode 100644 menu/tests/tests/b/test create mode 100644 menu/tests/tests/boolean-logic/result create mode 100644 menu/tests/tests/boolean-logic/test delete mode 100644 menu/tests/tests/c/result delete mode 100644 menu/tests/tests/c/test delete mode 100644 menu/tests/tests/d/result delete mode 100644 menu/tests/tests/d/test create mode 100644 menu/tests/tests/desktop-name-collision/result create mode 100644 menu/tests/tests/desktop-name-collision/test delete mode 100644 menu/tests/tests/e/result delete mode 100644 menu/tests/tests/e/test delete mode 100644 menu/tests/tests/f/result delete mode 100644 menu/tests/tests/f/test delete mode 100644 menu/tests/tests/g/result delete mode 100644 menu/tests/tests/g/test delete mode 100644 menu/tests/tests/h/result delete mode 100644 menu/tests/tests/h/test delete mode 100644 menu/tests/tests/i/result delete mode 100644 menu/tests/tests/i/test delete mode 100644 menu/tests/tests/j/result delete mode 100644 menu/tests/tests/j/test delete mode 100644 menu/tests/tests/k/result delete mode 100644 menu/tests/tests/k/test delete mode 100644 menu/tests/tests/l/result delete mode 100644 menu/tests/tests/l/test delete mode 100644 menu/tests/tests/m/result delete mode 100644 menu/tests/tests/m/test create mode 100644 menu/tests/tests/menu-multiple-matching/result create mode 100644 menu/tests/tests/menu-multiple-matching/test delete mode 100644 menu/tests/tests/n/result delete mode 100644 menu/tests/tests/n/test delete mode 100644 menu/tests/tests/o/result delete mode 100644 menu/tests/tests/o/test create mode 100644 menu/tests/tests/official-categories/categories.list create mode 100644 menu/tests/tests/official-categories/test create mode 100644 menu/tests/tests/official-categories/unique-entry.desktop delete mode 100644 menu/tests/tests/p/result delete mode 100644 menu/tests/tests/p/test delete mode 100644 menu/tests/tests/q/result delete mode 100644 menu/tests/tests/q/test delete mode 100644 menu/tests/tests/r/result delete mode 100644 menu/tests/tests/r/test delete mode 100644 menu/tests/tests/s/result delete mode 100644 menu/tests/tests/s/test create mode 100644 menu/tests/tests/submenu-collision/result create mode 100644 menu/tests/tests/submenu-collision/test delete mode 100644 menu/tests/tests/t/result delete mode 100644 menu/tests/tests/t/test delete mode 100644 menu/tests/tests/u/result delete mode 100644 menu/tests/tests/u/test delete mode 100644 menu/tests/tests/v/result delete mode 100644 menu/tests/tests/v/test delete mode 100644 menu/tests/tests/w/result delete mode 100644 menu/tests/tests/w/test delete mode 100644 menu/tests/tests/x/result delete mode 100644 menu/tests/tests/x/test delete mode 100644 menu/tests/tests/y/result delete mode 100644 menu/tests/tests/y/test create mode 100755 menu/tests/tet_menutest create mode 100644 menu/tet_scen create mode 100644 menu/tetexec.cfg diff --git a/menu/ChangeLog b/menu/ChangeLog index 21cc418..ca2f166 100644 --- a/menu/ChangeLog +++ b/menu/ChangeLog @@ -1,8 +1,55 @@ -2006-03-28 Waldo Bastian +2007-01-18 Waldo Bastian + + * Added support for LSB's tet testing framework + + * Renamed test to more meaningful names: + 1 -> Category + 2 -> OnlyUnallocated + 3 -> Deleted + 4 -> Move + 5 -> All + 6 -> Filename + 7 -> And + 8 -> Or + 9 -> Exclude + a -> DesktopFileID + b -> menu-multiple-matching + c -> Directory + d -> submenu-collision + e -> LegacyDir-relative + f -> Move-collapsing + g -> AppDir-relative + h -> DirectoryDir-relative + i -> DefaultMergeDirs + j -> MergeDir-relative + k -> MergeFile-relative + l -> MergeFile2 + m -> NoDisplay + n -> NoDisplay2 + o -> boolean-logic + p -> MergeFile3 + q -> MergeFile-parent + r -> MergeFile-path + s -> desktop-name-collision + t -> Move-ordering + u -> MergeFile-recursive + v -> NotOnlyUnallocated-default + w -> LegacyDir-Move + x -> Move-submenu + y -> Merge-combined + + * Added the following new tests: + AppDir + DirectoryDir + MergeDir-absolute + MergeFile-absolute + official-categories + +2006-03-28 Waldo Bastian * menu-spec.xml: Added example for installing sub-menu. -2006-03-21 Waldo Bastian +2006-03-21 Waldo Bastian * menu-spec.xml: Recommend to use /usr/share for datadir diff --git a/menu/tests/menutest b/menu/tests/menutest index 6061ba8..9d37246 100755 --- a/menu/tests/menutest +++ b/menu/tests/menutest @@ -1,127 +1,200 @@ #!/bin/bash - +# these vars are usable *only* for debugging purposes; they're not allowed as part of the spec, thus don't use them. +# set MENU_FAKE_PREFIX to a non empty val to force testing for if things would succeed if XDG_MENU_PREFIX were +# implemented +# set MENU_FAKE_APPLICATIONS to force a work around for applications-merged postfixing. +# function installData() { - local DIR=$1 - shift 1 - mkdir -p ${DIR} + local DIR="$1" + shift + mkdir -p "${DIR}" for file in $*; do - cp data/${file} ${DIR} + cp "data/${file}" "${DIR}" + WIPE[$WIPE_IDX]="${DIR}/${file}" + WIPE_IDX=$(( $WIPE_IDX + 1 )) done } function installDataAs() { - local DIR=$1 - mkdir -p ${DIR} - cp data/$2 ${DIR}/$3 + local DIR="$1" + mkdir -p "${DIR}" + cp "data/$2" "${DIR}/$3" + WIPE[${WIPE_IDX}]="${DIR}/${3}" + WIPE_IDX=$(( $WIPE_IDX + 1 )) } -if [ "x${MENUTEST}" == "x" ]; then - echo 'To run the test set $MENUTEST to your menu-spec implementation.' - exit 1 -fi - -if [ "x${MENUTESTDIR}" == "x" ]; then - MENUTESTDIR=/tmp/menutestdir - echo Using ${MENUTESTDIR} as test directory, override with '$MENUTESTDIR.' -else - echo Using ${MENUTESTDIR} as test directory. -fi - -export MENUTESTDIR - -if [ "x${TESTS}" == "x" ]; then - TESTS=`ls tests` -fi +setup_local_xdg_vars() { + export XDG_CONFIG_HOME="${MENUTESTDIR}/xdg_config_home" + export XDG_DATA_HOME="${MENUTESTDIR}/xdg_data_home" + export XDG_CONFIG_DIR="${MENUTESTDIR}/xdg_config_dir" + export XDG_CONFIG_DIRS="$XDG_CONFIG_DIR:${XDG_CONFIG_DIRS}2" + export XDG_DATA_DIR="${MENUTESTDIR}/xdg_data_dir" + export XDG_DATA_DIRS="$XDG_DATA_DIR:${XDG_DATA_DIR}2" + export XDG_CACHE_HOME="${MENUTESTDIR}/xdg_cache_home" +} -FAILED= -SUCCEEDED= -for TEST in ${TESTS}; do - if [ "${TEST}" == "CVS" ]; then - continue +setup_xdg_system_data_vars() +{ + export XDG_CACHE_HOME="${XDG_DATA_HOME:-${HOME}/.cache}" + export XDG_DATA_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}" + export XDG_CONFIG_DIR="${XDG_CONFIG_DIR:-/etc/xdg}" + if [ -z "${XDG_DATA_DIRS}" ]; then + export XDG_DATA_DIRS="/usr/local/share:/usr/share" + fi + export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${MENUTESTDIR}/xdg_cache_dir" + export XDG_DATA_DIR="${XDG_DATA_DIRS//*:}" + if [ -z "${XDG_CONFIG_DIRS}" ]; then + export XDG_CONFIG_DIRS="/etc/xdg" fi + export XDG_CONFIG_DIR="${XDG_CONFIG_DIRS/:*}" +} - echo - rm -rf ${MENUTESTDIR} 2> /dev/null - mkdir ${MENUTESTDIR} - RESULT=tests/${TEST}/result +run_test() { + if [ -z "$1" ]; then + echo "requires name of test directory to run" + exit 1 + fi + local TEST="$1" + rm -rf "${MENUTESTDIR}" 2> /dev/null + mkdir "${MENUTESTDIR}" + RESULT="${TEST}/result" ( - echo ">>> Running test ${TEST}" - - # Some predefined values - XDG_CONFIG_HOME=${MENUTESTDIR}/xdg_config_home - XDG_DATA_HOME=${MENUTESTDIR}/xdg_data_home - XDG_CONFIG_DIR=${MENUTESTDIR}/xdg_config_dir - XDG_DATA_DIR=${MENUTESTDIR}/xdg_data_dir - XDG_CONFIG_DIRS=$XDG_CONFIG_DIR - XDG_DATA_DIRS=$XDG_DATA_DIR - - export XDG_CONFIG_HOME - export XDG_DATA_HOME - export XDG_CONFIG_DIR - export XDG_DATA_DIR - export XDG_CONFIG_DIRS - export XDG_DATA_DIRS - - . tests/${TEST}/test + unset WIPE WIPE_IDX + declare -a WIPE + declare -i WIPE_IDX=0 + unset MODE + + . ${TEST}/test + echo ">>> Running test ${TEST}, purpose $TEST_PURPOSE" + + if [ "${MODE:-local}" == "local" ]; then + setup_local_xdg_vars + elif [ "${MODE}" == "system_data" ]; then + setup_xdg_system_data_vars + else + echo "!!! unknown MODE from $TEST, bailing" + exit -1 + fi - $MENUTEST > ${MENUTESTDIR}/result1 2> ${MENUTESTDIR}/log + test_code + + declare -i IDX=0 + while [ $WIPE_IDX -gt $IDX ]; do + echo "${WIPE[$IDX]}" >> "${MENUTESTDIR}/wipe" + IDX=$(( $IDX + 1 )) + done + + DEBUG_OVERRIDES='' + [ -n "$MENU_FAKE_PREFIX" ] && DEBUG_OVERRIDES=.menu + [ -n "$MENU_FAKE_APPLICATIONS" ] && DEBUG_OVERIDES="${DEBUG_OVERRIDES} -merged" + + for x in dir home; do + for y in ${DEBUG_OVERRIDES}; do + if [ -e "${MENUTESTDIR}/xdg_config_${x}/menus/applications${y}" ]; then + ln -s applications${y} "${MENUTESTDIR}/xdg_config_${x}/menus/kde-applications${y}" + ln -s applications${y} "${MENUTESTDIR}/xdg_config_${x}/menus/gnome-applications${y}" + fi + done + unset y + done + unset x DEBUG_OVERRIDES + + $MENUTEST > ${MENUTESTDIR}/run-result 2> ${MENUTESTDIR}/log + + if [ -e "${RESULT}" ]; then + ./expand "${RESULT}" > "${MENUTESTDIR}/required-result" + fi - if [ -e ${RESULT} ]; then - ./expand ${RESULT} > ${MENUTESTDIR}/result2 + if [ "$(type -t interpret_results)" == "function" ]; then + interpret_results + else + default_interpret_results + fi + ret=$? + if [ -e "${MENUTESTDIR}/wipe" ]; then + cat "${MENUTESTDIR}/wipe" | while read l; do + [ -z "$l" ] && continue + rm "$l" + done fi + return $ret ) +} - if [ ! -e ${RESULT} ]; then - echo '!!! Result file ('${RESULT}') for '${TEST}' missing' +default_interpret_results() { + if [ ! -e "${RESULT}" ]; then + echo "!!! Result file (${RESULT}) for ${TEST} missing" echo '>>> Failed' - FAILED="${FAILED} ${TEST}" + return 1 + elif diff -q "${MENUTESTDIR}/run-result" "${MENUTESTDIR}/required-result" > /dev/null; then + echo '>>> OK' + return 0 + fi + sort "${MENUTESTDIR}/run-result" > "${MENUTESTDIR}/run-result.sorted" + sort "${MENUTESTDIR}/required-result" > "${MENUTESTDIR}/required-result.sorted" + if diff -u "${MENUTESTDIR}/run-result.sorted" "${MENUTESTDIR}/required-result.sorted" > "${MENUTESTDIR}/result.diff"; then + echo '>>> OK (different order)' + return 0 + fi + grep "${MENUTESTDIR}" "${MENUTESTDIR}/run-result" > "${MENUTESTDIR}/run-result.filtered" 2> /dev/null + if diff -q "${MENUTESTDIR}/run-result.filtered" "${MENUTESTDIR}/required-result" > /dev/null; then + echo '>>> OK (additional system items)' + return 0 + fi + grep "${MENUTESTDIR}" "${MENUTESTDIR}/run-result.sorted" > "${MENUTESTDIR}/required-result.filtered" 2> /dev/null + if diff -u "${MENUTESTDIR}/run-result.filtered" "${MENUTESTDIR}/required-result.sorted" > "${MENUTESTDIR}/result.diff"; then + echo '>>> OK (different order, additional system items)' + return 0 + fi + echo '>>> Failed' + cat "${MENUTESTDIR}/result.diff" + cat "${MENUTESTDIR}/log" + return 1 +} + +if [ -z "${TESTS}" ]; then + export TESTS=`ls tests/*/test | sed -e 's:^\(\./\)\?tests/\+::' -e 's:/\+test$::'` +fi + +if [ -z "$TET_RUN" ]; then + + if [ "x${MENUTEST}" == "x" ]; then + echo 'To run the test set $MENUTEST to your menu-spec implementation.' + exit 1 + fi + if [ "x${MENUTESTDIR}" == "x" ]; then + MENUTESTDIR=/tmp/menutestdir + echo Using ${MENUTESTDIR} as test directory, override with \$MENUTESTDIR. else - if diff -q ${MENUTESTDIR}/result1 ${MENUTESTDIR}/result2 > /dev/null; then - echo '>>> OK' - SUCCEEDED="${SUCCEEDED} ${TEST}" - else - sort ${MENUTESTDIR}/result1 > ${MENUTESTDIR}/result1.sorted - sort ${MENUTESTDIR}/result2 > ${MENUTESTDIR}/result2.sorted - if diff -u ${MENUTESTDIR}/result1.sorted ${MENUTESTDIR}/result2.sorted > ${MENUTESTDIR}/result.diff; then - echo '>>> OK (different order)' - SUCCEEDED="${SUCCEEDED} ${TEST}" - else - grep ${MENUTESTDIR} ${MENUTESTDIR}/result1 > ${MENUTESTDIR}/result1.filtered 2> /dev/null - if diff -q ${MENUTESTDIR}/result1.filtered ${MENUTESTDIR}/result2 > /dev/null; then - echo '>>> OK (additional system items)' - SUCCEEDED="${SUCCEEDED} ${TEST}" - else - grep ${MENUTESTDIR} ${MENUTESTDIR}/result1.sorted > ${MENUTESTDIR}/result1.filtered 2> /dev/null - if diff -u ${MENUTESTDIR}/result1.filtered ${MENUTESTDIR}/result2.sorted > ${MENUTESTDIR}/result.diff; then - echo '>>> OK (different order, additional system items)' - SUCCEEDED="${SUCCEEDED} ${TEST}" - else - echo '>>> Failed' - cat ${MENUTESTDIR}/result.diff - cat ${MENUTESTDIR}/log - FAILED="${FAILED} ${TEST}" - fi - fi - fi - fi + echo Using ${MENUTESTDIR} as test directory. fi -done + export MENUTESTDIR + export USER=${USER:-test} -echo "OK tests: ${SUCCEEDED}" -if ! test -z "${FAILED}" ; then - echo "Failed tests: ${FAILED}" -fi + FAILED= + SUCCEEDED= -echo `echo ${SUCCEEDED} | wc -w`' tests passed, '`echo ${FAILED} | wc -w`' tests failed' + for TESTCASE in ${TESTS}; do + if [ "${TESTCASE}" == "CVS" ]; then + continue + fi + echo + if ! run_test "tests/${TESTCASE}" ${MODE}; then + FAILED="${FAILED} ${TESTCASE}" + else + SUCCEEDED="${SUCCEEDED} ${TESTCASE}" + fi + done -if test -z "${FAILED}" ; then - exit 0 -else - exit 1 + echo "OK tests: ${SUCCEEDED}" + [ -n "${FAILED}" ] && echo "Failed tests: ${FAILED}" + echo "$(echo ${SUCCEEDED} | wc -w) tests passed, $(echo ${FAILED} | wc -w) tests failed" + [ -z "${FAILED}" ] && exit 0 + exit 1 fi diff --git a/menu/tests/tests/1/result b/menu/tests/tests/1/result deleted file mode 100644 index 73b00c9..0000000 --- a/menu/tests/tests/1/result +++ /dev/null @@ -1,3 +0,0 @@ -Editors/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Editors/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Editors/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop diff --git a/menu/tests/tests/1/test b/menu/tests/tests/1/test deleted file mode 100644 index 57cc0bb..0000000 --- a/menu/tests/tests/1/test +++ /dev/null @@ -1,24 +0,0 @@ -echo ">>> the tag" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - Editors - - TextEditor - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop diff --git a/menu/tests/tests/2/result b/menu/tests/tests/2/result deleted file mode 100644 index 8be4bc7..0000000 --- a/menu/tests/tests/2/result +++ /dev/null @@ -1,3 +0,0 @@ -BoardGames/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop -BoardGames/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop -Games/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop diff --git a/menu/tests/tests/2/test b/menu/tests/tests/2/test deleted file mode 100644 index 7e28af5..0000000 --- a/menu/tests/tests/2/test +++ /dev/null @@ -1,42 +0,0 @@ -echo ">>> the tag" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - BoardGames - - - Game - - CardGame - - - - - PuzzleGame - - - - Games - - Game - - - - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/3/result b/menu/tests/tests/3/result deleted file mode 100644 index c121419..0000000 --- a/menu/tests/tests/3/result +++ /dev/null @@ -1,2 +0,0 @@ -BoardGames/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop -BoardGames/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop diff --git a/menu/tests/tests/3/test b/menu/tests/tests/3/test deleted file mode 100644 index 2ec4ebc..0000000 --- a/menu/tests/tests/3/test +++ /dev/null @@ -1,34 +0,0 @@ -echo ">>> the tag" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - BoardGames - - BoardGame - - - - Games - - Game - - - - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/4/result b/menu/tests/tests/4/result deleted file mode 100644 index d9a802d..0000000 --- a/menu/tests/tests/4/result +++ /dev/null @@ -1,2 +0,0 @@ -Games/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop -Games/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop diff --git a/menu/tests/tests/4/test b/menu/tests/tests/4/test deleted file mode 100644 index 9468b0a..0000000 --- a/menu/tests/tests/4/test +++ /dev/null @@ -1,33 +0,0 @@ -echo ">>> a simple operation" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - Foo - Bar - BoardGames - Apps - BoardGames - Games - - - - BoardGames - - BoardGame - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/5/result b/menu/tests/tests/5/result deleted file mode 100644 index fc75a82..0000000 --- a/menu/tests/tests/5/result +++ /dev/null @@ -1,4 +0,0 @@ -Applications/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop -Applications/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop -Applications/ glines.desktop ${XDG_DATA_DIR}/applications/glines.desktop -Applications/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop diff --git a/menu/tests/tests/5/test b/menu/tests/tests/5/test deleted file mode 100644 index 45c734d..0000000 --- a/menu/tests/tests/5/test +++ /dev/null @@ -1,25 +0,0 @@ -echo ">>> the Keyword" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - Applications - - - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/6/result b/menu/tests/tests/6/result deleted file mode 100644 index dc159fa..0000000 --- a/menu/tests/tests/6/result +++ /dev/null @@ -1 +0,0 @@ -Applications/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop diff --git a/menu/tests/tests/6/test b/menu/tests/tests/6/test deleted file mode 100644 index ef1d734..0000000 --- a/menu/tests/tests/6/test +++ /dev/null @@ -1,25 +0,0 @@ -echo ">>> the tag" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - Applications - - freecell.desktop - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/7/result b/menu/tests/tests/7/result deleted file mode 100644 index dc159fa..0000000 --- a/menu/tests/tests/7/result +++ /dev/null @@ -1 +0,0 @@ -Applications/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop diff --git a/menu/tests/tests/7/test b/menu/tests/tests/7/test deleted file mode 100644 index ac4570f..0000000 --- a/menu/tests/tests/7/test +++ /dev/null @@ -1,28 +0,0 @@ -echo ">>> the Keyword" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - Applications - - - freecell.desktop - Game - - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/8/result b/menu/tests/tests/8/result deleted file mode 100644 index fc75a82..0000000 --- a/menu/tests/tests/8/result +++ /dev/null @@ -1,4 +0,0 @@ -Applications/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop -Applications/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop -Applications/ glines.desktop ${XDG_DATA_DIR}/applications/glines.desktop -Applications/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop diff --git a/menu/tests/tests/8/test b/menu/tests/tests/8/test deleted file mode 100644 index 4554d05..0000000 --- a/menu/tests/tests/8/test +++ /dev/null @@ -1,28 +0,0 @@ -echo ">>> the Keyword" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - Applications - - - freecell.desktop - Game - - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/9/result b/menu/tests/tests/9/result deleted file mode 100644 index dfbb122..0000000 --- a/menu/tests/tests/9/result +++ /dev/null @@ -1,3 +0,0 @@ -Applications/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop -Applications/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop -Applications/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop diff --git a/menu/tests/tests/9/test b/menu/tests/tests/9/test deleted file mode 100644 index c3c6321..0000000 --- a/menu/tests/tests/9/test +++ /dev/null @@ -1,31 +0,0 @@ -echo ">>> the Keyword" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - Applications - - - freecell.desktop - Game - - - - glines.desktop - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/All/result b/menu/tests/tests/All/result new file mode 100644 index 0000000..fc75a82 --- /dev/null +++ b/menu/tests/tests/All/result @@ -0,0 +1,4 @@ +Applications/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop +Applications/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop +Applications/ glines.desktop ${XDG_DATA_DIR}/applications/glines.desktop +Applications/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop diff --git a/menu/tests/tests/All/test b/menu/tests/tests/All/test new file mode 100644 index 0000000..e97bddc --- /dev/null +++ b/menu/tests/tests/All/test @@ -0,0 +1,26 @@ +TEST_PURPOSE=" Keyword" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + Applications + + + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/And/result b/menu/tests/tests/And/result new file mode 100644 index 0000000..dc159fa --- /dev/null +++ b/menu/tests/tests/And/result @@ -0,0 +1 @@ +Applications/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop diff --git a/menu/tests/tests/And/test b/menu/tests/tests/And/test new file mode 100644 index 0000000..31571db --- /dev/null +++ b/menu/tests/tests/And/test @@ -0,0 +1,29 @@ +TEST_PURPOSE=" Keyword" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + Applications + + + freecell.desktop + Game + + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/AppDir-relative/result b/menu/tests/tests/AppDir-relative/result new file mode 100644 index 0000000..9e1d622 --- /dev/null +++ b/menu/tests/tests/AppDir-relative/result @@ -0,0 +1,3 @@ +Applications/ KEdit.desktop ${XDG_CONFIG_DIR}/menus/apps/KEdit.desktop +Applications/ kate.desktop ${XDG_CONFIG_DIR}/menus/apps/kate.desktop +Applications/ kwrite.desktop ${XDG_CONFIG_DIR}/menus/apps/kwrite.desktop diff --git a/menu/tests/tests/AppDir-relative/test b/menu/tests/tests/AppDir-relative/test new file mode 100644 index 0000000..75bd201 --- /dev/null +++ b/menu/tests/tests/AppDir-relative/test @@ -0,0 +1,27 @@ +TEST_PURPOSE=" relative path tag ..." + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + apps + + + Applications + + TextEditor + + + +EOF + + # Install .desktop files + installData "${XDG_CONFIG_DIR}/menus/apps" kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop + installDataAs "${XDG_CONFIG_DIR}/menus/apps" kwrite.desktop should_be_ignored.notdesktop +} diff --git a/menu/tests/tests/AppDir/test b/menu/tests/tests/AppDir/test new file mode 100644 index 0000000..8faff91 --- /dev/null +++ b/menu/tests/tests/AppDir/test @@ -0,0 +1,4 @@ +. tests/AppDir-relative/test +export PATH_EXPANSION='${XDG_CONFIG_DIR}/menus/' +TEST_PURPOSE=" absolute path" + diff --git a/menu/tests/tests/Category/result b/menu/tests/tests/Category/result new file mode 100644 index 0000000..73b00c9 --- /dev/null +++ b/menu/tests/tests/Category/result @@ -0,0 +1,3 @@ +Editors/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Editors/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Editors/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop diff --git a/menu/tests/tests/Category/test b/menu/tests/tests/Category/test new file mode 100644 index 0000000..3ee0777 --- /dev/null +++ b/menu/tests/tests/Category/test @@ -0,0 +1,29 @@ +TEST_PURPOSE=" tag" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + Editors + + TextEditor + + application + + + +EOF + +# Install .desktop files, freecell is daft but intentional to verify category support is case sensitive +installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop freecell.desktop +} diff --git a/menu/tests/tests/DefaultMergeDirs/result b/menu/tests/tests/DefaultMergeDirs/result new file mode 100644 index 0000000..9e17189 --- /dev/null +++ b/menu/tests/tests/DefaultMergeDirs/result @@ -0,0 +1,5 @@ +Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop +Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/DefaultMergeDirs/test b/menu/tests/tests/DefaultMergeDirs/test new file mode 100644 index 0000000..3b570f2 --- /dev/null +++ b/menu/tests/tests/DefaultMergeDirs/test @@ -0,0 +1,43 @@ +TEST_PURPOSE=" tag ..." + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + Applications + + TextEditor + + + +EOF + + mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/ + ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu < + + + KDE + + + Development + + Development + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop +} diff --git a/menu/tests/tests/Deleted/result b/menu/tests/tests/Deleted/result new file mode 100644 index 0000000..c121419 --- /dev/null +++ b/menu/tests/tests/Deleted/result @@ -0,0 +1,2 @@ +BoardGames/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop +BoardGames/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop diff --git a/menu/tests/tests/Deleted/test b/menu/tests/tests/Deleted/test new file mode 100644 index 0000000..db7a413 --- /dev/null +++ b/menu/tests/tests/Deleted/test @@ -0,0 +1,35 @@ +TEST_PURPOSE=" tag" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + BoardGames + + BoardGame + + + + Games + + Game + + + + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/DesktopFileID/result b/menu/tests/tests/DesktopFileID/result new file mode 100644 index 0000000..9629384 --- /dev/null +++ b/menu/tests/tests/DesktopFileID/result @@ -0,0 +1,4 @@ +Applications/ company-games-freecell.desktop ${XDG_DATA_DIR}/applications/company/games/freecell.desktop +Applications/ company-games-gataxx.desktop ${XDG_DATA_DIR}/applications/company/games/gataxx.desktop +Applications/ company-games-glines.desktop ${XDG_DATA_DIR}/applications/company/games/glines.desktop +Applications/ company-games-mahjongg.desktop ${XDG_DATA_DIR}/applications/company/games/mahjongg.desktop diff --git a/menu/tests/tests/DesktopFileID/test b/menu/tests/tests/DesktopFileID/test new file mode 100644 index 0000000..ae2c679 --- /dev/null +++ b/menu/tests/tests/DesktopFileID/test @@ -0,0 +1,26 @@ +TEST_PURPOSE="DesktopFileIDs in submenus" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + Applications + + Game + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications/company/games gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/Directory/result b/menu/tests/tests/Directory/result new file mode 100644 index 0000000..2cd1d1f --- /dev/null +++ b/menu/tests/tests/Directory/result @@ -0,0 +1,3 @@ +Apps/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Apps/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Apps/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop diff --git a/menu/tests/tests/Directory/test b/menu/tests/tests/Directory/test new file mode 100644 index 0000000..fe7e126 --- /dev/null +++ b/menu/tests/tests/Directory/test @@ -0,0 +1,29 @@ +TEST_PURPOSE=" tag ..." + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + + Applications + apps.directory + + TextEditor + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop + installData ${XDG_DATA_DIR}/desktop-directories apps.directory +} diff --git a/menu/tests/tests/DirectoryDir-relative/result b/menu/tests/tests/DirectoryDir-relative/result new file mode 100644 index 0000000..2cd1d1f --- /dev/null +++ b/menu/tests/tests/DirectoryDir-relative/result @@ -0,0 +1,3 @@ +Apps/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Apps/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Apps/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop diff --git a/menu/tests/tests/DirectoryDir-relative/test b/menu/tests/tests/DirectoryDir-relative/test new file mode 100644 index 0000000..4a5e039 --- /dev/null +++ b/menu/tests/tests/DirectoryDir-relative/test @@ -0,0 +1,28 @@ +TEST_PURPOSE="relative tag ..." + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + ${PATH_EXPANSION}desktop-directories + + + Applications + apps.directory + + TextEditor + + + +EOF + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop + installData ${XDG_CONFIG_DIR}/menus/desktop-directories apps.directory +} diff --git a/menu/tests/tests/DirectoryDir/test b/menu/tests/tests/DirectoryDir/test new file mode 100644 index 0000000..dc8bb3b --- /dev/null +++ b/menu/tests/tests/DirectoryDir/test @@ -0,0 +1,4 @@ +. tests/DirectoryDir-relative/test +export PATH_EXPANSION='${XDG_CONFIG_DIR}/menus/' +TEST_PURPOSE=" absolute path" + diff --git a/menu/tests/tests/Exclude/result b/menu/tests/tests/Exclude/result new file mode 100644 index 0000000..dfbb122 --- /dev/null +++ b/menu/tests/tests/Exclude/result @@ -0,0 +1,3 @@ +Applications/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop +Applications/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop +Applications/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop diff --git a/menu/tests/tests/Exclude/test b/menu/tests/tests/Exclude/test new file mode 100644 index 0000000..728ec99 --- /dev/null +++ b/menu/tests/tests/Exclude/test @@ -0,0 +1,32 @@ +TEST_PURPOSE=" Keyword" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + Applications + + + freecell.desktop + Game + + + + glines.desktop + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/Filename/result b/menu/tests/tests/Filename/result new file mode 100644 index 0000000..dc159fa --- /dev/null +++ b/menu/tests/tests/Filename/result @@ -0,0 +1 @@ +Applications/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop diff --git a/menu/tests/tests/Filename/test b/menu/tests/tests/Filename/test new file mode 100644 index 0000000..b9d021d --- /dev/null +++ b/menu/tests/tests/Filename/test @@ -0,0 +1,26 @@ +TEST_PURPOSE=" tag" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + Applications + + freecell.desktop + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/LegacyDir-Move/result b/menu/tests/tests/LegacyDir-Move/result new file mode 100644 index 0000000..9a2b9db --- /dev/null +++ b/menu/tests/tests/LegacyDir-Move/result @@ -0,0 +1,2 @@ +Editors/ gideon-legacy.desktop ${LEGACY_DIR}/Development/gideon-legacy.desktop +/ Home.desktop ${LEGACY_DIR}/Home.desktop diff --git a/menu/tests/tests/LegacyDir-Move/test b/menu/tests/tests/LegacyDir-Move/test new file mode 100644 index 0000000..7e6e85e --- /dev/null +++ b/menu/tests/tests/LegacyDir-Move/test @@ -0,0 +1,39 @@ +TEST_PURPOSE="move entries from " + +test_code() { + LEGACY_DIR=${MENUTESTDIR}/legacy_applnk + export LEGACY_DIR + + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + ${LEGACY_DIR} + + + + + Development + + gideon-legacy.desktop + + + + Editors + + gideon-legacy.desktop + + + +EOF + + # Install .desktop files + + installData ${LEGACY_DIR} Home.desktop + installData ${LEGACY_DIR}/Development gideon-legacy.desktop +} diff --git a/menu/tests/tests/LegacyDir-relative/result b/menu/tests/tests/LegacyDir-relative/result new file mode 100644 index 0000000..0c2af9b --- /dev/null +++ b/menu/tests/tests/LegacyDir-relative/result @@ -0,0 +1,9 @@ +Development/ gideon-legacy.desktop ${LEGACY_DIR}/Development/gideon-legacy.desktop +Development/ kbabel.desktop ${LEGACY_DIR}/Development/kbabel.desktop +Development/ quanta.desktop ${LEGACY_DIR}/Development/quanta.desktop +Editors/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Editors/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Editors/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +/ Help.desktop ${LEGACY_DIR}/Help.desktop +/ Home.desktop ${LEGACY_DIR}/Home.desktop +/ Kfind.desktop ${LEGACY_DIR}/Kfind.desktop diff --git a/menu/tests/tests/LegacyDir-relative/test b/menu/tests/tests/LegacyDir-relative/test new file mode 100644 index 0000000..5082590 --- /dev/null +++ b/menu/tests/tests/LegacyDir-relative/test @@ -0,0 +1,42 @@ +TEST_PURPOSE="Simple test" + +test_code() { + LEGACY_DIR=${MENUTESTDIR}/legacy_applnk + export LEGACY_DIR + + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + ${LEGACY_DIR} + + + + + Editors + kde-editors.directory + + TextEditor + + + + Development + kde-development.directory + + Development + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop + installData ${LEGACY_DIR}/Development gideon-legacy.desktop kbabel.desktop quanta.desktop + installData ${LEGACY_DIR} Kfind.desktop Home.desktop Help.desktop +} + diff --git a/menu/tests/tests/Merge-combined/result b/menu/tests/tests/Merge-combined/result new file mode 100644 index 0000000..999bd1e --- /dev/null +++ b/menu/tests/tests/Merge-combined/result @@ -0,0 +1 @@ +Editors/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop diff --git a/menu/tests/tests/Merge-combined/test b/menu/tests/tests/Merge-combined/test new file mode 100644 index 0000000..07cfab3 --- /dev/null +++ b/menu/tests/tests/Merge-combined/test @@ -0,0 +1,46 @@ +TEST_PURPOSE="Merge Two Menus and a Legacy Menu" + +test_code() { + LEGACY_DIR=${MENUTESTDIR}/legacy_applnk + export LEGACY_DIR + + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + ${LEGACY_DIR} + + + Development + + kate.desktop + + + + Development + + KEdit.desktop + + + + + Editors + + kwrite.desktop + + + +EOF + + # Install .desktop files + + installData ${LEGACY_DIR}/Development gideon-legacy.desktop + installData ${XDG_DATA_DIR}/applications kate.desktop kwrite.desktop KEdit.desktop +} diff --git a/menu/tests/tests/MergeDir-absolute/test b/menu/tests/tests/MergeDir-absolute/test new file mode 100644 index 0000000..db6c895 --- /dev/null +++ b/menu/tests/tests/MergeDir-absolute/test @@ -0,0 +1,3 @@ +. tests/MergeDir-relative/test +export PATH_EXPANSION='${XDG_CONFIG_DIR}/menus/' +export TEST_PURPOSE=" absolute path test" diff --git a/menu/tests/tests/MergeDir-relative/result b/menu/tests/tests/MergeDir-relative/result new file mode 100644 index 0000000..9e17189 --- /dev/null +++ b/menu/tests/tests/MergeDir-relative/result @@ -0,0 +1,5 @@ +Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop +Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/MergeDir-relative/test b/menu/tests/tests/MergeDir-relative/test new file mode 100644 index 0000000..ba96b1a --- /dev/null +++ b/menu/tests/tests/MergeDir-relative/test @@ -0,0 +1,61 @@ +TEST_PURPOSE=" relative path ..." + +test_code() { + # Generate applications.menu + mkdir -p "${XDG_CONFIG_DIR}/menus" + ./expand > "${XDG_CONFIG_DIR}/menus/applications.menu" < + + + KDE + + ${PATH_EXPANSION}applications-merged + + + Applications + + TextEditor + + + +EOF + + mkdir "${XDG_CONFIG_DIR}/menus/applications-merged/" + ./expand > "${XDG_CONFIG_DIR}/menus/applications-merged/test.menu" < + + + KDE + + + Development + + Development + + + +EOF + + # intentional crap entry to verify it does _not_ get picked up + ./expand > "${XDG_CONFIG_DIR}/menus/applications-merged/dar.notmenu" < + + + KDE + + + testing + + + + + +EOF + + + # Install .desktop files + installData "${XDG_DATA_DIR}/applications" kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop +} diff --git a/menu/tests/tests/MergeFile-absolute/test b/menu/tests/tests/MergeFile-absolute/test new file mode 100644 index 0000000..24cf669 --- /dev/null +++ b/menu/tests/tests/MergeFile-absolute/test @@ -0,0 +1,3 @@ +. tests/MergeFile-relative/test +export PATH_EXPANSION='${XDG_CONFIG_DIR}/menus/' +export TEST_PURPOSE=" absolute path" diff --git a/menu/tests/tests/MergeFile-parent/result b/menu/tests/tests/MergeFile-parent/result new file mode 100644 index 0000000..9e17189 --- /dev/null +++ b/menu/tests/tests/MergeFile-parent/result @@ -0,0 +1,5 @@ +Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop +Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/MergeFile-parent/test b/menu/tests/tests/MergeFile-parent/test new file mode 100644 index 0000000..00ed006 --- /dev/null +++ b/menu/tests/tests/MergeFile-parent/test @@ -0,0 +1,61 @@ +TEST_PURPOSE=" tag ..." + +test_code() { + # Tests the type attribute in + + # Generate applications.menu + mkdir -p ${XDG_CONFIG_HOME}/menus + ./expand > ${XDG_CONFIG_HOME}/menus/applications.menu < + + + KDE + + ${XDG_CONFIG_DIR}/menus/test.menu + + + Applications + + TextEditor + + + +EOF + + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/test.menu < + + + KDE + + + Games + + Game + + + +EOF + + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + Development + + Development + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/MergeFile-path/result b/menu/tests/tests/MergeFile-path/result new file mode 100644 index 0000000..fbe635e --- /dev/null +++ b/menu/tests/tests/MergeFile-path/result @@ -0,0 +1,5 @@ +Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Games/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop +Games/ glines.desktop ${XDG_DATA_DIR}/applications/glines.desktop diff --git a/menu/tests/tests/MergeFile-path/test b/menu/tests/tests/MergeFile-path/test new file mode 100644 index 0000000..97daa5c --- /dev/null +++ b/menu/tests/tests/MergeFile-path/test @@ -0,0 +1,61 @@ +TEST_PURPOSE=" tag ..." + +test_code() { + # Tests the type attribute in + + # Generate applications.menu + mkdir -p ${XDG_CONFIG_HOME}/menus + ./expand > ${XDG_CONFIG_HOME}/menus/applications.menu < + + + KDE + + ${XDG_CONFIG_DIR}/menus/test.menu + + + Applications + + TextEditor + + + +EOF + + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/test.menu < + + + KDE + + + Games + + Game + + + +EOF + + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + Development + + Development + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/MergeFile-recursive/result b/menu/tests/tests/MergeFile-recursive/result new file mode 100644 index 0000000..9e17189 --- /dev/null +++ b/menu/tests/tests/MergeFile-recursive/result @@ -0,0 +1,5 @@ +Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop +Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/MergeFile-recursive/test b/menu/tests/tests/MergeFile-recursive/test new file mode 100644 index 0000000..4dbab21 --- /dev/null +++ b/menu/tests/tests/MergeFile-recursive/test @@ -0,0 +1,58 @@ +TEST_PURPOSE="test elaborate recursive look in s" + +test_code(){ + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + applications-merged/test.menu + + + Applications + + TextEditor + + + +EOF + + + mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/ + ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu < + + + KDE + + extra/test.menu + +EOF + + mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/ + ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/extra/test.menu < + + + KDE + + + Development + + Development + + + + ../test.menu + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop +} diff --git a/menu/tests/tests/MergeFile-relative/result b/menu/tests/tests/MergeFile-relative/result new file mode 100644 index 0000000..9e17189 --- /dev/null +++ b/menu/tests/tests/MergeFile-relative/result @@ -0,0 +1,5 @@ +Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop +Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/MergeFile-relative/test b/menu/tests/tests/MergeFile-relative/test new file mode 100644 index 0000000..c3478db --- /dev/null +++ b/menu/tests/tests/MergeFile-relative/test @@ -0,0 +1,44 @@ +TEST_PURPOSE=" tag relative path" + +test_code(){ + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + ${PATH_EXPANSION}applications-merged/test.menu + + + Applications + + TextEditor + + + +EOF + + mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/ + ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu < + + + + KDE + + + Development + + Development + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop +} diff --git a/menu/tests/tests/MergeFile2/result b/menu/tests/tests/MergeFile2/result new file mode 100644 index 0000000..9e17189 --- /dev/null +++ b/menu/tests/tests/MergeFile2/result @@ -0,0 +1,5 @@ +Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop +Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/MergeFile2/test b/menu/tests/tests/MergeFile2/test new file mode 100644 index 0000000..e5b1591 --- /dev/null +++ b/menu/tests/tests/MergeFile2/test @@ -0,0 +1,57 @@ +TEST_PURPOSE=" tag ..." + +test_code() { + # Tests the use of relative paths in + + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + applications-merged/test.menu + + + Applications + + TextEditor + + + +EOF + + mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/ + ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu < + + + KDE + + extra/test.menu + +EOF + + mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/ + ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/extra/test.menu < + + + KDE + + + Development + + Development + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop +} diff --git a/menu/tests/tests/MergeFile3/result b/menu/tests/tests/MergeFile3/result new file mode 100644 index 0000000..9e17189 --- /dev/null +++ b/menu/tests/tests/MergeFile3/result @@ -0,0 +1,5 @@ +Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop +Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/MergeFile3/test b/menu/tests/tests/MergeFile3/test new file mode 100644 index 0000000..8781888 --- /dev/null +++ b/menu/tests/tests/MergeFile3/test @@ -0,0 +1,56 @@ +TEST_PURPOSE=" tag ..." + +test_code() { + # Tests the use of relative paths in + + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + test.menu + + + Applications + + TextEditor + + + +EOF + + ./expand > ${XDG_CONFIG_DIR}/menus/test.menu < + + + KDE + + extra/test.menu + +EOF + + mkdir ${XDG_CONFIG_DIR}/menus/extra/ + ./expand > ${XDG_CONFIG_DIR}/menus/extra/test.menu < + + + KDE + + + Development + + Development + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop +} diff --git a/menu/tests/tests/Move-collapsing/result b/menu/tests/tests/Move-collapsing/result new file mode 100644 index 0000000..10ccec6 --- /dev/null +++ b/menu/tests/tests/Move-collapsing/result @@ -0,0 +1,4 @@ +Games/BoardGame/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop +Games/BoardGame/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop +Games/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop +Games/ glines.desktop ${XDG_DATA_DIR}/applications/glines.desktop diff --git a/menu/tests/tests/Move-collapsing/test b/menu/tests/tests/Move-collapsing/test new file mode 100644 index 0000000..b842b0a --- /dev/null +++ b/menu/tests/tests/Move-collapsing/test @@ -0,0 +1,40 @@ +TEST_PURPOSE="complicated operation" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + Games1 + Games + + + + Games1 + + BoardGame + + BoardGame + + + + + Games + + Game + + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/Move-ordering/result b/menu/tests/tests/Move-ordering/result new file mode 100644 index 0000000..b941f58 --- /dev/null +++ b/menu/tests/tests/Move-ordering/result @@ -0,0 +1,3 @@ +Development/ gideon.desktop ${XDG_DATA_DIR}/applications/gideon.desktop +Games-Correct/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop +Games-Correct/ glines.desktop ${XDG_DATA_DIR}/applications/glines.desktop diff --git a/menu/tests/tests/Move-ordering/test b/menu/tests/tests/Move-ordering/test new file mode 100644 index 0000000..f8883b9 --- /dev/null +++ b/menu/tests/tests/Move-ordering/test @@ -0,0 +1,49 @@ +TEST_PURPOSE="Order of operations ..." + +test_code() { + # Tests the type attribute in + + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + Development + + Games + + Game + + + + Development + + + + Development/Games-New + Games-Correct + + + Development/Games + Games-Wrong + + + Development + + Games + Games-New + + + +EOF + + # Move operations in sub-menus should be performed first + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications freecell.desktop glines.desktop gideon.desktop +} diff --git a/menu/tests/tests/Move-submenu/result b/menu/tests/tests/Move-submenu/result new file mode 100644 index 0000000..f1c44ef --- /dev/null +++ b/menu/tests/tests/Move-submenu/result @@ -0,0 +1 @@ +A/B/Development/ gideon-legacy.desktop ${XDG_DATA_DIR}/applications/gideon-legacy.desktop diff --git a/menu/tests/tests/Move-submenu/test b/menu/tests/tests/Move-submenu/test new file mode 100644 index 0000000..2751983 --- /dev/null +++ b/menu/tests/tests/Move-submenu/test @@ -0,0 +1,32 @@ +TEST_PURPOSE="Move into a new Submenu" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + + Development + + gideon-legacy.desktop + + + + Development + A/B/Development + + +EOF + + # Install .desktop files + + installData ${XDG_DATA_DIR}/applications gideon-legacy.desktop +} diff --git a/menu/tests/tests/Move/result b/menu/tests/tests/Move/result new file mode 100644 index 0000000..d9a802d --- /dev/null +++ b/menu/tests/tests/Move/result @@ -0,0 +1,2 @@ +Games/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop +Games/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop diff --git a/menu/tests/tests/Move/test b/menu/tests/tests/Move/test new file mode 100644 index 0000000..9f2d162 --- /dev/null +++ b/menu/tests/tests/Move/test @@ -0,0 +1,34 @@ +TEST_PURPOSE="simple operation" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + Foo + Bar + BoardGames + Apps + BoardGames + Games + + + + BoardGames + + BoardGame + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/NoDisplay/result b/menu/tests/tests/NoDisplay/result new file mode 100644 index 0000000..7ed7169 --- /dev/null +++ b/menu/tests/tests/NoDisplay/result @@ -0,0 +1 @@ +Other/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop diff --git a/menu/tests/tests/NoDisplay/test b/menu/tests/tests/NoDisplay/test new file mode 100644 index 0000000..48e94ea --- /dev/null +++ b/menu/tests/tests/NoDisplay/test @@ -0,0 +1,37 @@ +TEST_PURPOSE="NoDisplay desktop entry values" + +test_code() { + # 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 +} diff --git a/menu/tests/tests/NoDisplay2/result b/menu/tests/tests/NoDisplay2/result new file mode 100644 index 0000000..7ed7169 --- /dev/null +++ b/menu/tests/tests/NoDisplay2/result @@ -0,0 +1 @@ +Other/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop diff --git a/menu/tests/tests/NoDisplay2/test b/menu/tests/tests/NoDisplay2/test new file mode 100644 index 0000000..62ba5a7 --- /dev/null +++ b/menu/tests/tests/NoDisplay2/test @@ -0,0 +1,38 @@ +TEST_PURPOSE="Allocation of desktop entry values from deleted menus" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus +./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + + Shouldn't see this + apps.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 apps.directory +} diff --git a/menu/tests/tests/NotOnlyUnallocated-default/result b/menu/tests/tests/NotOnlyUnallocated-default/result new file mode 100644 index 0000000..0c398b7 --- /dev/null +++ b/menu/tests/tests/NotOnlyUnallocated-default/result @@ -0,0 +1,2 @@ +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Editors/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop diff --git a/menu/tests/tests/NotOnlyUnallocated-default/test b/menu/tests/tests/NotOnlyUnallocated-default/test new file mode 100644 index 0000000..2f4956e --- /dev/null +++ b/menu/tests/tests/NotOnlyUnallocated-default/test @@ -0,0 +1,33 @@ +TEST_PURPOSE="Another test" + +test_code() { + # Tests + + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + Applications + + kwrite.desktop + + + + Editors + + kwrite.desktop + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop +} diff --git a/menu/tests/tests/OnlyUnallocated/result b/menu/tests/tests/OnlyUnallocated/result new file mode 100644 index 0000000..8be4bc7 --- /dev/null +++ b/menu/tests/tests/OnlyUnallocated/result @@ -0,0 +1,3 @@ +BoardGames/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop +BoardGames/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop +Games/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop diff --git a/menu/tests/tests/OnlyUnallocated/test b/menu/tests/tests/OnlyUnallocated/test new file mode 100644 index 0000000..efda0ff --- /dev/null +++ b/menu/tests/tests/OnlyUnallocated/test @@ -0,0 +1,44 @@ +TEST_PURPOSE=" tag" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + BoardGames + + + Game + + CardGame + + + + + PuzzleGame + + + + Games + + Game + + + + + + +EOF + + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/Or/result b/menu/tests/tests/Or/result new file mode 100644 index 0000000..fc75a82 --- /dev/null +++ b/menu/tests/tests/Or/result @@ -0,0 +1,4 @@ +Applications/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop +Applications/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop +Applications/ glines.desktop ${XDG_DATA_DIR}/applications/glines.desktop +Applications/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop diff --git a/menu/tests/tests/Or/test b/menu/tests/tests/Or/test new file mode 100644 index 0000000..cd10cfd --- /dev/null +++ b/menu/tests/tests/Or/test @@ -0,0 +1,29 @@ +TEST_PURPOSE=" Keyword" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + Applications + + + freecell.desktop + Game + + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop +} diff --git a/menu/tests/tests/a/result b/menu/tests/tests/a/result deleted file mode 100644 index 9629384..0000000 --- a/menu/tests/tests/a/result +++ /dev/null @@ -1,4 +0,0 @@ -Applications/ company-games-freecell.desktop ${XDG_DATA_DIR}/applications/company/games/freecell.desktop -Applications/ company-games-gataxx.desktop ${XDG_DATA_DIR}/applications/company/games/gataxx.desktop -Applications/ company-games-glines.desktop ${XDG_DATA_DIR}/applications/company/games/glines.desktop -Applications/ company-games-mahjongg.desktop ${XDG_DATA_DIR}/applications/company/games/mahjongg.desktop diff --git a/menu/tests/tests/a/test b/menu/tests/tests/a/test deleted file mode 100644 index 232704b..0000000 --- a/menu/tests/tests/a/test +++ /dev/null @@ -1,25 +0,0 @@ -echo ">>> a test for DesktopFileIDs in submenus" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - Applications - - Game - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications/company/games gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/b/result b/menu/tests/tests/b/result deleted file mode 100644 index 986c873..0000000 --- a/menu/tests/tests/b/result +++ /dev/null @@ -1,5 +0,0 @@ -Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Applications/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop -Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Applications/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/b/test b/menu/tests/tests/b/test deleted file mode 100644 index 74d9870..0000000 --- a/menu/tests/tests/b/test +++ /dev/null @@ -1,35 +0,0 @@ -echo ">>> a complicated rule ..." - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - Applications - - - Game - BoardGame - - - TextEditor - quanta.desktop - - - - mahjongg.desktop - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop diff --git a/menu/tests/tests/boolean-logic/result b/menu/tests/tests/boolean-logic/result new file mode 100644 index 0000000..ea47f01 --- /dev/null +++ b/menu/tests/tests/boolean-logic/result @@ -0,0 +1,3 @@ +Apps/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Apps/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Apps/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop diff --git a/menu/tests/tests/boolean-logic/test b/menu/tests/tests/boolean-logic/test new file mode 100644 index 0000000..dc045c4 --- /dev/null +++ b/menu/tests/tests/boolean-logic/test @@ -0,0 +1,36 @@ +TEST_PURPOSE="foofoo shouldn't match anything" + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + + Applications + apps.directory + + + TextEditor + + Game + Game + + + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop + installData ${XDG_DATA_DIR}/applications/test freecell.desktop + installData ${XDG_DATA_DIR}/desktop-directories apps.directory +} diff --git a/menu/tests/tests/c/result b/menu/tests/tests/c/result deleted file mode 100644 index 2cd1d1f..0000000 --- a/menu/tests/tests/c/result +++ /dev/null @@ -1,3 +0,0 @@ -Apps/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Apps/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Apps/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop diff --git a/menu/tests/tests/c/test b/menu/tests/tests/c/test deleted file mode 100644 index 3751fab..0000000 --- a/menu/tests/tests/c/test +++ /dev/null @@ -1,28 +0,0 @@ -echo ">>> the tag ..." - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - - Applications - apps.directory - - TextEditor - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop -installData ${XDG_DATA_DIR}/desktop-directories apps.directory diff --git a/menu/tests/tests/d/result b/menu/tests/tests/d/result deleted file mode 100644 index 6aa47d7..0000000 --- a/menu/tests/tests/d/result +++ /dev/null @@ -1,5 +0,0 @@ -Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Applications/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Applications/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/d/test b/menu/tests/tests/d/test deleted file mode 100644 index 33b6dc6..0000000 --- a/menu/tests/tests/d/test +++ /dev/null @@ -1,31 +0,0 @@ -echo ">>> two submenus with the same name ..." - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - Applications - - TextEditor - - - - Applications - - Development - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop diff --git a/menu/tests/tests/desktop-name-collision/result b/menu/tests/tests/desktop-name-collision/result new file mode 100644 index 0000000..e1e9221 --- /dev/null +++ b/menu/tests/tests/desktop-name-collision/result @@ -0,0 +1,3 @@ +Development/ kde-gideon.desktop ${XDG_DATA_HOME}/applications/kde-gideon.desktop +Development/ mahjongg.desktop ${XDG_DATA_HOME}/applications/mahjongg.desktop +Games/ freecell.desktop ${XDG_DATA_HOME}/applications/freecell.desktop diff --git a/menu/tests/tests/desktop-name-collision/test b/menu/tests/tests/desktop-name-collision/test new file mode 100644 index 0000000..46b5ded --- /dev/null +++ b/menu/tests/tests/desktop-name-collision/test @@ -0,0 +1,53 @@ +TEST_PURPOSE=".desktop files with same name ..." + +test_code() { + # Tests the type attribute in + + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + Games + + Game + + + + Development + + Development + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications freecell.desktop glines.desktop mahjongg.desktop + + # freecell.desktop is installed twice, only the version under ${XDG_DATA_HOME}/applications + # should show up in the menu + # freecell.desktop in ${XDG_DATA_DIR}/applications should be ignored. + installData ${XDG_DATA_HOME}/applications freecell.desktop + + # ${XDG_DATA_HOME}/applications/glines.desktop has NoDisplay=true + # glines.desktop should not be shown + # glines.desktop in ${XDG_DATA_DIR}/applications should be ignored. + installDataAs ${XDG_DATA_HOME}/applications glines-2.desktop glines.desktop + + # ${XDG_DATA_HOME}/applications/mahjongg.desktop has Categories=Development + # mahjongg.desktop should be shown under the Development menu + # mahjongg.desktop in ${XDG_DATA_DIR}/applications should be ignored. + installDataAs ${XDG_DATA_HOME}/applications mahjongg-2.desktop mahjongg.desktop + + # kde/gideon.desktop and kde-gideon.desktop are equivalent + # only the version under ${XDG_DATA_HOME}/applications should show up in the menu + # gideon.desktop in ${XDG_DATA_DIR}/applications/kde should be ignored. + installDataAs ${XDG_DATA_DIR}/applications/kde gideon.desktop + installDataAs ${XDG_DATA_HOME}/applications gideon.desktop kde-gideon.desktop +} diff --git a/menu/tests/tests/e/result b/menu/tests/tests/e/result deleted file mode 100644 index 0c2af9b..0000000 --- a/menu/tests/tests/e/result +++ /dev/null @@ -1,9 +0,0 @@ -Development/ gideon-legacy.desktop ${LEGACY_DIR}/Development/gideon-legacy.desktop -Development/ kbabel.desktop ${LEGACY_DIR}/Development/kbabel.desktop -Development/ quanta.desktop ${LEGACY_DIR}/Development/quanta.desktop -Editors/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Editors/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Editors/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -/ Help.desktop ${LEGACY_DIR}/Help.desktop -/ Home.desktop ${LEGACY_DIR}/Home.desktop -/ Kfind.desktop ${LEGACY_DIR}/Kfind.desktop diff --git a/menu/tests/tests/e/test b/menu/tests/tests/e/test deleted file mode 100644 index 33303f4..0000000 --- a/menu/tests/tests/e/test +++ /dev/null @@ -1,45 +0,0 @@ -echo ">>> Simple test" - -LEGACY_DIR=${MENUTESTDIR}/legacy_applnk -export LEGACY_DIR - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - ${LEGACY_DIR} - - - - - Editors - kde-editors.directory - - TextEditor - - - - Development - kde-development.directory - - Development - - - -EOF - - -# Install .desktop files - -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop - -installData ${LEGACY_DIR}/Development gideon-legacy.desktop kbabel.desktop quanta.desktop - -installData ${LEGACY_DIR} Kfind.desktop Home.desktop Help.desktop - - diff --git a/menu/tests/tests/f/result b/menu/tests/tests/f/result deleted file mode 100644 index 10ccec6..0000000 --- a/menu/tests/tests/f/result +++ /dev/null @@ -1,4 +0,0 @@ -Games/BoardGame/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop -Games/BoardGame/ mahjongg.desktop ${XDG_DATA_DIR}/applications/mahjongg.desktop -Games/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop -Games/ glines.desktop ${XDG_DATA_DIR}/applications/glines.desktop diff --git a/menu/tests/tests/f/test b/menu/tests/tests/f/test deleted file mode 100644 index 5d673d8..0000000 --- a/menu/tests/tests/f/test +++ /dev/null @@ -1,39 +0,0 @@ -echo ">>> a complicated operation" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - Games1 - Games - - - - Games1 - - BoardGame - - BoardGame - - - - - Games - - Game - - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/g/result b/menu/tests/tests/g/result deleted file mode 100644 index 9e1d622..0000000 --- a/menu/tests/tests/g/result +++ /dev/null @@ -1,3 +0,0 @@ -Applications/ KEdit.desktop ${XDG_CONFIG_DIR}/menus/apps/KEdit.desktop -Applications/ kate.desktop ${XDG_CONFIG_DIR}/menus/apps/kate.desktop -Applications/ kwrite.desktop ${XDG_CONFIG_DIR}/menus/apps/kwrite.desktop diff --git a/menu/tests/tests/g/test b/menu/tests/tests/g/test deleted file mode 100644 index eb75f2e..0000000 --- a/menu/tests/tests/g/test +++ /dev/null @@ -1,25 +0,0 @@ -echo ">>> a relative tag ..." - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - apps - - - Applications - - TextEditor - - - -EOF - - -# Install .desktop files -installData ${XDG_CONFIG_DIR}/menus/apps kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop diff --git a/menu/tests/tests/h/result b/menu/tests/tests/h/result deleted file mode 100644 index 2cd1d1f..0000000 --- a/menu/tests/tests/h/result +++ /dev/null @@ -1,3 +0,0 @@ -Apps/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Apps/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Apps/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop diff --git a/menu/tests/tests/h/test b/menu/tests/tests/h/test deleted file mode 100644 index c8fa0cc..0000000 --- a/menu/tests/tests/h/test +++ /dev/null @@ -1,28 +0,0 @@ -echo ">>> a relative tag ..." - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - desktop-directories - - - Applications - apps.directory - - TextEditor - - - -EOF - - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop -installData ${XDG_CONFIG_DIR}/menus/desktop-directories apps.directory diff --git a/menu/tests/tests/i/result b/menu/tests/tests/i/result deleted file mode 100644 index 9e17189..0000000 --- a/menu/tests/tests/i/result +++ /dev/null @@ -1,5 +0,0 @@ -Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop -Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/i/test b/menu/tests/tests/i/test deleted file mode 100644 index 26c471e..0000000 --- a/menu/tests/tests/i/test +++ /dev/null @@ -1,42 +0,0 @@ -echo ">>> the tag ..." - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - Applications - - TextEditor - - - -EOF - - -mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/ -./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu < - - - KDE - - - Development - - Development - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop diff --git a/menu/tests/tests/j/result b/menu/tests/tests/j/result deleted file mode 100644 index 9e17189..0000000 --- a/menu/tests/tests/j/result +++ /dev/null @@ -1,5 +0,0 @@ -Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop -Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/j/test b/menu/tests/tests/j/test deleted file mode 100644 index 077d952..0000000 --- a/menu/tests/tests/j/test +++ /dev/null @@ -1,42 +0,0 @@ -echo ">>> the tag ..." - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - applications-merged - - - Applications - - TextEditor - - - -EOF - - -mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/ -./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu < - - - KDE - - - Development - - Development - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop diff --git a/menu/tests/tests/k/result b/menu/tests/tests/k/result deleted file mode 100644 index 9e17189..0000000 --- a/menu/tests/tests/k/result +++ /dev/null @@ -1,5 +0,0 @@ -Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop -Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/k/test b/menu/tests/tests/k/test deleted file mode 100644 index 2a037b7..0000000 --- a/menu/tests/tests/k/test +++ /dev/null @@ -1,43 +0,0 @@ -echo ">>> the tag ..." - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - applications-merged/test.menu - - - Applications - - TextEditor - - - -EOF - - -mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/ -./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu < - - - - KDE - - - Development - - Development - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop diff --git a/menu/tests/tests/l/result b/menu/tests/tests/l/result deleted file mode 100644 index 9e17189..0000000 --- a/menu/tests/tests/l/result +++ /dev/null @@ -1,5 +0,0 @@ -Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop -Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/l/test b/menu/tests/tests/l/test deleted file mode 100644 index 3d6bfcd..0000000 --- a/menu/tests/tests/l/test +++ /dev/null @@ -1,56 +0,0 @@ -echo ">>> the tag ..." - -# Tests the use of relative paths in - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - applications-merged/test.menu - - - Applications - - TextEditor - - - -EOF - - -mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/ -./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu < - - - KDE - - extra/test.menu - -EOF - -mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/ -./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/extra/test.menu < - - - KDE - - - Development - - Development - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop diff --git a/menu/tests/tests/m/result b/menu/tests/tests/m/result deleted file mode 100644 index 7ed7169..0000000 --- a/menu/tests/tests/m/result +++ /dev/null @@ -1 +0,0 @@ -Other/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop diff --git a/menu/tests/tests/m/test b/menu/tests/tests/m/test deleted file mode 100644 index 352885e..0000000 --- a/menu/tests/tests/m/test +++ /dev/null @@ -1,35 +0,0 @@ -echo ">>> NoDisplay desktop entry values" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}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 diff --git a/menu/tests/tests/menu-multiple-matching/result b/menu/tests/tests/menu-multiple-matching/result new file mode 100644 index 0000000..986c873 --- /dev/null +++ b/menu/tests/tests/menu-multiple-matching/result @@ -0,0 +1,5 @@ +Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Applications/ gataxx.desktop ${XDG_DATA_DIR}/applications/gataxx.desktop +Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Applications/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/menu-multiple-matching/test b/menu/tests/tests/menu-multiple-matching/test new file mode 100644 index 0000000..d8914ab --- /dev/null +++ b/menu/tests/tests/menu-multiple-matching/test @@ -0,0 +1,36 @@ +TEST_PURPOSE="complicated rule ..." + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + Applications + + + Game + BoardGame + + + TextEditor + quanta.desktop + + + + mahjongg.desktop + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop +} diff --git a/menu/tests/tests/n/result b/menu/tests/tests/n/result deleted file mode 100644 index 7ed7169..0000000 --- a/menu/tests/tests/n/result +++ /dev/null @@ -1 +0,0 @@ -Other/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop diff --git a/menu/tests/tests/n/test b/menu/tests/tests/n/test deleted file mode 100644 index 7088e16..0000000 --- a/menu/tests/tests/n/test +++ /dev/null @@ -1,36 +0,0 @@ -echo ">>> Allocation of desktop entry values from deleted menus" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - - Shouldn't see this - apps.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 apps.directory diff --git a/menu/tests/tests/o/result b/menu/tests/tests/o/result deleted file mode 100644 index ea47f01..0000000 --- a/menu/tests/tests/o/result +++ /dev/null @@ -1,3 +0,0 @@ -Apps/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Apps/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Apps/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop diff --git a/menu/tests/tests/o/test b/menu/tests/tests/o/test deleted file mode 100644 index b87f321..0000000 --- a/menu/tests/tests/o/test +++ /dev/null @@ -1,34 +0,0 @@ -echo ">>> foofoo shouldn't match anything" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - - Applications - apps.directory - - - TextEditor - - Game - Game - - - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop -installData ${XDG_DATA_DIR}/applications/test freecell.desktop -installData ${XDG_DATA_DIR}/desktop-directories apps.directory diff --git a/menu/tests/tests/official-categories/categories.list b/menu/tests/tests/official-categories/categories.list new file mode 100644 index 0000000..6e2198d --- /dev/null +++ b/menu/tests/tests/official-categories/categories.list @@ -0,0 +1,10 @@ +AudioVideo +Development +Education +Game +Graphics +Network +Office +Settings +System +Utility diff --git a/menu/tests/tests/official-categories/test b/menu/tests/tests/official-categories/test new file mode 100644 index 0000000..09621cd --- /dev/null +++ b/menu/tests/tests/official-categories/test @@ -0,0 +1,73 @@ +TEST_PURPOSE="verify all required categories are supported" + +base_loc="tests/official-categories" + +test_code() +{ + local category + for category in $(< "${base_loc}/categories.list"); do + CATEGORY="${category}" ./expand "${base_loc}/unique-entry.desktop" > "data/${category}.desktop" + installData "${XDG_DATA_DIR}/applications" "${category}.desktop" + rm "data/${category}.desktop" + done +} + +query() +{ + echo "$@" + ret='' + while [ -z "$ret" ]; do + echo -n "y/n? :" + read ret + if ! [ "$ret" == "y" -o "$ret" == "n" ]; then + echo "invalid response; must be 'y' or 'n'" + ret='' + fi + done + [ "$ret" == "y" ] && return 0 + return 1 +} + +interpret_results() +{ + # inefficient, but works. + local missed='' + local correct='' + for category in $(< "${base_loc}/categories.list"); do + if grep "/${category}\.desktop" "${MENUTESTDIR}/run-result" > /dev/null; then + correct="${correct} ${category}" + else + missed="${missed} ${category}" + fi + done + if [ -z "${missed}" ]; then + echo ">>> OK" + return 0 + fi + if [ "$(echo $missed)" != "Settings" ]; then + # failures. + cat "${MENUTESTDIR}/run-result" + echo "missed categories $missed" + echo "matched ${correct}" + echo ">>> Failed (missed $(echo $missed | wc -w) out of $(wc -l "${base_loc}/categories.list")" + return 1 + fi + echo ">>> Settings failed; checking interactively" + local ret + if [ "$(id -u)" != "0" ]; then + echo ">>> Cannot go interactive due to test being ran as non-root; re-run as root" + return 1; + elif ! which xdg-desktop-menu &> /dev/null; then + echo ">>> xdg-desktop-menu is not available; cannot do interactive test" + return 1; + fi + xdg-desktop-menu install --mode system --novendor "${XDG_DATA_DIR}/applications/Settings.desktop" + ( + query "Please check for a 'menu-spec-testing' in any gnome/kde system settings panel" + ) + ret=$? + xdg-desktop-menu uninstall --mode system "${XDG_DATA_DIR}/applications/Settings.desktop" + return $(($ret)) +} + +MODE=system_data diff --git a/menu/tests/tests/official-categories/unique-entry.desktop b/menu/tests/tests/official-categories/unique-entry.desktop new file mode 100644 index 0000000..6ee3b88 --- /dev/null +++ b/menu/tests/tests/official-categories/unique-entry.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=menu-spec-testing +Exec=true +Icon=quanta +Type=Application +MimeType=text/html +Comment=menu-spec testing +Categories=${CATEGORY}; diff --git a/menu/tests/tests/p/result b/menu/tests/tests/p/result deleted file mode 100644 index 9e17189..0000000 --- a/menu/tests/tests/p/result +++ /dev/null @@ -1,5 +0,0 @@ -Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop -Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/p/test b/menu/tests/tests/p/test deleted file mode 100644 index 3341eec..0000000 --- a/menu/tests/tests/p/test +++ /dev/null @@ -1,55 +0,0 @@ -echo ">>> the tag ..." - -# Tests the use of relative paths in - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - test.menu - - - Applications - - TextEditor - - - -EOF - - -./expand > ${XDG_CONFIG_DIR}/menus/test.menu < - - - KDE - - extra/test.menu - -EOF - -mkdir ${XDG_CONFIG_DIR}/menus/extra/ -./expand > ${XDG_CONFIG_DIR}/menus/extra/test.menu < - - - KDE - - - Development - - Development - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop diff --git a/menu/tests/tests/q/result b/menu/tests/tests/q/result deleted file mode 100644 index 9e17189..0000000 --- a/menu/tests/tests/q/result +++ /dev/null @@ -1,5 +0,0 @@ -Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop -Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/q/test b/menu/tests/tests/q/test deleted file mode 100644 index 6e071c6..0000000 --- a/menu/tests/tests/q/test +++ /dev/null @@ -1,60 +0,0 @@ -echo ">>> the tag ..." - -# Tests the type attribute in - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_HOME}/menus -./expand > ${XDG_CONFIG_HOME}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - ${XDG_CONFIG_DIR}/menus/test.menu - - - Applications - - TextEditor - - - -EOF - - -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/test.menu < - - - KDE - - - Games - - Game - - - -EOF - -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - Development - - Development - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/r/result b/menu/tests/tests/r/result deleted file mode 100644 index fbe635e..0000000 --- a/menu/tests/tests/r/result +++ /dev/null @@ -1,5 +0,0 @@ -Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Games/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop -Games/ glines.desktop ${XDG_DATA_DIR}/applications/glines.desktop diff --git a/menu/tests/tests/r/test b/menu/tests/tests/r/test deleted file mode 100644 index 6facb91..0000000 --- a/menu/tests/tests/r/test +++ /dev/null @@ -1,60 +0,0 @@ -echo ">>> the tag ..." - -# Tests the type attribute in - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_HOME}/menus -./expand > ${XDG_CONFIG_HOME}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - ${XDG_CONFIG_DIR}/menus/test.menu - - - Applications - - TextEditor - - - -EOF - - -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/test.menu < - - - KDE - - - Games - - Game - - - -EOF - -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - Development - - Development - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop freecell.desktop glines.desktop diff --git a/menu/tests/tests/s/result b/menu/tests/tests/s/result deleted file mode 100644 index e1e9221..0000000 --- a/menu/tests/tests/s/result +++ /dev/null @@ -1,3 +0,0 @@ -Development/ kde-gideon.desktop ${XDG_DATA_HOME}/applications/kde-gideon.desktop -Development/ mahjongg.desktop ${XDG_DATA_HOME}/applications/mahjongg.desktop -Games/ freecell.desktop ${XDG_DATA_HOME}/applications/freecell.desktop diff --git a/menu/tests/tests/s/test b/menu/tests/tests/s/test deleted file mode 100644 index a68b646..0000000 --- a/menu/tests/tests/s/test +++ /dev/null @@ -1,51 +0,0 @@ -echo ">>> .desktop files with same name ..." - -# Tests the type attribute in - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - Games - - Game - - - - Development - - Development - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications freecell.desktop glines.desktop mahjongg.desktop - -# freecell.desktop is installed twice, only the version under ${XDG_DATA_HOME}/applications -# should show up in the menu -# freecell.desktop in ${XDG_DATA_DIR}/applications should be ignored. -installData ${XDG_DATA_HOME}/applications freecell.desktop - -# ${XDG_DATA_HOME}/applications/glines.desktop has NoDisplay=true -# glines.desktop should not be shown -# glines.desktop in ${XDG_DATA_DIR}/applications should be ignored. -installDataAs ${XDG_DATA_HOME}/applications glines-2.desktop glines.desktop - -# ${XDG_DATA_HOME}/applications/mahjongg.desktop has Categories=Development -# mahjongg.desktop should be shown under the Development menu -# mahjongg.desktop in ${XDG_DATA_DIR}/applications should be ignored. -installDataAs ${XDG_DATA_HOME}/applications mahjongg-2.desktop mahjongg.desktop - -# kde/gideon.desktop and kde-gideon.desktop are equivalent -# only the version under ${XDG_DATA_HOME}/applications should show up in the menu -# gideon.desktop in ${XDG_DATA_DIR}/applications/kde should be ignored. -installDataAs ${XDG_DATA_DIR}/applications/kde gideon.desktop -installDataAs ${XDG_DATA_HOME}/applications gideon.desktop kde-gideon.desktop diff --git a/menu/tests/tests/submenu-collision/result b/menu/tests/tests/submenu-collision/result new file mode 100644 index 0000000..6aa47d7 --- /dev/null +++ b/menu/tests/tests/submenu-collision/result @@ -0,0 +1,5 @@ +Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop +Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop +Applications/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop +Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop +Applications/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/submenu-collision/test b/menu/tests/tests/submenu-collision/test new file mode 100644 index 0000000..7d29896 --- /dev/null +++ b/menu/tests/tests/submenu-collision/test @@ -0,0 +1,32 @@ +TEST_PURPOSE="two submenus with the same name ..." + +test_code() { + # Generate applications.menu + mkdir -p ${XDG_CONFIG_DIR}/menus + ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu < + + + KDE + + + + + Applications + + TextEditor + + + + Applications + + Development + + + +EOF + + # Install .desktop files + installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop +} diff --git a/menu/tests/tests/t/result b/menu/tests/tests/t/result deleted file mode 100644 index b941f58..0000000 --- a/menu/tests/tests/t/result +++ /dev/null @@ -1,3 +0,0 @@ -Development/ gideon.desktop ${XDG_DATA_DIR}/applications/gideon.desktop -Games-Correct/ freecell.desktop ${XDG_DATA_DIR}/applications/freecell.desktop -Games-Correct/ glines.desktop ${XDG_DATA_DIR}/applications/glines.desktop diff --git a/menu/tests/tests/t/test b/menu/tests/tests/t/test deleted file mode 100644 index bbe7568..0000000 --- a/menu/tests/tests/t/test +++ /dev/null @@ -1,47 +0,0 @@ -echo ">>> Order of operations ..." - -# Tests the type attribute in - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - Development - - Games - - Game - - - - Development - - - - Development/Games-New - Games-Correct - - - Development/Games - Games-Wrong - - - Development - - Games - Games-New - - - -EOF - -# Move operations in sub-menus should be performed first - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications freecell.desktop glines.desktop gideon.desktop diff --git a/menu/tests/tests/u/result b/menu/tests/tests/u/result deleted file mode 100644 index 9e17189..0000000 --- a/menu/tests/tests/u/result +++ /dev/null @@ -1,5 +0,0 @@ -Applications/ KEdit.desktop ${XDG_DATA_DIR}/applications/KEdit.desktop -Applications/ kate.desktop ${XDG_DATA_DIR}/applications/kate.desktop -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Development/ kbabel.desktop ${XDG_DATA_DIR}/applications/kbabel.desktop -Development/ quanta.desktop ${XDG_DATA_DIR}/applications/quanta.desktop diff --git a/menu/tests/tests/u/test b/menu/tests/tests/u/test deleted file mode 100644 index 83e3700..0000000 --- a/menu/tests/tests/u/test +++ /dev/null @@ -1,58 +0,0 @@ -echo ">>> recursive s ..." - -# Test elaborate recursive loop in s - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - applications-merged/test.menu - - - Applications - - TextEditor - - - -EOF - - -mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/ -./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu < - - - KDE - - extra/test.menu - -EOF - -mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/ -./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/extra/test.menu < - - - KDE - - - Development - - Development - - - - ../test.menu - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop diff --git a/menu/tests/tests/v/result b/menu/tests/tests/v/result deleted file mode 100644 index 0c398b7..0000000 --- a/menu/tests/tests/v/result +++ /dev/null @@ -1,2 +0,0 @@ -Applications/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop -Editors/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop diff --git a/menu/tests/tests/v/test b/menu/tests/tests/v/test deleted file mode 100644 index 5fb6103..0000000 --- a/menu/tests/tests/v/test +++ /dev/null @@ -1,31 +0,0 @@ -echo ">>> Another test" - -# Tests - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - Applications - - kwrite.desktop - - - - Editors - - kwrite.desktop - - - -EOF - -# Install .desktop files -installData ${XDG_DATA_DIR}/applications kwrite.desktop diff --git a/menu/tests/tests/w/result b/menu/tests/tests/w/result deleted file mode 100644 index 9a2b9db..0000000 --- a/menu/tests/tests/w/result +++ /dev/null @@ -1,2 +0,0 @@ -Editors/ gideon-legacy.desktop ${LEGACY_DIR}/Development/gideon-legacy.desktop -/ Home.desktop ${LEGACY_DIR}/Home.desktop diff --git a/menu/tests/tests/w/test b/menu/tests/tests/w/test deleted file mode 100644 index 45fb03a..0000000 --- a/menu/tests/tests/w/test +++ /dev/null @@ -1,38 +0,0 @@ -echo ">>> Move entries from " - -LEGACY_DIR=${MENUTESTDIR}/legacy_applnk -export LEGACY_DIR - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - ${LEGACY_DIR} - - - - - Development - - gideon-legacy.desktop - - - - Editors - - gideon-legacy.desktop - - - -EOF - - -# Install .desktop files - -installData ${LEGACY_DIR} Home.desktop -installData ${LEGACY_DIR}/Development gideon-legacy.desktop diff --git a/menu/tests/tests/x/result b/menu/tests/tests/x/result deleted file mode 100644 index f1c44ef..0000000 --- a/menu/tests/tests/x/result +++ /dev/null @@ -1 +0,0 @@ -A/B/Development/ gideon-legacy.desktop ${XDG_DATA_DIR}/applications/gideon-legacy.desktop diff --git a/menu/tests/tests/x/test b/menu/tests/tests/x/test deleted file mode 100644 index bc5ff47..0000000 --- a/menu/tests/tests/x/test +++ /dev/null @@ -1,31 +0,0 @@ -echo ">>> Move into a new Submenu" - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - - - Development - - gideon-legacy.desktop - - - - Development - A/B/Development - - -EOF - - -# Install .desktop files - -installData ${XDG_DATA_DIR}/applications gideon-legacy.desktop diff --git a/menu/tests/tests/y/result b/menu/tests/tests/y/result deleted file mode 100644 index 999bd1e..0000000 --- a/menu/tests/tests/y/result +++ /dev/null @@ -1 +0,0 @@ -Editors/ kwrite.desktop ${XDG_DATA_DIR}/applications/kwrite.desktop diff --git a/menu/tests/tests/y/test b/menu/tests/tests/y/test deleted file mode 100644 index 1c20959..0000000 --- a/menu/tests/tests/y/test +++ /dev/null @@ -1,45 +0,0 @@ -echo ">>> Merge Two Menus and a Legacy Menu" - -LEGACY_DIR=${MENUTESTDIR}/legacy_applnk -export LEGACY_DIR - -# Generate ${DIRTY_HACK}applications.menu -mkdir -p ${XDG_CONFIG_DIR}/menus -./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu < - - - KDE - - - - ${LEGACY_DIR} - - - Development - - kate.desktop - - - - Development - - KEdit.desktop - - - - - Editors - - kwrite.desktop - - - -EOF - - -# Install .desktop files - -installData ${LEGACY_DIR}/Development gideon-legacy.desktop -installData ${XDG_DATA_DIR}/applications kate.desktop kwrite.desktop KEdit.desktop diff --git a/menu/tests/tet_menutest b/menu/tests/tet_menutest new file mode 100755 index 0000000..1aae67e --- /dev/null +++ b/menu/tests/tet_menutest @@ -0,0 +1,39 @@ +#!/bin/bash +TET_RUN="asdf" +export MENUTESTDIR="${MENUTESTDIR:-/tmp/menutest}" +. menutest +# hack, figure out the var to use here + +tpstart() { + tet_infoline "$*" + FAIL=N +} + +tet_startup='' +tet_cleanup='' +declare -i count=1 +iclist='' +echo $TESTS +for TESTCASE in ${TESTS}; do + [ ! -e "tests/${TESTCASE}/test" ] && continue; + # this basically curries the arg to run_test. + eval "tp${count}() { + . tests/${TESTCASE}/test + tpstart \"$(. tests/${TESTCASE}/test; echo ${TEST_PURPOSE-none stated})\"; + if ! run_test tests/\"$TESTCASE\"; then + tet_result FAIL; + else + tet_result PASS; + fi + set +x + }"; + iclist="${iclist} ic${count}" + eval "ic${count}=tp${count}" + # force subshelling, so that it doesn't pull a die on us + ((count+=1)) +done +tet_iclist=iclist +. /opt/lsb-tet3-lite/lib/posix_sh/tcm.sh +tet_outputline 100 "xdg menu test" +tet_tcm_main $tet_iclist + diff --git a/menu/tet_scen b/menu/tet_scen new file mode 100644 index 0000000..4fe544e --- /dev/null +++ b/menu/tet_scen @@ -0,0 +1,5 @@ +all + "Starting menu tests" + /tests/tet_menutest + "finished menu tests" + diff --git a/menu/tetexec.cfg b/menu/tetexec.cfg new file mode 100644 index 0000000..ea150c9 --- /dev/null +++ b/menu/tetexec.cfg @@ -0,0 +1 @@ +TET_PASS_TC_NAME=True -- cgit v1.2.3-70-g09d2