summaryrefslogtreecommitdiffstats
path: root/menu/tests
diff options
context:
space:
mode:
Diffstat (limited to 'menu/tests')
-rw-r--r--menu/tests/ChangeLog70
-rw-r--r--menu/tests/README44
-rw-r--r--menu/tests/TODO5
-rw-r--r--menu/tests/data/Help.desktop68
-rw-r--r--menu/tests/data/Home.desktop127
-rw-r--r--menu/tests/data/KEdit.desktop34
-rw-r--r--menu/tests/data/Kfind.desktop66
-rw-r--r--menu/tests/data/apps.directory66
-rw-r--r--menu/tests/data/freecell.desktop83
-rw-r--r--menu/tests/data/gataxx.desktop81
-rw-r--r--menu/tests/data/gideon-legacy.desktop12
-rw-r--r--menu/tests/data/gideon.desktop13
-rw-r--r--menu/tests/data/glines-2.desktop83
-rw-r--r--menu/tests/data/glines.desktop82
-rw-r--r--menu/tests/data/hidden.desktop8
-rw-r--r--menu/tests/data/hidden.directory5
-rw-r--r--menu/tests/data/kate.desktop30
-rw-r--r--menu/tests/data/kbabel.desktop69
-rw-r--r--menu/tests/data/kedit-legacy.desktop33
-rw-r--r--menu/tests/data/kwrite.desktop84
-rw-r--r--menu/tests/data/mahjongg-2.desktop86
-rw-r--r--menu/tests/data/mahjongg.desktop86
-rw-r--r--menu/tests/data/quanta.desktop10
-rwxr-xr-xmenu/tests/expand12
-rwxr-xr-xmenu/tests/menutest200
-rw-r--r--menu/tests/tests/All/result4
-rw-r--r--menu/tests/tests/All/test26
-rw-r--r--menu/tests/tests/And/result1
-rw-r--r--menu/tests/tests/And/test29
-rw-r--r--menu/tests/tests/AppDir-relative/result3
-rw-r--r--menu/tests/tests/AppDir-relative/test27
-rw-r--r--menu/tests/tests/AppDir/test4
-rw-r--r--menu/tests/tests/Category/result3
-rw-r--r--menu/tests/tests/Category/test29
-rw-r--r--menu/tests/tests/DefaultMergeDirs/result5
-rw-r--r--menu/tests/tests/DefaultMergeDirs/test43
-rw-r--r--menu/tests/tests/Deleted/result2
-rw-r--r--menu/tests/tests/Deleted/test35
-rw-r--r--menu/tests/tests/DesktopFileID/result4
-rw-r--r--menu/tests/tests/DesktopFileID/test26
-rw-r--r--menu/tests/tests/Directory/result3
-rw-r--r--menu/tests/tests/Directory/test29
-rw-r--r--menu/tests/tests/DirectoryDir-relative/result3
-rw-r--r--menu/tests/tests/DirectoryDir-relative/test28
-rw-r--r--menu/tests/tests/DirectoryDir/test4
-rw-r--r--menu/tests/tests/Exclude/result3
-rw-r--r--menu/tests/tests/Exclude/test32
-rw-r--r--menu/tests/tests/Filename/result1
-rw-r--r--menu/tests/tests/Filename/test26
-rw-r--r--menu/tests/tests/LegacyDir-Move/result2
-rw-r--r--menu/tests/tests/LegacyDir-Move/test39
-rw-r--r--menu/tests/tests/LegacyDir-relative/result9
-rw-r--r--menu/tests/tests/LegacyDir-relative/test42
-rw-r--r--menu/tests/tests/Merge-combined/result1
-rw-r--r--menu/tests/tests/Merge-combined/test46
-rw-r--r--menu/tests/tests/MergeDir-absolute/test3
-rw-r--r--menu/tests/tests/MergeDir-relative/result5
-rw-r--r--menu/tests/tests/MergeDir-relative/test61
-rw-r--r--menu/tests/tests/MergeFile-absolute/test3
-rw-r--r--menu/tests/tests/MergeFile-parent/result5
-rw-r--r--menu/tests/tests/MergeFile-parent/test61
-rw-r--r--menu/tests/tests/MergeFile-path/result5
-rw-r--r--menu/tests/tests/MergeFile-path/test61
-rw-r--r--menu/tests/tests/MergeFile-recursive/result5
-rw-r--r--menu/tests/tests/MergeFile-recursive/test58
-rw-r--r--menu/tests/tests/MergeFile-relative/result5
-rw-r--r--menu/tests/tests/MergeFile-relative/test44
-rw-r--r--menu/tests/tests/MergeFile2/result5
-rw-r--r--menu/tests/tests/MergeFile2/test57
-rw-r--r--menu/tests/tests/MergeFile3/result5
-rw-r--r--menu/tests/tests/MergeFile3/test56
-rw-r--r--menu/tests/tests/Move-collapsing/result4
-rw-r--r--menu/tests/tests/Move-collapsing/test40
-rw-r--r--menu/tests/tests/Move-ordering/result3
-rw-r--r--menu/tests/tests/Move-ordering/test49
-rw-r--r--menu/tests/tests/Move-submenu/result1
-rw-r--r--menu/tests/tests/Move-submenu/test32
-rw-r--r--menu/tests/tests/Move/result2
-rw-r--r--menu/tests/tests/Move/test34
-rw-r--r--menu/tests/tests/NoDisplay/result1
-rw-r--r--menu/tests/tests/NoDisplay/test37
-rw-r--r--menu/tests/tests/NoDisplay2/result1
-rw-r--r--menu/tests/tests/NoDisplay2/test38
-rw-r--r--menu/tests/tests/NotOnlyUnallocated-default/result2
-rw-r--r--menu/tests/tests/NotOnlyUnallocated-default/test33
-rw-r--r--menu/tests/tests/OnlyUnallocated/result3
-rw-r--r--menu/tests/tests/OnlyUnallocated/test44
-rw-r--r--menu/tests/tests/Or/result4
-rw-r--r--menu/tests/tests/Or/test29
-rw-r--r--menu/tests/tests/boolean-logic/result3
-rw-r--r--menu/tests/tests/boolean-logic/test36
-rw-r--r--menu/tests/tests/desktop-name-collision/result3
-rw-r--r--menu/tests/tests/desktop-name-collision/test53
-rw-r--r--menu/tests/tests/menu-multiple-matching/result5
-rw-r--r--menu/tests/tests/menu-multiple-matching/test36
-rw-r--r--menu/tests/tests/official-categories/categories.list10
-rw-r--r--menu/tests/tests/official-categories/test73
-rw-r--r--menu/tests/tests/official-categories/unique-entry.desktop9
-rw-r--r--menu/tests/tests/submenu-collision/result5
-rw-r--r--menu/tests/tests/submenu-collision/test32
-rwxr-xr-xmenu/tests/tet_menutest39
101 files changed, 3066 insertions, 0 deletions
diff --git a/menu/tests/ChangeLog b/menu/tests/ChangeLog
new file mode 100644
index 0000000..ac55e4f
--- /dev/null
+++ b/menu/tests/ChangeLog
@@ -0,0 +1,70 @@
+2005-04-25 Mark McLoughlin <mark@skynet.ie>
+
+ * tests/u: add test for recursive inclusion of .menu files.
+ Also know as the "get really hosed and eat all the RAM
+ you can find" test.
+
+2005-04-20 Waldo Bastian <bastian@kde.org>
+
+ * tests/s/result,
+ tests/s/test: Test that .desktop files under $HOME correctly
+ override .desktop files at system level
+
+ * tests/t/result,
+ tests/t/test: Test order in which <Move> elements are processed
+
+2005-02-18 Mark McLoughlin <mark@skynet.ie>
+
+ Make it a bit more difficult in order to catch:
+ http://bugzilla.gnome.org/show_bug.cgi?id=167758
+ Thanks to Chris Lahey for the test case.
+
+ * tests/o/test: put freecell.desktop in a subdirectory.
+
+2005-02-18 Mark McLoughlin <mark@skynet.ie>
+
+ * tests/o/result,
+ tests/o/test: test that
+ <And><Category>foo</Category><Not><Category>foo</Category></Not></And>
+ doesn't match anything.
+
+ * README: add bit about how to test the GNOME impl.
+
+2005-02-18 Mark McLoughlin <mark@skynet.ie>
+
+ Problem pointed out by Waldo.
+
+ * menutest: don't try and run the "CVS" test :)
+
+ * tests/m/result,
+ tests/n/result: items in a hidden or deleted menu
+ should be considered allocated.
+
+2004-12-08 Mark McLoughlin <mark@skynet.ie>
+
+ * tests/2/result,
+ tests/2/test: test the new <OnlyUnallocated> behaviour.
+
+2004-08-29 Mark McLoughlin <mark@skynet.ie>
+
+ * tests/m: test for NoDisplay=true behavious in .desktop and
+ .directory files.
+
+ * data/hidden.desktop,
+ data/hidden.directory: add.
+
+ * data/apps.directory: add Type=Directory.
+
+ * menutest: actually generate a test result if one doesn't
+ exist - makes it easier to write new tests.
+
+2003-10-23 Havoc Pennington <hp@redhat.com>
+
+ * tests/f/test: remove <OnlyUnallocated/> from inside <Include>
+ statement, not allowed.
+
+2003-10-16 Havoc Pennington <hp@redhat.com>
+
+ * menutest: cat log file on failure; print list of failed tests
+ when we're done
+
diff --git a/menu/tests/README b/menu/tests/README
new file mode 100644
index 0000000..b003dc0
--- /dev/null
+++ b/menu/tests/README
@@ -0,0 +1,44 @@
+This directory contains regression tests for the menu-spec.
+
+To run these tests your menu-spec implementation should be
+able to generate a menu in the following text format:
+
+<Full Menu Name><tab><Desktop File Id><tab><Full Path to Desktop File>
+
+Example:
+
+Editors/ kde-kwrite.desktop /home/bastian/.local/share/applications/kde-kwrite.desktop
+Editors/ kde-kate.desktop /home/bastian/.local/share/applications/kde-kate.desktop
+Editors/ kde-KEdit.desktop /home/bastian/.local/share/applications/kde-KEdit.desktop
+Development/ kde-gideon.desktop /opt/kde3/share/applnk/Development/gideon.desktop
+Development/ kde-kbabel.desktop /opt/kde3/share/applnk/Development/kbabel.desktop
+Development/ kde-quanta.desktop /opt/kde3/share/applnk/Development/quanta.desktop
+/ kde-Kfind.desktop /opt/kde3/share/applnk/Kfind.desktop
+/ kde-Home.desktop /opt/kde3/share/applnk/Home.desktop
+/ kde-Help.desktop /opt/kde3/share/applnk/Help.desktop
+
+
+
+The environment variable $MENUTEST should point to a command that is
+able to generate the menu in the above format.
+
+To test KDE one can use:
+ MENUTEST="kbuildsycoca --menutest"
+
+With GNOME, you can use:
+ MENUTEST=gnome-menu-spec-test
+
+The menutest script should be used to run the tests. The following commands can
+be used:
+
+ MENUTEST="foo -bar" ./menutest
+
+to run all tests
+
+ MENUTEST="foo -bar" TESTS="Deleted Directory" ./menutest
+
+to run the tests named "Deleted" and "Directory" only
+
+All tests contain of a test setup script named "test" and a file describing
+the expected menu named "result".
+
diff --git a/menu/tests/TODO b/menu/tests/TODO
new file mode 100644
index 0000000..6e178bf
--- /dev/null
+++ b/menu/tests/TODO
@@ -0,0 +1,5 @@
+I hope you understand what i mean ;)
+
+desktop-file-id stuff & overwrite stuff absolute path
+
+onlyshowin - notshowin
diff --git a/menu/tests/data/Help.desktop b/menu/tests/data/Help.desktop
new file mode 100644
index 0000000..dc867cd
--- /dev/null
+++ b/menu/tests/data/Help.desktop
@@ -0,0 +1,68 @@
+[Desktop Entry]
+Encoding=UTF-8
+Exec=khelpcenter
+Icon=khelpcenter
+DocPath=khelpcenter/index.html
+Type=Application
+Terminal=0
+
+Name=Help
+Name[af]=Hulp
+Name[az]=Yardım
+Name[be]=Дапамога
+Name[bg]=Помощ
+Name[br]=Skoazell
+Name[bs]=Pomoć
+Name[ca]=Ajuda
+Name[cs]=Nápověda
+Name[cy]=Cymorth
+Name[da]=Hjælp
+Name[de]=Hilfe
+Name[el]=Βοήθεια
+Name[eo]=Helpo
+Name[es]=Ayuda
+Name[et]=Abiinfo
+Name[eu]=Laguntza
+Name[fa]=راهنما
+Name[fi]=Ohje
+Name[fr]=Aide
+Name[gl]=Axuda
+Name[he]=עזרה
+Name[hr]=Pomoć
+Name[hu]=Segítség
+Name[id]=Keterangan bantu
+Name[is]=Hjálp
+Name[it]=Aiuto
+Name[ja]=ヘルプ
+Name[ko]=도움말
+Name[lo]=ລະບົບຊ່ວຍເຫືລອ
+Name[lt]=Pagalba
+Name[lv]=Palīdzība
+Name[mn]=Тусламж
+Name[mt]=Għajnuna
+Name[nb]=Hjelp
+Name[nn]=Hjelp
+Name[nso]=Thuso
+Name[oc]=Ajuda
+Name[pl]=Pomoc
+Name[pt]=Ajuda
+Name[pt_BR]=Ajuda
+Name[ro]=Ajutor
+Name[ru]=Справка
+Name[sk]=Pomocník
+Name[sl]=Pomoč
+Name[sr]=Pomoć
+Name[ss]=Sita
+Name[sv]=Hjälp
+Name[ta]=¯¾Å¢
+Name[th]=ระบบช่วยเหลือ
+Name[tr]=Yardım
+Name[uk]=Довідка
+Name[ven]=Thuso
+Name[vi]=Trợ giúp
+Name[wa]=Aidance
+Name[xh]=Uncedo
+Name[zh_CN]=帮助
+Name[zh_TW]=求助
+Name[zu]=Usizo
+
diff --git a/menu/tests/data/Home.desktop b/menu/tests/data/Home.desktop
new file mode 100644
index 0000000..2bf8178
--- /dev/null
+++ b/menu/tests/data/Home.desktop
@@ -0,0 +1,127 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=kfmclient openProfile filemanagement
+Icon=folder_home
+Terminal=0
+
+Name=Home
+Name[af]=Huis
+Name[az]=Başlanğıc
+Name[be]=Хатні
+Name[bg]=Домашна директория
+Name[br]=Er-gêr
+Name[bs]=Početak
+Name[ca]=Inici
+Name[cs]=Můj adresář
+Name[cy]=Cartref
+Name[da]=Hjem
+Name[de]=Persönliches Verzeichnis
+Name[el]=Σπίτι
+Name[eo]=Hejmo
+Name[es]=Personal
+Name[et]=Kodukataloog
+Name[eu]=Etxea
+Name[fa]=خانه
+Name[fi]=Koti
+Name[fr]=Dossier personnel
+Name[gl]=Persoal
+Name[he]=בית
+Name[hr]=Početak
+Name[hu]=Saját könyvtár
+Name[id]=Rumah
+Name[is]=Heimasvæðið þitt
+Name[ja]=ホーム
+Name[ko]=홈
+Name[lo]=ພື້ນທີ່ສ່ວນຕົວ
+Name[lt]=Pradžia
+Name[lv]=Mājas
+Name[mn]=Хувийн лавлах
+Name[mt]=Direttorju Personali
+Name[nb]=Hjem
+Name[nl]=Persoonlijke map
+Name[nn]=Heim
+Name[nso]=Gae
+Name[oc]=Inici
+Name[pl]=Katalog domowy
+Name[pt]=Casa
+Name[ro]=Acasă
+Name[ru]=Домой
+Name[sk]=Domov
+Name[sl]=Domov
+Name[sr]=Кориснички директоријум
+Name[ss]=Ekhaya
+Name[sv]=Hem
+Name[ta]=¦¾¡¼ì¸õ
+Name[th]=พื้นที่ส่วนตัว
+Name[tr]=Başlangıç
+Name[uk]=Домівка
+Name[ven]=Haya
+Name[wa]=Måjhon
+Name[xh]=Ikhaya
+Name[xx]=xxHomexx
+Name[zh_CN]=起点
+Name[zh_TW]=家目錄
+Name[zu]=Ikhaya
+
+GenericName=Personal Files
+GenericName[af]=Persoonlike Lêers
+GenericName[az]=Şəxsi Fayllar
+GenericName[be]=Пэрсанальныя файлы
+GenericName[bg]=Лични файлове
+GenericName[br]=Restroù deoc'h
+GenericName[bs]=Osobne datoteke
+GenericName[ca]=Fitxers personals
+GenericName[cs]=Osobní soubory
+GenericName[cy]=Ffeiliau Personol
+GenericName[da]=Personlige filer
+GenericName[de]=Eigene Dateien
+GenericName[el]=Προσωπικά Αρχεία
+GenericName[eo]=Personaj dosieroj
+GenericName[es]=Archivos personales
+GenericName[et]=Isiklikud failid
+GenericName[eu]=Fitxategi Pertsonalak
+GenericName[fa]=پرونده‌های شخصی
+GenericName[fi]=Omat tiedostot
+GenericName[fr]=Fichiers personnels
+GenericName[gl]=Ficheiros Persoais
+GenericName[he]=קבצים אישיים
+GenericName[hr]=Osobne datoteke
+GenericName[hu]=személyes fájlok
+GenericName[id]=File Pribadi
+GenericName[is]=Skrárnar þínar
+GenericName[it]=File personali
+GenericName[ja]=個人のファイル
+GenericName[ko]=혼자만 쓰는 파일
+GenericName[lo]=ທີ່ເກັບແຟ້ມແລະເອກະສານສວ່ນຕົວຫລືອື່ນຯ
+GenericName[lt]=Asmeninės Bylos
+GenericName[lv]=Personālie Faili
+GenericName[mn]=Өөрийн файлууд
+GenericName[mt]=Fajls Personali
+GenericName[nb]=Personlige filer
+GenericName[nl]=persoonlijke bestanden
+GenericName[nn]=Personlege filer
+GenericName[nso]=Difaele tsa Botho
+GenericName[oc]=FiquièRs personals
+GenericName[pl]=Pliki osobiste
+GenericName[pt]=Ficheiros Pessoais
+GenericName[pt_BR]=Arquivos Pessoais
+GenericName[ro]=Fişiere personale
+GenericName[ru]=Личные файлы
+GenericName[sk]=Osobné súbory
+GenericName[sl]=Osebne datoteke
+GenericName[sr]=Овај директоријум садржи ваше личне фајлове
+GenericName[sv]=Personliga filer
+GenericName[ta]=¦º¡ó¾ì §¸¡ôÒì¸û
+GenericName[th]=ที่เก็บแฟ้มและเอกสารส่วนตัว หรืออื่น ๆ
+GenericName[tr]=Kişisel Dosyalar
+GenericName[uk]=Особисті файли
+GenericName[ven]=Dzifaela dza vhune
+GenericName[vi]=File cá nhân
+GenericName[wa]=Fitchîs da vosse
+GenericName[xh]=Iifayile Zobuqu
+GenericName[xx]=xxPersonal Filesxx
+GenericName[zh_CN]=个人文件
+GenericName[zh_TW]=個人檔案
+GenericName[zu]=Amafayela Omuntu siqu
+
diff --git a/menu/tests/data/KEdit.desktop b/menu/tests/data/KEdit.desktop
new file mode 100644
index 0000000..4274a2b
--- /dev/null
+++ b/menu/tests/data/KEdit.desktop
@@ -0,0 +1,34 @@
+[Desktop Entry]
+Encoding=UTF-8
+BinaryPattern=kedit;
+MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
+GenericName=Simple Text Editor
+GenericName[ca]=Editor de text
+GenericName[cs]=Jednoduchý textový editor
+GenericName[da]=Simpel teksteditor
+GenericName[es]=Editor de texto sencillo
+GenericName[fr]=Éditeur de texte élémentaire
+GenericName[pt_BR]=Editor de Texto Simples
+GenericName[sv]=Enkel texteditor
+GenericName[wa]=Simpe aspougneu di tecse
+Exec=kedit -caption "%c" %i %m %u
+Icon=kedit
+TerminalOptions=
+Path=
+DocPath=kedit/index.html
+Type=Application
+Terminal=0
+Name=KEdit
+Name[af]=Kredigeer
+Name[eo]=Redaktilo
+Name[hr]=Uređivač
+Name[lv]=KRediģēt
+Name[pl]=Edytor
+Name[sv]=Kedit
+Name[th]=แก้ไขข้อความ
+Name[ven]=U sengulusa ha K
+Name[xh]=Abahleli Be K
+Name[zh_TW]=KDE 編輯器
+X-KDE-StartupNotify=true
+X-DCOP-ServiceType=Multi
+Categories=Qt;KDE;TextEditor
diff --git a/menu/tests/data/Kfind.desktop b/menu/tests/data/Kfind.desktop
new file mode 100644
index 0000000..8984f18
--- /dev/null
+++ b/menu/tests/data/Kfind.desktop
@@ -0,0 +1,66 @@
+[Desktop Entry]
+Encoding=UTF-8
+Exec=kfind %f
+Icon=kfind
+DocPath=kfind/index.html
+TerminalOptions=
+Path=
+Type=Application
+Terminal=0
+Name=Find Files
+Name[af]=Soek Lêers
+Name[be]=Шукаць файлы
+Name[bg]=Търсене на файлове
+Name[br]=Klask restroù
+Name[bs]=Pronađi datoteke
+Name[ca]=Cerca fitxers
+Name[cs]=Najít soubory
+Name[cy]=Canfod Ffeiliau
+Name[da]=Find filer
+Name[de]=Dateien suchen
+Name[el]=Εύρεση αρχείων
+Name[eo]=Trovu dosierojn
+Name[es]=KFind
+Name[et]=Failide otsimine
+Name[eu]=Fitxategiak Bilatu
+Name[fa]=یافتن پرونده‌ها
+Name[fi]=Etsi tiedostoja
+Name[fr]=Recherche de fichiers
+Name[gl]=Buscar Ficheiros
+Name[he]=חפש קבצים
+Name[hr]=Nađi datoteke
+Name[hu]=Fájlkeresés
+Name[id]=Cari Berkas
+Name[it]=Trova file
+Name[ja]=ファイルを検索
+Name[ko]=파일 찾기
+Name[lo]=ຄົ້ນຫາແຟ້ມ
+Name[lt]=Rasti bylas
+Name[lv]=Meklēt Failus
+Name[mn]=Файл хайх
+Name[mt]=Sib Fajls
+Name[nb]=Finn filer
+Name[nl]=Bestanden zoeken
+Name[nn]=Finn filer
+Name[nso]=Hwetsa Difaele
+Name[oc]=Cerca fiquièrs
+Name[pl]=Znajdź pliki
+Name[pt]=Procurar Ficheiros
+Name[pt_BR]=Encontrar arquivos
+Name[ro]=Caută fişiere
+Name[ru]=Поиск файлов
+Name[sk]=Hľadať súbory
+Name[sl]=Poišči datoteke
+Name[sr]=Pretraga fajlova
+Name[sv]=Hitta filer
+Name[ta]=§¸¡ôÒì ¸ñÎÀ¢Ê
+Name[th]=ค้นหาแฟ้ม
+Name[tr]=Dosyalarda Bul
+Name[uk]=Знайти файли
+Name[ven]=Todani faela
+Name[vi]=Tìm file
+Name[xh]=Fumana Iifayile
+Name[zh_CN]=查找文件
+Name[zh_TW]=尋找檔案
+Name[zu]=Thola Amafayela
+X-KDE-StartupNotify=true
diff --git a/menu/tests/data/apps.directory b/menu/tests/data/apps.directory
new file mode 100644
index 0000000..d54b4bd
--- /dev/null
+++ b/menu/tests/data/apps.directory
@@ -0,0 +1,66 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Apps
+Name[af]=Programme
+Name[ar]=تطبيقات
+Name[az]=Proqram Tə'minatları
+Name[be]=Дастасаваньні
+Name[bg]=Приложения
+Name[br]=Arloadoù
+Name[bs]=Aplikacije
+Name[ca]=Aplicacions
+Name[cs]=Aplikace
+Name[da]=Øvrige programmer
+Name[de]=Programme
+Name[el]=Εφαρμογές
+Name[eo]=Aplikaĵoj
+Name[es]=Aplicaciones
+Name[et]=Rakendused
+Name[eu]=Aplikazioak
+Name[fa]=برنامه‌های کاربردی
+Name[fi]=Sovellukset
+Name[fo]=Nýtsluskipanir
+Name[gl]=Aplicacións
+Name[he]=יישומים
+Name[hr]=Programi
+Name[hu]=Alkalmazások
+Name[id]=Aplikasi
+Name[is]=Forrit
+Name[it]=Applicazioni
+Name[ja]=アプリケーション
+Name[ko]=응용 프로그램
+Name[lo]=ອັບພລິກເຄເຊິນ
+Name[lt]=Programos
+Name[lv]=Aplikācijas
+Name[mk]=Апликации
+Name[mt]=Applikazzjonijiet
+Name[nb]=Programmer
+Name[nl]=Programma's
+Name[nn]=Program
+Name[nso]=Ditshomiso
+Name[oc]=Aplicacions
+Name[pl]=Aplikacje
+Name[pt]=Aplicações
+Name[pt_BR]=Aplicativos
+Name[ro]=Aplicaţii
+Name[ru]=Приложения
+Name[se]=Prográmmat
+Name[sk]=Aplikácie
+Name[sl]=Uporabniški programi
+Name[sr]=Aplikacije
+Name[ss]=Ticelo
+Name[sv]=Program
+Name[ta]=ÀÂýÀ¡Î¸û
+Name[th]=แอพพลิเคชัน
+Name[tr]=Uygulamalar
+Name[uk]=Програми
+Name[ven]=Apulikhesheni
+Name[vi]=Chương trình
+Name[wa]=Programes
+Name[xh]=Izicelo
+Name[zh_CN]=应用程序
+Name[zh_TW]=應用程式
+Name[zu]=Abayaleli
+Type=Directory
+Icon=package_applications
+
diff --git a/menu/tests/data/freecell.desktop b/menu/tests/data/freecell.desktop
new file mode 100644
index 0000000..da6d251
--- /dev/null
+++ b/menu/tests/data/freecell.desktop
@@ -0,0 +1,83 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=FreeCell
+Name[be]=Вольная ячэя
+Name[bg]=Свободна Клетка
+Name[bn]=ফ্রীসেল
+Name[ca]=FreeCell
+Name[cs]=FreeCell
+Name[da]=Napoleon
+Name[de]=FreeCell
+Name[el]=FreeCell
+Name[es]=FreeCell
+Name[et]=Freecell
+Name[fi]=Vapaakenttä
+Name[fr]=Freecell
+Name[ga]=FreeCell
+Name[gl]=FreeCell
+Name[he]=פריסל
+Name[hu]=FreeCell
+Name[it]=FreeCell
+Name[ja]=フリーセル
+Name[ko]=프리셀
+Name[lt]=FreeCell
+Name[lv]=FreeCell
+Name[mn]=Фриселл
+Name[ms]=FreeCell
+Name[nl]=FreeCell
+Name[no]=Freecell
+Name[pl]=FreeCell
+Name[pt]=Freecell
+Name[pt_BR]=FreeCell
+Name[ru]=Фриселл
+Name[sk]=FreeCell
+Name[sl]=FreeCell
+Name[sv]=Napoleon på S:t Helena
+Name[tr]=İskambil falı
+Name[uk]=Вільна комірка
+Name[vi]=FreeCell
+Name[wa]=Freecell
+Name[zh_CN]=空当接龙
+Name[zh_TW]=Freecell
+Comment=FreeCell game
+Comment[be]=Гульня ў Вольную ячэю
+Comment[bg]=игра Свободна Клетка
+Comment[bn]=ফ্রীসেল খেলা
+Comment[ca]=Joc del FreeCell
+Comment[cs]=Hra FreeCell
+Comment[da]=Kortspillet Napoleon
+Comment[de]=FreeCell-Spiel
+Comment[el]=Το παιχνίδι FreeCell
+Comment[es]=Juego FreeCell
+Comment[et]=Kaardimäng FreeCell
+Comment[fi]=Vapaakenttä-peli
+Comment[fr]=Jeu de cartes Freecell
+Comment[he]=משחק פריסל
+Comment[hu]=FreeCell játék
+Comment[it]=FreeCell
+Comment[ja]=フリーセルの GNOME 版
+Comment[lv]=FreeCell spēle
+Comment[mn]=GNOME Фриселл тоглоом
+Comment[ms]=Permainan FreeCell
+Comment[nl]=FreeCell Spel
+Comment[no]=Spillet FreeCell
+Comment[pl]=Gra FreeCell
+Comment[pt]=Jogo FreeCell
+Comment[pt_BR]=Jogo de FreeCell
+Comment[ru]=Пасьянс "Ячейка"
+Comment[sk]=Hra FreeCell
+Comment[sl]=Igra Freecell
+Comment[sv]=Spelet Napoleon på S:t Helena
+Comment[tr]=İskambil falı oyunu
+Comment[uk]=Гра "Вільна комірка"
+Comment[vi]=Trò chơi FreeCell
+Comment[zh_TW]=Freecell 紙牌接龍遊戲
+Exec=freecell
+Icon=gnome-cardgame.png
+Terminal=false
+Type=Application
+Categories=GNOME;Application;Game;CardGame;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-games
+X-GNOME-Bugzilla-Component=freecell
+StartupNotify=true
diff --git a/menu/tests/data/gataxx.desktop b/menu/tests/data/gataxx.desktop
new file mode 100644
index 0000000..10dfec6
--- /dev/null
+++ b/menu/tests/data/gataxx.desktop
@@ -0,0 +1,81 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=gataxx.png
+Name=Gataxx
+Name[am]=Gataxx
+Name[be]=Gataxx
+Name[bg]=Гатаксс
+Name[bn]=জীঅ্যাটাক্স
+Name[ca]=Gataxx
+Name[cs]=Gataxx
+Name[da]=Ataxx
+Name[de]=Gataxx
+Name[el]=Gataxx
+Name[es]=Gataxx
+Name[et]=Gataxx
+Name[fi]=Gataxx
+Name[fr]=Gataxx
+Name[he]=Gataxx
+Name[hu]=Gataxx
+Name[it]=Gataxx
+Name[ja]=Gataxx
+Name[ko]=Gataxx
+Name[lv]=Gataxx
+Name[mn]=Gataxx
+Name[ms]=Gataxx
+Name[nl]=Gataxx
+Name[no]=Gataxx
+Name[pl]=Gataxx
+Name[pt]=Gataxx
+Name[pt_BR]=Gataxx
+Name[ru]=Gataxx
+Name[sk]=Gataxx
+Name[sl]=Gataxx
+Name[sv]=Gataxx
+Name[tr]=Gataxx
+Name[uk]=Атаки
+Name[vi]=Gataxx
+Name[wa]=Gataxx
+Name[zh_CN]=Gataxx
+Name[zh_TW]=Gataxx
+Comment=Ataxx game
+Comment[be]=Гульня Ataxx
+Comment[bg]=Игра атаксс
+Comment[bn]=অ্যাটাক্স খেলা
+Comment[ca]=Joc del Ataxx
+Comment[cs]=Hra Ataxx
+Comment[da]=Spillet Ataxx
+Comment[de]=Ataxx-Spiel
+Comment[el]=Παιχνίδι Ataxx
+Comment[es]=Un juego tipo Ataxx.
+Comment[et]=Mäng nimega ataxx
+Comment[fi]=Ataxx-peli
+Comment[fr]=Jeu Ataxx
+Comment[he]=משחק Ataxx
+Comment[hu]=Ataxx játék
+Comment[it]=Gioco Ataxx
+Comment[ja]=Ataxx ゲーム
+Comment[lv]=Ataxx spēle
+Comment[mn]=Ataxx тоглоом.
+Comment[ms]=Permainan Ataxx
+Comment[nl]=Ataxx
+Comment[no]=Ataxx-spill
+Comment[pl]=Gra Ataxx
+Comment[pt]=Jogo Ataxx
+Comment[pt_BR]=Jogo Ataxx
+Comment[ru]=Игра ataxx
+Comment[sk]=Hra Ataxx
+Comment[sl]=Igra Ataxx
+Comment[sv]=Spelet Ataxx
+Comment[tr]=Ataxx oyunu
+Comment[uk]=Гра "Атаки"
+Comment[vi]=Trò chơi Ataxx.
+Comment[zh_TW]=Ataxx 遊戲
+Exec=gataxx
+Terminal=false
+Type=Application
+Categories=GNOME;Application;Game;BoardGame;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-games
+X-GNOME-Bugzilla-Component=gataxx
+StartupNotify=true
diff --git a/menu/tests/data/gideon-legacy.desktop b/menu/tests/data/gideon-legacy.desktop
new file mode 100644
index 0000000..4595087
--- /dev/null
+++ b/menu/tests/data/gideon-legacy.desktop
@@ -0,0 +1,12 @@
+[KDE Desktop Entry]
+Encoding=UTF-8
+BinaryPattern=kdevelop;
+Type=Application
+Exec=gideon %u
+MimeType=application/x-kdevelop;
+Icon=gideon
+DocPath=kdevelop/index.html
+Terminal=0
+Name=KDevelop 3.0
+Comment=IDE for C++/Qt/KDE
+X-DCOP-ServiceType=Multi
diff --git a/menu/tests/data/gideon.desktop b/menu/tests/data/gideon.desktop
new file mode 100644
index 0000000..1e11dc1
--- /dev/null
+++ b/menu/tests/data/gideon.desktop
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Encoding=UTF-8
+BinaryPattern=kdevelop;
+Type=Application
+Exec=gideon %u
+MimeType=application/x-kdevelop;
+Icon=gideon
+DocPath=kdevelop/index.html
+Terminal=0
+Name=KDevelop 3.0
+Comment=IDE for C++/Qt/KDE
+X-DCOP-ServiceType=Multi
+Categories=Qt;KDE;Development
diff --git a/menu/tests/data/glines-2.desktop b/menu/tests/data/glines-2.desktop
new file mode 100644
index 0000000..266747d
--- /dev/null
+++ b/menu/tests/data/glines-2.desktop
@@ -0,0 +1,83 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Glines
+Name[be]=Glines
+Name[bg]=ГЛинии
+Name[bn]=জীলাইন্‌স
+Name[ca]=Glines
+Name[cs]=Glines
+Name[da]=Linjer
+Name[de]=Glines
+Name[el]=Glines
+Name[es]=Glines
+Name[et]=Glines
+Name[eu]=Glines
+Name[fi]=Glines
+Name[fr]=Glines
+Name[he]=Glines
+Name[hu]=Glines
+Name[it]=Glines
+Name[ja]=Glines
+Name[ko]=Glines
+Name[lt]=Glines
+Name[lv]=Glines
+Name[mn]=Glines
+Name[ms]=Glines
+Name[nl]=GLines
+Name[no]=Glines
+Name[pl]=Glines
+Name[pt]=GLinhas
+Name[pt_BR]=Glines
+Name[ro]=Glines
+Name[ru]=Glines
+Name[sk]=GČiary
+Name[sl]=Glines
+Name[sv]=Glinjer
+Name[tr]=Sıradaki toplar
+Name[uk]=Ряди
+Name[vi]=Glines
+Name[wa]=GRoyes
+Name[zh_CN]=Glines
+Name[zh_TW]=Glines
+Comment=Color lines game
+Comment[be]=Гульня "Каляровыя лініі"
+Comment[bg]=Игра Цветни линии
+Comment[bn]=কালার লাইন্‌স খেলা
+Comment[ca]=Joc de línies de color
+Comment[cs]=Hra Barevné linie
+Comment[da]=Farvede linjer-spil
+Comment[de]=Farblinienspiel
+Comment[el]=Παιχνίδι γραμμών χρώματος
+Comment[es]=Juego del tipo líneas de colores.
+Comment[fi]=Väriviivapeli
+Comment[fr]=Jeu de lignes colorées
+Comment[he]=משחק שורות צבעוניות
+Comment[hu]=Color lines játék
+Comment[it]=Gioco Color Lines
+Comment[ja]=カラーラインのゲーム
+Comment[lv]=Krāsu līniju spēle
+Comment[mn]=Өнгөт бөмбөлөг тоглоом
+Comment[ms]=Permainan garisan warna
+Comment[nl]=Kleurlijnen
+Comment[no]=Spill med fargelinjer
+Comment[pl]=Gra w kolorowe linie
+Comment[pt]=Jogo das linhas coloridas
+Comment[pt_BR]=Jogo de linhas coloridas
+Comment[ru]=Игра "Цветные линии"
+Comment[sk]=Hra Farebné čiary
+Comment[sl]=Igra barvnih črt
+Comment[sv]=Färglinjespel
+Comment[tr]=Color lines oyunu
+Comment[uk]=Гра "Кольорові ряди"
+Comment[vi]=Trò chơi ColorLines
+Comment[zh_TW]=Color lines 遊戲
+Exec=glines
+Icon=glines.png
+Terminal=false
+Type=Application
+Categories=GNOME;Application;Game;PuzzleGame;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-games
+X-GNOME-Bugzilla-Component=glines
+StartupNotify=true
+NoDisplay=true
diff --git a/menu/tests/data/glines.desktop b/menu/tests/data/glines.desktop
new file mode 100644
index 0000000..5e5b465
--- /dev/null
+++ b/menu/tests/data/glines.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Glines
+Name[be]=Glines
+Name[bg]=ГЛинии
+Name[bn]=জীলাইন্‌স
+Name[ca]=Glines
+Name[cs]=Glines
+Name[da]=Linjer
+Name[de]=Glines
+Name[el]=Glines
+Name[es]=Glines
+Name[et]=Glines
+Name[eu]=Glines
+Name[fi]=Glines
+Name[fr]=Glines
+Name[he]=Glines
+Name[hu]=Glines
+Name[it]=Glines
+Name[ja]=Glines
+Name[ko]=Glines
+Name[lt]=Glines
+Name[lv]=Glines
+Name[mn]=Glines
+Name[ms]=Glines
+Name[nl]=GLines
+Name[no]=Glines
+Name[pl]=Glines
+Name[pt]=GLinhas
+Name[pt_BR]=Glines
+Name[ro]=Glines
+Name[ru]=Glines
+Name[sk]=GČiary
+Name[sl]=Glines
+Name[sv]=Glinjer
+Name[tr]=Sıradaki toplar
+Name[uk]=Ряди
+Name[vi]=Glines
+Name[wa]=GRoyes
+Name[zh_CN]=Glines
+Name[zh_TW]=Glines
+Comment=Color lines game
+Comment[be]=Гульня "Каляровыя лініі"
+Comment[bg]=Игра Цветни линии
+Comment[bn]=কালার লাইন্‌স খেলা
+Comment[ca]=Joc de línies de color
+Comment[cs]=Hra Barevné linie
+Comment[da]=Farvede linjer-spil
+Comment[de]=Farblinienspiel
+Comment[el]=Παιχνίδι γραμμών χρώματος
+Comment[es]=Juego del tipo líneas de colores.
+Comment[fi]=Väriviivapeli
+Comment[fr]=Jeu de lignes colorées
+Comment[he]=משחק שורות צבעוניות
+Comment[hu]=Color lines játék
+Comment[it]=Gioco Color Lines
+Comment[ja]=カラーラインのゲーム
+Comment[lv]=Krāsu līniju spēle
+Comment[mn]=Өнгөт бөмбөлөг тоглоом
+Comment[ms]=Permainan garisan warna
+Comment[nl]=Kleurlijnen
+Comment[no]=Spill med fargelinjer
+Comment[pl]=Gra w kolorowe linie
+Comment[pt]=Jogo das linhas coloridas
+Comment[pt_BR]=Jogo de linhas coloridas
+Comment[ru]=Игра "Цветные линии"
+Comment[sk]=Hra Farebné čiary
+Comment[sl]=Igra barvnih črt
+Comment[sv]=Färglinjespel
+Comment[tr]=Color lines oyunu
+Comment[uk]=Гра "Кольорові ряди"
+Comment[vi]=Trò chơi ColorLines
+Comment[zh_TW]=Color lines 遊戲
+Exec=glines
+Icon=glines.png
+Terminal=false
+Type=Application
+Categories=GNOME;Application;Game;PuzzleGame;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-games
+X-GNOME-Bugzilla-Component=glines
+StartupNotify=true
diff --git a/menu/tests/data/hidden.desktop b/menu/tests/data/hidden.desktop
new file mode 100644
index 0000000..dbbbff9
--- /dev/null
+++ b/menu/tests/data/hidden.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Hidden
+Comment=You shouldn't see this
+Exec=hidden
+Type=Application
+Categories=GNOME;Application;TextEditor;
+NoDisplay=true
diff --git a/menu/tests/data/hidden.directory b/menu/tests/data/hidden.directory
new file mode 100644
index 0000000..5f1e776
--- /dev/null
+++ b/menu/tests/data/hidden.directory
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Hidden
+Type=Directory
+NoDisplay=true
diff --git a/menu/tests/data/kate.desktop b/menu/tests/data/kate.desktop
new file mode 100644
index 0000000..3ca1c5d
--- /dev/null
+++ b/menu/tests/data/kate.desktop
@@ -0,0 +1,30 @@
+[Desktop Entry]
+Encoding=UTF-8
+GenericName=Advanced Text Editor
+GenericName[cy]=Golygydd Testun Uwch
+GenericName[da]= Avanceret teksteditor
+GenericName[el]=Προχωρημένος διορθωτής κειμένου
+GenericName[es]=Editor de texto avanzado
+GenericName[fa]=ویرایشگر متن پیشرفته
+GenericName[hu]=szövegszerkesztő
+GenericName[pt_BR]=Editor de Texto Avançado
+GenericName[sr]=Napredni editor teksta
+GenericName[sv]=Avancerad texteditor
+BinaryPattern=
+Name=Kate
+Name[ar]=كيت
+Name[bg]=Редактор Kate
+Name[eo]=Kodredaktilo
+Name[fa]=کِیت
+Name[ko]=카테
+Name[ru]=Редактор Kate
+MimeType=text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;text/rdf;
+Exec=kate %u
+TerminalOptions=
+Icon=kate
+Path=
+DocPath=kate/index.html
+Type=Application
+Terminal=0
+X-DCOP-ServiceType=Multi
+Categories=Qt;KDE;TextEditor
diff --git a/menu/tests/data/kbabel.desktop b/menu/tests/data/kbabel.desktop
new file mode 100644
index 0000000..2892cb8
--- /dev/null
+++ b/menu/tests/data/kbabel.desktop
@@ -0,0 +1,69 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=KBabel
+Name[af]=Kbabel
+Name[ar]=المترجم
+Name[eo]=Babelo-tradukilo
+Name[ko]=K바벨
+Name[pt_BR]=Editor de POTFiles
+Name[sv]=Kbabel
+Name[xx]=xxKBabelxx
+Exec=kbabel %i %m -caption "%c" %U
+Icon=kbabel
+MiniIcon=kbabel
+Type=Application
+DocPath=kbabel/index.html
+MimeType=application/x-gettext;
+GenericName=Translation Tool
+GenericName[af]=Vertaling Program
+GenericName[ar]=أداة الترجمة
+GenericName[bg]=Инструменти за Превод
+GenericName[bs]=Alat za prevođenje
+GenericName[ca]=Eina de traducció
+GenericName[cs]=Překladatelský nástroj
+GenericName[cy]=Erfyn Cyfieithu
+GenericName[da]=Oversættelsesværktøj
+GenericName[de]=Übersetzungsprogramm
+GenericName[el]=Εργαλείο μετάφρασης
+GenericName[eo]=Tradukilo por Qt-programoj
+GenericName[es]=Herramienta de traducción
+GenericName[et]=Tõlkimise rakendus
+GenericName[eu]=Itzulpenerako Tresnak
+GenericName[fi]=Käännöstyökalu
+GenericName[fo]=Umsetingaramboð
+GenericName[fr]=Outil de traduction
+GenericName[he]=כלי תרגום
+GenericName[hr]=Uslužni program za prevođenje
+GenericName[hu]=segédprogram fordítóknak
+GenericName[it]=Strumento per le traduzioni
+GenericName[ja]=翻訳ツール
+GenericName[lt]=Vertimo įrankis
+GenericName[lv]=Tulkošanas Rīks
+GenericName[mt]=Għodda tat-traduzzjoni
+GenericName[nb]=Oversettingsverktøy
+GenericName[nl]=vertaalprogramma
+GenericName[nn]=Omsetjingsverktøy
+GenericName[nso]=Sebereka sa Thlathollo
+GenericName[pl]=Narzędzie dla tłumaczy
+GenericName[pt]=Ferramenta de Tradução
+GenericName[pt_BR]=Ferramenta de Tradução
+GenericName[ro]=Utilitar de traducere
+GenericName[ru]=Утилита локализации приложений
+GenericName[sk]=Prekladací nástroj
+GenericName[sl]=Orodje za prevajanje
+GenericName[sv]=Översättningsverktyg
+GenericName[ta]=¦Á¡Æ¢¦ÀÂ÷ôÒì ¸ÕÅ¢
+GenericName[th]=เครื่องมือแปลภาษา
+GenericName[tr]=Çeviri Aracı
+GenericName[uk]=Засіб для перекладів
+GenericName[ven]=Zwishumiswa zwau Dologa
+GenericName[vi]=Công cụ dịch
+GenericName[xh]=Isixhobo Soguqulelo lomsebenzi kolunye ulwimi
+GenericName[xx]=xxTranslation Toolxx
+GenericName[zh_CN]=翻译工具
+GenericName[zh_TW]=翻譯工具
+GenericName[zu]=Ithuluzi Lokuguqulela
+Terminal=0
+X-KDE-StartupNotify=true
+X-DCOP-ServiceType=Unique
+Categories=Qt;KDE;Development
diff --git a/menu/tests/data/kedit-legacy.desktop b/menu/tests/data/kedit-legacy.desktop
new file mode 100644
index 0000000..fa9700e
--- /dev/null
+++ b/menu/tests/data/kedit-legacy.desktop
@@ -0,0 +1,33 @@
+[Desktop Entry]
+Encoding=UTF-8
+BinaryPattern=kedit;
+MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
+GenericName=Simple Text Editor
+GenericName[ca]=Editor de text
+GenericName[cs]=Jednoduchý textový editor
+GenericName[da]=Simpel teksteditor
+GenericName[es]=Editor de texto sencillo
+GenericName[fr]=Éditeur de texte élémentaire
+GenericName[pt_BR]=Editor de Texto Simples
+GenericName[sv]=Enkel texteditor
+GenericName[wa]=Simpe aspougneu di tecse
+Exec=kedit -caption "%c" %i %m %u
+Icon=kedit
+TerminalOptions=
+Path=
+DocPath=kedit/index.html
+Type=Application
+Terminal=0
+Name=KEdit
+Name[af]=Kredigeer
+Name[eo]=Redaktilo
+Name[hr]=Uređivač
+Name[lv]=KRediģēt
+Name[pl]=Edytor
+Name[sv]=Kedit
+Name[th]=แก้ไขข้อความ
+Name[ven]=U sengulusa ha K
+Name[xh]=Abahleli Be K
+Name[zh_TW]=KDE 編輯器
+X-KDE-StartupNotify=true
+X-DCOP-ServiceType=Multi
diff --git a/menu/tests/data/kwrite.desktop b/menu/tests/data/kwrite.desktop
new file mode 100644
index 0000000..9804fa6
--- /dev/null
+++ b/menu/tests/data/kwrite.desktop
@@ -0,0 +1,84 @@
+[Desktop Entry]
+Encoding=UTF-8
+GenericName=Text Editor
+GenericName[af]=Teks Redigeerder
+GenericName[ar]=محرر نصوص
+GenericName[be]=Тэкставы рэдактар
+GenericName[bg]=Текстов Редактор
+GenericName[bs]=Tekst editor
+GenericName[ca]=Editor de text
+GenericName[cs]=Textový editor
+GenericName[cy]=Golygydd Testun
+GenericName[da]= Teksteditor
+GenericName[de]=Texteditor
+GenericName[el]=Διορθωτής Κειμένου
+GenericName[eo]=Tekstredaktilo
+GenericName[es]=Editor de texto
+GenericName[et]=Tekstiredaktor
+GenericName[eu]=Testu Editorea
+GenericName[fa]=ویرایشگر متن
+GenericName[fi]=Tekstieditori
+GenericName[fo]=Tekstritil
+GenericName[fr]=Éditeur de texte
+GenericName[he]=עורך טקסט
+GenericName[hr]=Uređivač teksta
+GenericName[hu]=szövegszerkesztő
+GenericName[is]=Textaritill
+GenericName[it]=Editor di testi
+GenericName[ja]=テキストエディタ
+GenericName[ko]=글월 편집기
+GenericName[lo]=ເຄື່ອງມືແກ້ໄຂຂໍ້ຄວາມ
+GenericName[lt]=Teksto redaktorius
+GenericName[lv]=Teksta Redaktors
+GenericName[mn]=Текст боловсруулагч
+GenericName[mt]=Editur tat-test
+GenericName[nb]=Skriveprogram
+GenericName[nl]=teksteditor
+GenericName[nn]=Skriveprogram
+GenericName[nso]=Mofetosi wa Sengwalwana
+GenericName[pl]=Edytor tekstowy
+GenericName[pt]=Editor de Texto
+GenericName[pt_BR]=Editor de Texto
+GenericName[ro]=Editor de text
+GenericName[ru]=Текстовый редактор
+GenericName[sk]=Textový editor
+GenericName[sl]=Urejevalnik besedil
+GenericName[sr]=Editor teksta
+GenericName[ss]=Sihleli sembhalo
+GenericName[sv]=Texteditor
+GenericName[ta]=¯¨Ã ¦¾¡ÌôÀ¡Ç÷
+GenericName[th]=เครื่องมือแก้ไขข้อความ
+GenericName[tr]=Metin Düzenleyici
+GenericName[uk]=Редактор текстів
+GenericName[ven]=Musengulusi wa Manwalwa
+GenericName[vi]=Trình soạn văn bản
+GenericName[wa]=Aspougneu di tecse
+GenericName[xh]=Umhleli Wombhalo
+GenericName[zh_CN]=文本编辑器
+GenericName[zh_TW]=文字編輯器
+GenericName[zu]=Umlungisi wombhalo
+BinaryPattern=
+Name=KWrite
+Name[af]=Kskryf
+Name[ar]=كاتب كيدي
+Name[eo]=Simpla kodredaktilo
+Name[fa]=نوشتار K
+Name[fo]=KSkriva
+Name[lo]=Kwrite
+Name[lv]=KRakstīt
+Name[nso]=KNgwala
+Name[ru]=Редактор KWrite
+Name[sv]=Kwrite
+Name[ven]=Nwala ha K
+MimeType=text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;text/x-diff;text/rdf;
+Exec=kwrite %u
+X-KDE-StartupNotify=true
+TerminalOptions=
+Icon=kwrite
+Path=
+DocPath=kwrite/index.html
+Type=Application
+Terminal=0
+InitialPreference=8
+X-DCOP-ServiceType=Multi
+Categories=Qt;KDE;TextEditor
diff --git a/menu/tests/data/mahjongg-2.desktop b/menu/tests/data/mahjongg-2.desktop
new file mode 100644
index 0000000..95cfe27
--- /dev/null
+++ b/menu/tests/data/mahjongg-2.desktop
@@ -0,0 +1,86 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Mahjongg
+Name[am]=ማህጆንግ
+Name[be]=Маджонг
+Name[bg]=Махджонг
+Name[bn]=মাহজং
+Name[ca]=Mahjongg
+Name[cs]=Mahjongg
+Name[da]=Mahjongg
+Name[de]=Mahjongg
+Name[el]=Mahjongg
+Name[es]=Mahjongg
+Name[et]=Mahjongg
+Name[fa]=ماهجونگ
+Name[fi]=Mahjongg
+Name[fr]=Mahjongg
+Name[gl]=Mahjongg
+Name[he]=Mahjongg
+Name[hu]=Mahjongg
+Name[it]=Mahjongg
+Name[ja]=GNOME 上海
+Name[ko]=그놈 마작
+Name[lt]=Mahjongg
+Name[lv]=Mahjongg
+Name[mn]=Маджонг
+Name[ms]=Mahjongg
+Name[nl]=Mahjongg
+Name[no]=Mahjongg
+Name[pl]=Mahjongg
+Name[pt]=Mahjongg
+Name[pt_BR]=Mahjongg
+Name[ru]=Маджонг
+Name[sk]=Mahjongg
+Name[sl]=Mahjongg
+Name[sv]=Mah Jong
+Name[tr]=Mahjongg
+Name[uk]=Магджонґ
+Name[vi]=Mahjongg
+Name[wa]=Mahjongg
+Name[zh_CN]=堆麻将
+Name[zh_TW]=上海麻將
+Comment=Mahjongg game
+Comment[am]=የማህጆንግ ጨዋታ
+Comment[be]=Гульня Маджонг
+Comment[bg]=Игра на Махджонг
+Comment[bn]=মাহজং খেলা
+Comment[ca]=Joc del Mahjongg
+Comment[cs]=Hra Mahjongg
+Comment[da]=Mahjonggspil
+Comment[de]=Mahjongg-Spiel
+Comment[el]=Παιχνίδι Mahjongg
+Comment[es]=Juego Mahjongg
+Comment[et]=Mäng nimega mahjongg
+Comment[fa]=بازی ماهجونگ
+Comment[fi]=Mahjongg-peli
+Comment[fr]=Jeu de Mahjongg
+Comment[he]=משחק Mahjongg
+Comment[hu]=Mahjongg játék
+Comment[it]=Gioco Mahjongg
+Comment[ja]=麻雀ゲーム
+Comment[lv]=Mahjongg spēle
+Comment[mn]=Mahjongg тоглоом
+Comment[ms]=Permainan Mahjongg
+Comment[nl]=Mahjongg
+Comment[no]=Mahjongg-spill
+Comment[pl]=Gra Mahjongg
+Comment[pt]=Jogo Mahjongg
+Comment[pt_BR]=Jogo Mahjongg
+Comment[ru]=Игра Маджонг
+Comment[sk]=Hra Mahjongg
+Comment[sl]=Igra Mahjongg
+Comment[sv]=Mah Jong-spel
+Comment[tr]=Mahjongg oyunu
+Comment[uk]=Гра "Магджонґ"
+Comment[vi]=Trò chơi Mahjongg
+Comment[zh_TW]=上海麻將遊戲
+Exec=mahjongg
+Icon=gnome-mahjongg.png
+Terminal=false
+Type=Application
+Categories=GNOME;Application;Development;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-games
+X-GNOME-Bugzilla-Component=mahjongg
+StartupNotify=true
diff --git a/menu/tests/data/mahjongg.desktop b/menu/tests/data/mahjongg.desktop
new file mode 100644
index 0000000..0d5f5de
--- /dev/null
+++ b/menu/tests/data/mahjongg.desktop
@@ -0,0 +1,86 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Mahjongg
+Name[am]=ማህጆንግ
+Name[be]=Маджонг
+Name[bg]=Махджонг
+Name[bn]=মাহজং
+Name[ca]=Mahjongg
+Name[cs]=Mahjongg
+Name[da]=Mahjongg
+Name[de]=Mahjongg
+Name[el]=Mahjongg
+Name[es]=Mahjongg
+Name[et]=Mahjongg
+Name[fa]=ماهجونگ
+Name[fi]=Mahjongg
+Name[fr]=Mahjongg
+Name[gl]=Mahjongg
+Name[he]=Mahjongg
+Name[hu]=Mahjongg
+Name[it]=Mahjongg
+Name[ja]=GNOME 上海
+Name[ko]=그놈 마작
+Name[lt]=Mahjongg
+Name[lv]=Mahjongg
+Name[mn]=Маджонг
+Name[ms]=Mahjongg
+Name[nl]=Mahjongg
+Name[no]=Mahjongg
+Name[pl]=Mahjongg
+Name[pt]=Mahjongg
+Name[pt_BR]=Mahjongg
+Name[ru]=Маджонг
+Name[sk]=Mahjongg
+Name[sl]=Mahjongg
+Name[sv]=Mah Jong
+Name[tr]=Mahjongg
+Name[uk]=Магджонґ
+Name[vi]=Mahjongg
+Name[wa]=Mahjongg
+Name[zh_CN]=堆麻将
+Name[zh_TW]=上海麻將
+Comment=Mahjongg game
+Comment[am]=የማህጆንግ ጨዋታ
+Comment[be]=Гульня Маджонг
+Comment[bg]=Игра на Махджонг
+Comment[bn]=মাহজং খেলা
+Comment[ca]=Joc del Mahjongg
+Comment[cs]=Hra Mahjongg
+Comment[da]=Mahjonggspil
+Comment[de]=Mahjongg-Spiel
+Comment[el]=Παιχνίδι Mahjongg
+Comment[es]=Juego Mahjongg
+Comment[et]=Mäng nimega mahjongg
+Comment[fa]=بازی ماهجونگ
+Comment[fi]=Mahjongg-peli
+Comment[fr]=Jeu de Mahjongg
+Comment[he]=משחק Mahjongg
+Comment[hu]=Mahjongg játék
+Comment[it]=Gioco Mahjongg
+Comment[ja]=麻雀ゲーム
+Comment[lv]=Mahjongg spēle
+Comment[mn]=Mahjongg тоглоом
+Comment[ms]=Permainan Mahjongg
+Comment[nl]=Mahjongg
+Comment[no]=Mahjongg-spill
+Comment[pl]=Gra Mahjongg
+Comment[pt]=Jogo Mahjongg
+Comment[pt_BR]=Jogo Mahjongg
+Comment[ru]=Игра Маджонг
+Comment[sk]=Hra Mahjongg
+Comment[sl]=Igra Mahjongg
+Comment[sv]=Mah Jong-spel
+Comment[tr]=Mahjongg oyunu
+Comment[uk]=Гра "Магджонґ"
+Comment[vi]=Trò chơi Mahjongg
+Comment[zh_TW]=上海麻將遊戲
+Exec=mahjongg
+Icon=gnome-mahjongg.png
+Terminal=false
+Type=Application
+Categories=GNOME;Application;Game;BoardGame;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-games
+X-GNOME-Bugzilla-Component=mahjongg
+StartupNotify=true
diff --git a/menu/tests/data/quanta.desktop b/menu/tests/data/quanta.desktop
new file mode 100644
index 0000000..4b23aef
--- /dev/null
+++ b/menu/tests/data/quanta.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Quanta Plus
+Exec=quanta
+Icon=quanta
+Type=Application
+MimeType=text/html
+DocPath=quanta/index.html
+Comment=Web Development Environment
+Categories=Qt;KDE;Development
diff --git a/menu/tests/expand b/menu/tests/expand
new file mode 100755
index 0000000..5dbaac8
--- /dev/null
+++ b/menu/tests/expand
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+
+# This script performs expansion of environment variables of the form ${HOME}
+
+while(<>)
+{
+ while (($a) = ($_ =~ /[^\$]*\$\{([^\}]*)\}.*/))
+ {
+ s/([^\$]*)(\$\{$a\})(.*)/$1$ENV{$a}$3/;
+ }
+ printf $_;
+} \ No newline at end of file
diff --git a/menu/tests/menutest b/menu/tests/menutest
new file mode 100755
index 0000000..9d37246
--- /dev/null
+++ b/menu/tests/menutest
@@ -0,0 +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
+ mkdir -p "${DIR}"
+ for file in $*; do
+ 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"
+ WIPE[${WIPE_IDX}]="${DIR}/${3}"
+ WIPE_IDX=$(( $WIPE_IDX + 1 ))
+}
+
+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"
+}
+
+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/:*}"
+}
+
+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"
+
+ (
+ 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
+
+ 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 [ "$(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
+ )
+}
+
+default_interpret_results() {
+ if [ ! -e "${RESULT}" ]; then
+ echo "!!! Result file (${RESULT}) for ${TEST} missing"
+ echo '>>> Failed'
+ 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
+ echo Using ${MENUTESTDIR} as test directory.
+ fi
+
+ export MENUTESTDIR
+ export USER=${USER:-test}
+
+
+ FAILED=
+ SUCCEEDED=
+
+ 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
+
+ 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/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="<All> Keyword"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <All/>
+ </Include>
+ </Menu>
+</Menu>
+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="<And> Keyword"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <And>
+ <Filename>freecell.desktop</Filename>
+ <Category>Game</Category>
+ </And>
+ </Include>
+ </Menu>
+</Menu>
+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="<AppDir> relative path tag ..."
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <AppDir>apps</AppDir>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+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="<AppDir> 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="<Category> tag"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Editors</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ <!-- note it's lowercase, this is intentional to verify
+ it's a case sensitive implementation -->
+ <Category>application</Category>
+ </Include>
+ </Menu>
+</Menu>
+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="<DefaultMergeDirs> tag ..."
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <DefaultMergeDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</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/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="<Deleted> tag"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>BoardGames</Name>
+ <Include>
+ <Category>BoardGame</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Games</Name>
+ <Include>
+ <Category>Game</Category>
+ </Include>
+ <Deleted/>
+ <NotDeleted/>
+ <Deleted/>
+ </Menu>
+</Menu>
+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 <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>Game</Category>
+ </Include>
+ </Menu>
+</Menu>
+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="<Directory> tag ..."
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Directory>apps.directory</Directory>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+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 <DirectoryDir> tag ..."
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+ <DirectoryDir>${PATH_EXPANSION}desktop-directories</DirectoryDir>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Directory>apps.directory</Directory>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+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="<DirectoryDir> 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="<Exclude> Keyword"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Or>
+ <Filename>freecell.desktop</Filename>
+ <Category>Game</Category>
+ </Or>
+ </Include>
+ <Exclude>
+ <Filename>glines.desktop</Filename>
+ </Exclude>
+ </Menu>
+</Menu>
+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="<Filename> tag"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Filename>freecell.desktop</Filename>
+ </Include>
+ </Menu>
+</Menu>
+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 <LegacyDir>"
+
+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 <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <LegacyDir>${LEGACY_DIR}</LegacyDir>
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+
+ <Menu>
+ <Name>Development</Name>
+ <Exclude>
+ <Filename>gideon-legacy.desktop</Filename>
+ </Exclude>
+ </Menu>
+ <Menu>
+ <Name>Editors</Name>
+ <Include>
+ <Filename>gideon-legacy.desktop</Filename>
+ </Include>
+ </Menu>
+</Menu>
+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 <LegacyDir> 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 <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <LegacyDir>${LEGACY_DIR}</LegacyDir>
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+
+ <Menu>
+ <Name>Editors</Name>
+ <Directory>kde-editors.directory</Directory>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Development</Name>
+ <Directory>kde-development.directory</Directory>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</Menu>
+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 <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+ <LegacyDir>${LEGACY_DIR}</LegacyDir>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Filename>kate.desktop</Filename>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Filename>KEdit.desktop</Filename>
+ </Include>
+ <Deleted/>
+ </Menu>
+ <Menu>
+ <Name>Editors</Name>
+ <Include>
+ <Filename>kwrite.desktop</Filename>
+ </Include>
+ </Menu>
+</Menu>
+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="<MergeDir> 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="<MergeDir> relative path ..."
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p "${XDG_CONFIG_DIR}/menus"
+ ./expand > "${XDG_CONFIG_DIR}/menus/applications.menu" <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <MergeDir>${PATH_EXPANSION}applications-merged</MergeDir>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ mkdir "${XDG_CONFIG_DIR}/menus/applications-merged/"
+ ./expand > "${XDG_CONFIG_DIR}/menus/applications-merged/test.menu" <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ # intentional crap entry to verify it does _not_ get picked up
+ ./expand > "${XDG_CONFIG_DIR}/menus/applications-merged/dar.notmenu" <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>testing</Name>
+ <Include>
+ <All/>
+ </Include>
+ </Menu>
+</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-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="<MergeFile> 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="<MergeFile> tag ..."
+
+test_code() {
+ # Tests the type attribute in <MergeFile>
+
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_HOME}/menus
+ ./expand > ${XDG_CONFIG_HOME}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <MergeFile type="parent">${XDG_CONFIG_DIR}/menus/test.menu</MergeFile>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/test.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Games</Name>
+ <Include>
+ <Category>Game</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</Menu>
+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="<MergeFile> tag ..."
+
+test_code() {
+ # Tests the type attribute in <MergeFile>
+
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_HOME}/menus
+ ./expand > ${XDG_CONFIG_HOME}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <MergeFile type="path">${XDG_CONFIG_DIR}/menus/test.menu</MergeFile>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/test.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Games</Name>
+ <Include>
+ <Category>Game</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</Menu>
+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 <MergeFile>s"
+
+test_code(){
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <MergeFile>applications-merged/test.menu</MergeFile>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <MergeFile>extra/test.menu</MergeFile>
+</Menu>
+EOF
+
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/extra/test.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+
+ <MergeFile>../test.menu</MergeFile>
+</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="<MergeFile> tag relative path"
+
+test_code(){
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <MergeFile>${PATH_EXPANSION}applications-merged/test.menu</MergeFile>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+<!-- test -->
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</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/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="<MergeFile> tag ..."
+
+test_code() {
+ # Tests the use of relative paths in <MergeFile>
+
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <MergeFile>applications-merged/test.menu</MergeFile>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <MergeFile>extra/test.menu</MergeFile>
+</Menu>
+EOF
+
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/extra/test.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</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/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="<MergeFile> tag ..."
+
+test_code() {
+ # Tests the use of relative paths in <MergeFile>
+
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <MergeFile>test.menu</MergeFile>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ ./expand > ${XDG_CONFIG_DIR}/menus/test.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <MergeFile>extra/test.menu</MergeFile>
+</Menu>
+EOF
+
+ mkdir ${XDG_CONFIG_DIR}/menus/extra/
+ ./expand > ${XDG_CONFIG_DIR}/menus/extra/test.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</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/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 <Move> operation"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+ <Move>
+ <Old>Games1</Old>
+ <New>Games</New>
+ </Move>
+
+ <Menu>
+ <Name>Games1</Name>
+ <Menu>
+ <Name>BoardGame</Name>
+ <Include>
+ <Category>BoardGame</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>Games</Name>
+ <Include>
+ <Category>Game</Category>
+ </Include>
+ <OnlyUnallocated/>
+ </Menu>
+</Menu>
+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 <Move> operations ..."
+
+test_code() {
+ # Tests the type attribute in <MergeFile>
+
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <Menu>
+ <Name>Development</Name>
+ <Menu>
+ <Name>Games</Name>
+ <Include>
+ <Category>Game</Category>
+ </Include>
+ </Menu>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+ <Move>
+ <Old>Development/Games-New</Old>
+ <New>Games-Correct</New>
+ </Move>
+ <Move>
+ <Old>Development/Games</Old>
+ <New>Games-Wrong</New>
+ </Move>
+ <Menu>
+ <Name>Development</Name>
+ <Move>
+ <Old>Games</Old>
+ <New>Games-New</New>
+ </Move>
+ </Menu>
+</Menu>
+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 <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Filename>gideon-legacy.desktop</Filename>
+ </Include>
+ </Menu>
+ <Move>
+ <Old>Development</Old>
+ <New>A/B/Development</New>
+ </Move>
+</Menu>
+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 <Move> operation"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+ <Move>
+ <Old>Foo</Old>
+ <New>Bar</New>
+ <Old>BoardGames</Old>
+ <New>Apps</New>
+ <Old>BoardGames</Old>
+ <New>Games</New>
+ </Move>
+
+ <Menu>
+ <Name>BoardGames</Name>
+ <Include>
+ <Category>BoardGame</Category>
+ </Include>
+ </Menu>
+</Menu>
+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 <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+
+ <Menu>
+ <Name>Shouldn't see this</Name>
+ <Directory>hidden.directory</Directory>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+
+ <Menu>
+ <Name>Other</Name>
+ <OnlyUnallocated/>
+ <Include>
+ <All/>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop freecell.desktop hidden.desktop
+ installData ${XDG_DATA_DIR}/desktop-directories hidden.directory
+}
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 <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+
+ <Menu>
+ <Name>Shouldn't see this</Name>
+ <Directory>apps.directory</Directory>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ <Deleted/>
+ </Menu>
+
+ <Menu>
+ <Name>Other</Name>
+ <OnlyUnallocated/>
+ <Include>
+ <All/>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop freecell.desktop hidden.desktop
+ installData ${XDG_DATA_DIR}/desktop-directories 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 <OnlyUnallocated> test"
+
+test_code() {
+ # Tests <OnlyUnallocated>
+
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Filename>kwrite.desktop</Filename>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Editors</Name>
+ <Include>
+ <Filename>kwrite.desktop</Filename>
+ </Include>
+ </Menu>
+</Menu>
+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="<OnlyAllocated> tag"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>BoardGames</Name>
+ <Include>
+ <And>
+ <Category>Game</Category>
+ <Not>
+ <Category>CardGame</Category>
+ </Not>
+ </And>
+ </Include>
+ <Exclude>
+ <Category>PuzzleGame</Category>
+ </Exclude>
+ </Menu>
+ <Menu>
+ <Name>Games</Name>
+ <Include>
+ <Category>Game</Category>
+ </Include>
+ <OnlyUnallocated/>
+ <NotOnlyUnallocated/>
+ <OnlyUnallocated/>
+ </Menu>
+</Menu>
+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="<Or> Keyword"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Or>
+ <Filename>freecell.desktop</Filename>
+ <Category>Game</Category>
+ </Or>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.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="<And><Category>foo</Category><Not><Category>foo</Category></Not></And> shouldn't match anything"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Directory>apps.directory</Directory>
+ <Include>
+ <Or>
+ <Category>TextEditor</Category>
+ <And>
+ <Category>Game</Category>
+ <Not><Category>Game</Category></Not>
+ </And>
+ </Or>
+ </Include>
+ </Menu>
+</Menu>
+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/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 <MergeFile>
+
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <Menu>
+ <Name>Games</Name>
+ <Include>
+ <Category>Game</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</Menu>
+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/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 <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <And>
+ <Category>Game</Category>
+ <Category>BoardGame</Category>
+ </And>
+ <Or>
+ <Category>TextEditor</Category>
+ <Filename>quanta.desktop</Filename>
+ </Or>
+ </Include>
+ <Exclude>
+ <Filename>mahjongg.desktop</Filename>
+ </Exclude>
+ </Menu>
+</Menu>
+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/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/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 <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</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/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
+