diff options
author | Waldo Bastian <waldo.bastian@intel.com> | 2003-08-13 20:32:05 +0000 |
---|---|---|
committer | Waldo Bastian <waldo.bastian@intel.com> | 2003-08-13 20:32:05 +0000 |
commit | cd3f8b4a7987d23c9af7aa6a6b3e37b9ac2b2253 (patch) | |
tree | 0d25009a5bcc85a79d7b21608ca37fcc403db742 /menu/tests | |
parent | 7f2c3443647b8f5a7d17c5b53b157d33794e9c6c (diff) | |
download | xdg-specs-cd3f8b4a7987d23c9af7aa6a6b3e37b9ac2b2253.tar.xz |
First attempt at a testsuit
Diffstat (limited to 'menu/tests')
-rw-r--r-- | menu/tests/README | 39 | ||||
-rw-r--r-- | menu/tests/data/Help.desktop | 68 | ||||
-rw-r--r-- | menu/tests/data/Home.desktop | 127 | ||||
-rw-r--r-- | menu/tests/data/KEdit.desktop | 34 | ||||
-rw-r--r-- | menu/tests/data/Kfind.desktop | 66 | ||||
-rw-r--r-- | menu/tests/data/gideon.desktop | 13 | ||||
-rw-r--r-- | menu/tests/data/kate.desktop | 30 | ||||
-rw-r--r-- | menu/tests/data/kbabel.desktop | 69 | ||||
-rw-r--r-- | menu/tests/data/kwrite.desktop | 84 | ||||
-rw-r--r-- | menu/tests/data/quanta.desktop | 10 | ||||
-rwxr-xr-x | menu/tests/expand | 12 | ||||
-rwxr-xr-x | menu/tests/menutest | 83 | ||||
-rw-r--r-- | menu/tests/result-1 | 9 | ||||
-rw-r--r-- | menu/tests/test-1 | 43 |
14 files changed, 687 insertions, 0 deletions
diff --git a/menu/tests/README b/menu/tests/README new file mode 100644 index 0000000..ba3528d --- /dev/null +++ b/menu/tests/README @@ -0,0 +1,39 @@ +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. + +The menutest script should be used to run the tests. The following commands can +be used: + + MENUTEST=foobar menutest + +to run all tests + + MENUTEST=foobar menutest test-1 + +to run test-1 only + + +All tests contain of a test setup script that starts with "test-" and a file describing +the expected menu that starts with "result-". + 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/gideon.desktop b/menu/tests/data/gideon.desktop new file mode 100644 index 0000000..fe1a1e7 --- /dev/null +++ b/menu/tests/data/gideon.desktop @@ -0,0 +1,13 @@ +[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 +Categories=Qt;KDE;Development 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/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/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..da1319e --- /dev/null +++ b/menu/tests/menutest @@ -0,0 +1,83 @@ +#!/bin/bash + +function installData() +{ + local DIR=$1 + shift 1 + mkdir -p ${DIR} + for file in $*; do + cp data/${file} ${DIR} + done +} + +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 + +TESTS=$* + +if [ "x${TESTS}" == "x" ]; then + TESTS=$(eval echo "test-*[^~]") + if [ "x${TESTS}" == "xtest-*[^~]" ]; then + echo No tests found in ${PWD} + exit 1 + fi +fi + + +for TEST in ${TESTS}; do + rm -rf ${MENUTESTDIR} 2> /dev/null + mkdir ${MENUTESTDIR} + RESULT=$(echo ${TEST}|sed -e 's^test-^result-^') + + if [ ! -e ${RESULT} ]; then + echo 'Result file ('${RESULT}') for '${TEST}' missing' + else + ( + echo Running: ${TEST} + + # Some predefined values + XDG_CONFIG_HOME=${MENUTESTDIR}/xdg_config_home + XDG_DATA_HOME=${MENUTESTDIR}/xdg_data_home + XDG_CONFIG_DIR=${MENUTESTDIR}/xdg_config_dir + XDG_DATA_DIR=${MENUTESTDIR}/xdg_data_dir + XDG_CONFIG_DIRS=$XDG_CONFIG_DIR + XDG_DATA_DIRS=$XDG_DATA_DIR + + export XDG_CONFIG_HOME + export XDG_DATA_HOME + export XDG_CONFIG_DIR + export XDG_DATA_DIR + export XDG_CONFIG_DIRS + export XDG_DATA_DIRS + + . ${TEST} + + $MENUTEST > ${MENUTESTDIR}/result1 2> ${MENUTESTDIR}/log + ./expand ${RESULT} > ${MENUTESTDIR}/result2 + ) + + if diff -q ${MENUTESTDIR}/result1 ${MENUTESTDIR}/result2 > /dev/null; then + echo ${TEST}' OK' + else + sort ${MENUTESTDIR}/result1 > ${MENUTESTDIR}/result1.sorted + sort ${MENUTESTDIR}/result2 > ${MENUTESTDIR}/result2.sorted + if diff -u ${MENUTESTDIR}/result1.sorted ${MENUTESTDIR}/result2.sorted > ${MENUTESTDIR}/result.diff; then + echo ${TEST}' OK (different order)' + else + echo ${TEST}' Failed' + cat ${MENUTESTDIR}/result.diff + fi + fi + fi +done diff --git a/menu/tests/result-1 b/menu/tests/result-1 new file mode 100644 index 0000000..be80965 --- /dev/null +++ b/menu/tests/result-1 @@ -0,0 +1,9 @@ +Development/ gideon.desktop ${LEGACY_DIR}/Development/gideon.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/test-1 b/menu/tests/test-1 new file mode 100644 index 0000000..34bd466 --- /dev/null +++ b/menu/tests/test-1 @@ -0,0 +1,43 @@ +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.desktop kbabel.desktop quanta.desktop + +installData ${LEGACY_DIR} Kfind.desktop Home.desktop Help.desktop + + |