diff options
author | Ted Gould <ted@canonical.com> | 2009-06-25 10:49:00 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-06-25 10:49:00 -0500 |
commit | c16cdb68a985be741418366402abdf0c37c971c2 (patch) | |
tree | 448164d26048db562712de530e985701b8d419f8 | |
parent | 0b3ed894b14a8d8e09b43a2d8aba5eb0d4a28719 (diff) | |
parent | b70b4e535349f6a7bb0caa5c0118eb748eafbc83 (diff) | |
download | libdbusmenu-c16cdb68a985be741418366402abdf0c37c971c2.tar.gz libdbusmenu-c16cdb68a985be741418366402abdf0c37c971c2.tar.bz2 libdbusmenu-c16cdb68a985be741418366402abdf0c37c971c2.zip |
Merging in the updated gtkmenu branch with tests.
23 files changed, 1380 insertions, 0 deletions
@@ -37,3 +37,4 @@ libdbusmenu_gtk_la-menu.lo test-gtk-label-client test-gtk-label-server libdbusmenu_gtk_la-client.lo +dbusmenu.xml diff --git a/configure.ac b/configure.ac index d35e27b..6a5ed9a 100644 --- a/configure.ac +++ b/configure.ac @@ -95,6 +95,7 @@ libdbusmenu-gtk/dbusmenu-gtk.pc libdbusmenu-qt/Makefile libdbusmenu-qt/dbusmenu-qt.pc tests/Makefile +tests/dbusmenu-gtk/Makefile ]) ########################### diff --git a/tests/Makefile.am b/tests/Makefile.am index 2ec6ca7..452f4f6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = dbusmenu-gtk + check: tests DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf diff --git a/tests/dbusmenu-gtk/Makefile.am b/tests/dbusmenu-gtk/Makefile.am new file mode 100644 index 0000000..6acbbe0 --- /dev/null +++ b/tests/dbusmenu-gtk/Makefile.am @@ -0,0 +1,43 @@ + +check: tests + +tests: mago + +mago: dbusmenu.xml dbusmenu.py + PYTHONPATH=$(builddir) mago -f $(builddir)/dbusmenu.xml -t $(builddir)/mago.results + +dbusmenu.xml: dbusmenu.xml.in + sed -e "s|\@srcdir\@|$(srcdir)|" $< > $@ + +dbusmenu.py: dbusmenu.py.in + sed -e "s|\@srcdir\@|$(srcdir)|" $< > $@ + +EXTRA_DIST = \ + dbusmenu.xml.in \ + dbusmenu.py.in \ + dbusMenuTest \ + data/blank_label_2levels.json \ + data/blank_label.json \ + data/blank_submenus.json \ + data/dynamic.json \ + data/long_label.json \ + data/no_id.json \ + data/no_label.json \ + data/sameid_submenus_diff_sizes.json \ + data/sameid_submenus.json \ + data/sameid_top_and_submenus.json \ + data/sameid_topmenu.json \ + data/several_submenus.json \ + data/several_submenus_recursive.json \ + data/several_submenus_utf8.json \ + data/static.json \ + data/test-gtk-label.json + +CLEANFILES = \ + dbusmenu.xml \ + dbusmenu.pyc \ + dbusmenu.py + +distclean-local: + -rm -rf $(builddir)/mago.results + diff --git a/tests/dbusmenu-gtk/data/blank_label.json b/tests/dbusmenu-gtk/data/blank_label.json new file mode 100644 index 0000000..d62d49b --- /dev/null +++ b/tests/dbusmenu-gtk/data/blank_label.json @@ -0,0 +1,26 @@ +[ + {"id": 1, + "label": "", + "submenu": [ + {"id": 30, + "label": ""}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }] diff --git a/tests/dbusmenu-gtk/data/blank_label_2levels.json b/tests/dbusmenu-gtk/data/blank_label_2levels.json new file mode 100644 index 0000000..e3335a5 --- /dev/null +++ b/tests/dbusmenu-gtk/data/blank_label_2levels.json @@ -0,0 +1,82 @@ +[ + {"id": 4, + "label": "", + "submenu": [ + {"id": 5, + "label": "", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"}, + {"id": 13, + "label": "value13"}, + {"id": 14, + "label": "value14"}, + {"id": 15, + "label": "value15"}, + {"id": 16, + "label": "value16"}, + {"id": 17, + "label": "value17"}, + {"id": 18, + "label": "value18"}, + {"id": 19, + "label": "value19"} + ] + }, + {"id": 6, + "label": "", + "submenu": [ + {"id": 20, + "label": "value20"}, + {"id": 21, + "label": "value21"}, + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 7, + "label": "", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/blank_submenus.json b/tests/dbusmenu-gtk/data/blank_submenus.json new file mode 100644 index 0000000..2eaff27 --- /dev/null +++ b/tests/dbusmenu-gtk/data/blank_submenus.json @@ -0,0 +1,48 @@ +[ + {"id": 4, + "label": "value2", + "submenu": [ + {"id": 5, + "label": "value5", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"} + ] + }, + {"id": 6, + "label": "value6", + "submenu": [ + ] + }, + {"id": 7, + "label": "value7", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/dynamic.json b/tests/dbusmenu-gtk/data/dynamic.json new file mode 100644 index 0000000..efa7a75 --- /dev/null +++ b/tests/dbusmenu-gtk/data/dynamic.json @@ -0,0 +1,158 @@ +[ + {"id": 1, + "label": "value1", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + {"id": 1, + "label": "value2", + "submenu": [ + {"id": 20, + "label": "value20"}, + {"id": 21, + "label": "value21"}, + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 1, + "label": "a super long label that is really of unreasonable length but we should make sure it makes it across the bus", + "not.a.value": "A useless value", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"}, + {"id": 13, + "label": "value13"}, + {"id": 14, + "label": "value14"}, + {"id": 15, + "label": "value15"}, + {"id": 16, + "label": "value16"}, + {"id": 17, + "label": "value17"}, + {"id": 18, + "label": "value18"}, + {"id": 19, + "label": "value19"} + ] + }, + {"id": 1, + "label": "value2", + "submenu": [ + {"id": 5, + "label": "value5", + "submenu": [ + {"id": 10, + "label": "value100000"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"}, + {"id": 13, + "label": "value13"}, + {"id": 14, + "label": "value14"}, + {"id": 15, + "label": "value15"}, + {"id": 16, + "label": "value16"}, + {"id": 17, + "label": "value17"}, + {"id": 18, + "label": "value18"}, + {"id": 19, + "label": "value19"} + ] + }, + {"id": 6, + "label": "value6", + "submenu": [ + {"id": 20, + "label": "value20"}, + {"id": 21, + "label": "value21"}, + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 7, + "label": "value7", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/long_label.json b/tests/dbusmenu-gtk/data/long_label.json new file mode 100644 index 0000000..7cacb7f --- /dev/null +++ b/tests/dbusmenu-gtk/data/long_label.json @@ -0,0 +1,82 @@ +[ + {"id": 4, + "label": "", + "submenu": [ + {"id": 5, + "label": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"}, + {"id": 13, + "label": "value13"}, + {"id": 14, + "label": "value14"}, + {"id": 15, + "label": "value15"}, + {"id": 16, + "label": "value16"}, + {"id": 17, + "label": "value17"}, + {"id": 18, + "label": "value18"}, + {"id": 19, + "label": "value19"} + ] + }, + {"id": 6, + "label": "", + "submenu": [ + {"id": 20, + "label": "value20"}, + {"id": 21, + "label": "value21"}, + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 7, + "label": "", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/no_id.json b/tests/dbusmenu-gtk/data/no_id.json new file mode 100644 index 0000000..201408a --- /dev/null +++ b/tests/dbusmenu-gtk/data/no_id.json @@ -0,0 +1,24 @@ +[ + { "label": "I dont have an id", + "submenu": [ + {"label": "30", "submenu": [{"label": "submenu_from_no_id"}]}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }] diff --git a/tests/dbusmenu-gtk/data/no_label.json b/tests/dbusmenu-gtk/data/no_label.json new file mode 100644 index 0000000..c651cbc --- /dev/null +++ b/tests/dbusmenu-gtk/data/no_label.json @@ -0,0 +1,24 @@ +[ + {"id": 1, "label": "hey", + "submenu": [ + {"id": 30, "submenu": [{"id":500, "label": "submenu_from_no_label"}]}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }] diff --git a/tests/dbusmenu-gtk/data/sameid_submenus.json b/tests/dbusmenu-gtk/data/sameid_submenus.json new file mode 100644 index 0000000..a61c92b --- /dev/null +++ b/tests/dbusmenu-gtk/data/sameid_submenus.json @@ -0,0 +1,82 @@ +[ + {"id": 4, + "label": "value2", + "submenu": [ + {"id": 6, + "label": "value5", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"}, + {"id": 13, + "label": "value13"}, + {"id": 14, + "label": "value14"}, + {"id": 15, + "label": "value15"}, + {"id": 16, + "label": "value16"}, + {"id": 17, + "label": "value17"}, + {"id": 18, + "label": "value18"}, + {"id": 19, + "label": "value19"} + ] + }, + {"id": 6, + "label": "value6", + "submenu": [ + {"id": 20, + "label": "value20"}, + {"id": 21, + "label": "value21"}, + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 6, + "label": "value7", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/sameid_submenus_diff_sizes.json b/tests/dbusmenu-gtk/data/sameid_submenus_diff_sizes.json new file mode 100644 index 0000000..d8f36c6 --- /dev/null +++ b/tests/dbusmenu-gtk/data/sameid_submenus_diff_sizes.json @@ -0,0 +1,64 @@ +[ + {"id": 4, + "label": "value2", + "submenu": [ + {"id": 6, + "label": "value5", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"} + ] + }, + {"id": 6, + "label": "value6", + "submenu": [ + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 6, + "label": "value7", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/sameid_top_and_submenus.json b/tests/dbusmenu-gtk/data/sameid_top_and_submenus.json new file mode 100644 index 0000000..102720f --- /dev/null +++ b/tests/dbusmenu-gtk/data/sameid_top_and_submenus.json @@ -0,0 +1,82 @@ +[ + {"id": 4, + "label": "value2", + "submenu": [ + {"id": 4, + "label": "value5", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"}, + {"id": 13, + "label": "value13"}, + {"id": 14, + "label": "value14"}, + {"id": 15, + "label": "value15"}, + {"id": 16, + "label": "value16"}, + {"id": 17, + "label": "value17"}, + {"id": 18, + "label": "value18"}, + {"id": 19, + "label": "value19"} + ] + }, + {"id": 4, + "label": "value6", + "submenu": [ + {"id": 20, + "label": "value20"}, + {"id": 21, + "label": "value21"}, + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 4, + "label": "value7", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/sameid_topmenu.json b/tests/dbusmenu-gtk/data/sameid_topmenu.json new file mode 100644 index 0000000..ee9d97f --- /dev/null +++ b/tests/dbusmenu-gtk/data/sameid_topmenu.json @@ -0,0 +1,158 @@ +[ + {"id": 1, + "label": "value1", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + {"id": 1, + "label": "value2", + "submenu": [ + {"id": 20, + "label": "value20"}, + {"id": 21, + "label": "value21"}, + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 1, + "label": "a super long label that is really of unreasonable length but we should make sure it makes it across the bus", + "not.a.value": "A useless value", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"}, + {"id": 13, + "label": "value13"}, + {"id": 14, + "label": "value14"}, + {"id": 15, + "label": "value15"}, + {"id": 16, + "label": "value16"}, + {"id": 17, + "label": "value17"}, + {"id": 18, + "label": "value18"}, + {"id": 19, + "label": "value19"} + ] + }, + {"id": 1, + "label": "value2", + "submenu": [ + {"id": 5, + "label": "value5", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"}, + {"id": 13, + "label": "value13"}, + {"id": 14, + "label": "value14"}, + {"id": 15, + "label": "value15"}, + {"id": 16, + "label": "value16"}, + {"id": 17, + "label": "value17"}, + {"id": 18, + "label": "value18"}, + {"id": 19, + "label": "value19"} + ] + }, + {"id": 6, + "label": "value6", + "submenu": [ + {"id": 20, + "label": "value20"}, + {"id": 21, + "label": "value21"}, + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 7, + "label": "value7", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/several_submenus.json b/tests/dbusmenu-gtk/data/several_submenus.json new file mode 100644 index 0000000..3b9bb98 --- /dev/null +++ b/tests/dbusmenu-gtk/data/several_submenus.json @@ -0,0 +1,51 @@ +[ + {"id": 4, + "label": "value2", + "submenu": [ + {"id": 5, + "label": "value5", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"} + ] + }, + {"id": 6, + "label": "value6", + "submenu": [ + ] + }, + {"id": 7, + "label": "value7", + "submenu": [ + {"id": 30, + "label": "value30", + "submenu": [ + {"id": 4, "label": "value99", "nonsenses": "useless"} + ]}, + {"id": 31, + "label": "alue31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/several_submenus_recursive.json b/tests/dbusmenu-gtk/data/several_submenus_recursive.json new file mode 100644 index 0000000..1320ef4 --- /dev/null +++ b/tests/dbusmenu-gtk/data/several_submenus_recursive.json @@ -0,0 +1,49 @@ +[ + {"id": 4, + "label": "value2", + "submenu": [ + {"id": 5, + "label": "value5", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"} + ] + }, + {"id": 6, + "label": "value6", + "submenu": [ + ] + }, + {"id": 7, + "label": "value7", + "submenu": [ + {"id": 31, + "label": "value30", + "submenu": [{"id": 301, "label": "value301", "submenu": [{"id": 3001, "label": "value3001", "submenu": [{"id": 5001, "label": "value5001", "submenu": [{"id": 7001, "label": "value7001"}]}]}]}, {"id": 88, "label": "value88"}]}, + {"id": 30, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/several_submenus_utf8.json b/tests/dbusmenu-gtk/data/several_submenus_utf8.json new file mode 100644 index 0000000..b7b07f9 --- /dev/null +++ b/tests/dbusmenu-gtk/data/several_submenus_utf8.json @@ -0,0 +1,51 @@ +[ + {"id": 4, + "label": "value2ñ", + "submenu": [ + {"id": 5, + "label": "value5ス", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"} + ] + }, + {"id": 6, + "label": "value6ñ", + "submenu": [ + ] + }, + {"id": 7, + "label": "value7", + "submenu": [ + {"id": 30, + "label": "value30", + "submenu": [ + {"id": 50, "label": "value9", "nonsenses": "useless"} + ]}, + {"id": 31, + "label": "alue31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/data/static.json b/tests/dbusmenu-gtk/data/static.json new file mode 100644 index 0000000..dec591a --- /dev/null +++ b/tests/dbusmenu-gtk/data/static.json @@ -0,0 +1,26 @@ +[ + {"id": 1, + "label": "value1", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }] diff --git a/tests/dbusmenu-gtk/data/test-gtk-label.json b/tests/dbusmenu-gtk/data/test-gtk-label.json new file mode 100644 index 0000000..64c1386 --- /dev/null +++ b/tests/dbusmenu-gtk/data/test-gtk-label.json @@ -0,0 +1,158 @@ +[ + {"id": 1, + "label": "value1", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + {"id": 2, + "label": "value2", + "submenu": [ + {"id": 20, + "label": "value20"}, + {"id": 21, + "label": "value21"}, + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 3, + "label": "a super long label that is really of unreasonable length but we should make sure it makes it across the bus", + "not.a.value": "A useless value", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"}, + {"id": 13, + "label": "value13"}, + {"id": 14, + "label": "value14"}, + {"id": 15, + "label": "value15"}, + {"id": 16, + "label": "value16"}, + {"id": 17, + "label": "value17"}, + {"id": 18, + "label": "value18"}, + {"id": 19, + "label": "value19"} + ] + }, + {"id": 4, + "label": "value2", + "submenu": [ + {"id": 5, + "label": "value5", + "submenu": [ + {"id": 10, + "label": "value10"}, + {"id": 11, + "label": "value11"}, + {"id": 12, + "label": "value12"}, + {"id": 13, + "label": "value13"}, + {"id": 14, + "label": "value14"}, + {"id": 15, + "label": "value15"}, + {"id": 16, + "label": "value16"}, + {"id": 17, + "label": "value17"}, + {"id": 18, + "label": "value18"}, + {"id": 19, + "label": "value19"} + ] + }, + {"id": 6, + "label": "value6", + "submenu": [ + {"id": 20, + "label": "value20"}, + {"id": 21, + "label": "value21"}, + {"id": 22, + "label": "value22"}, + {"id": 23, + "label": "value23"}, + {"id": 24, + "label": "value24"}, + {"id": 25, + "label": "value25"}, + {"id": 26, + "label": "value26"}, + {"id": 27, + "label": "value27"}, + {"id": 28, + "label": "value28"}, + {"id": 29, + "label": "value29"} + ] + }, + {"id": 7, + "label": "value7", + "submenu": [ + {"id": 30, + "label": "value30"}, + {"id": 31, + "label": "value31"}, + {"id": 32, + "label": "value32"}, + {"id": 33, + "label": "value33"}, + {"id": 34, + "label": "value34"}, + {"id": 35, + "label": "value35"}, + {"id": 36, + "label": "value36"}, + {"id": 37, + "label": "value37"}, + {"id": 38, + "label": "value38"}, + {"id": 39, + "label": "value39"} + ] + }, + ] + } +] diff --git a/tests/dbusmenu-gtk/dbusMenuTest b/tests/dbusmenu-gtk/dbusMenuTest new file mode 100755 index 0000000..46c5f67 --- /dev/null +++ b/tests/dbusmenu-gtk/dbusMenuTest @@ -0,0 +1,8 @@ +#!/bin/bash + +export NO_GAIL=0 +export NO_AT_BRIDGE=0 + +dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf --task ../test-gtk-label-client --task-name Client --task ../test-gtk-label-server --parameter ./$1 --task-name Server --ignore-return + + diff --git a/tests/dbusmenu-gtk/dbusmenu.py.in b/tests/dbusmenu-gtk/dbusmenu.py.in new file mode 100644 index 0000000..ce159e1 --- /dev/null +++ b/tests/dbusmenu-gtk/dbusmenu.py.in @@ -0,0 +1,71 @@ +from mago.test_suite.main import SingleApplicationTestSuite +from mago.application.main import Application + +import ldtp, ooldtp, ldtputils + +class DbusMenuGtkApp(): + LAUNCHER = "@srcdir@/dbusMenuTest" + WINDOW = "frmlibdbusmenu-gtktest" + + def open(self, menu_schema=''): + ldtp.launchapp(self.LAUNCHER, [menu_schema]) + + def menu_exists(self, menu=''): + app = ooldtp.context(self.WINDOW) + + if menu == '': + menu = "mnu1" + + try: + component = app.getchild(menu) + except ldtp.LdtpExecutionError: + return False + + return True + + def get_submenus(self, menu=''): + app = ooldtp.context(self.WINDOW) + + if menu == '': + menu = "mnu1" + + component = app.getchild(menu) + + try: + submenus = component.listsubmenus() + except ldtp.LdtpExecutionError: + return "" + + return submenus + +class DbusMenuGtkTest(SingleApplicationTestSuite): + APPLICATION_FACTORY = DbusMenuGtkApp + + def cleanup(self): + ldtp.waittillguinotexist(self.application.WINDOW, guiTimeOut=70) + + def teardown(self): + ldtp.waittillguinotexist(self.application.WINDOW, guiTimeOut=70) + + def testStaticMenu(self, menu_schema, menu_item='', notexists=''): + self.application.open(menu_schema) + ldtp.waittillguiexist(self.application.WINDOW) + + if notexists == "True": + if self.application.menu_exists(menu_item): + raise AssertionError("The menu item exists") + else: + if not self.application.menu_exists(menu_item): + raise AssertionError("The menu item does not exists") + + + def testSubmenus(self, menu_schema, menu_item='', submenus=''): + self.application.open(menu_schema) + ldtp.waittillguiexist(self.application.WINDOW) + + if submenus != self.application.get_submenus(menu_item): + raise AssertionError("The submenus are different") + + + + diff --git a/tests/dbusmenu-gtk/dbusmenu.xml.in b/tests/dbusmenu-gtk/dbusmenu.xml.in new file mode 100644 index 0000000..b49ee5e --- /dev/null +++ b/tests/dbusmenu-gtk/dbusmenu.xml.in @@ -0,0 +1,89 @@ +<?xml version="1.0"?> +<suite name="dbusmenu gtk test suite"> + <class>dbusmenu.DbusMenuGtkTest</class> + <description> + Test libdbusmenu-gtk. + </description> + <case name="Static Test"> + <method>testStaticMenu</method> + <description>Simple check for a menu </description> + <args> + <menu_schema>@srcdir@/data/static.json</menu_schema> + <menu_item>value39</menu_item> + </args> + </case> + <case name="Blank label"> + <method>testStaticMenu</method> + <description>Blank Label</description> + <args> + <menu_schema>@srcdir@/data/blank_label.json</menu_schema> + <menu_item></menu_item> + </args> + </case> + <case name="Blank Submenus"> + <method>testSubmenus</method> + <description>Blank Submenus</description> + <args> + <menu_schema>@srcdir@/data/blank_submenus.json</menu_schema> + <menu_item>value6</menu_item> + <submenus></submenus> + </args> + </case> + <case name="Long Label"> + <method>testStaticMenu</method> + <description>Really Long Label (1000 chars)</description> + <args> + <menu_schema>@srcdir@/data/long_label.json</menu_schema> + <menu_item>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</menu_item> + </args> + </case> + <case name="No Id"> + <method>testStaticMenu</method> + <description>Search for a submenu that comes from a menu without ID</description> + <args> + <menu_schema>@srcdir@/data/no_id.json</menu_schema> + <menu_item>submenu_from_no_id</menu_item> + </args> + </case> + <case name="Blank Label 2 levels"> + <method>testStaticMenu</method> + <description>Search for a submenu that comes from a menu with a blank label</description> + <args> + <menu_schema>@srcdir@/data/blank_label_2levels.json</menu_schema> + <menu_item>value10</menu_item> + </args> + </case> + <case name="No Label"> + <method>testStaticMenu</method> + <description>Be sure that a submenu from a menu without label does not exist</description> + <args> + <menu_schema>@srcdir@/data/no_label.json</menu_schema> + <menu_item>submenu_from_no_label</menu_item> + <notexists>True</notexists> + </args> + </case> + <case name="Several Submenus"> + <method>testStaticMenu</method> + <description>Check that a submenu is shown</description> + <args> + <menu_schema>@srcdir@/data/several_submenus.json</menu_schema> + <menu_item>value10</menu_item> + </args> + </case> + <case name="Several Submenus Recursive"> + <method>testStaticMenu</method> + <description>Be sure that a submenu from a 4th level depth, is shown</description> + <args> + <menu_schema>@srcdir@/data/several_submenus_recursive.json</menu_schema> + <menu_item>value7001</menu_item> + </args> + </case> + <case name="Several Submenus UTF8"> + <method>testStaticMenu</method> + <description>Be sure that a submenu, with a UTF-8 label, is shown</description> + <args> + <menu_schema>@srcdir@/data/several_submenus_utf8.json</menu_schema> + <menu_item>value5ス</menu_item> + </args> + </case> +</suite> |