aboutsummaryrefslogtreecommitdiff
path: root/tests/client
diff options
context:
space:
mode:
Diffstat (limited to 'tests/client')
-rw-r--r--tests/client/modeltest.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/client/modeltest.cpp b/tests/client/modeltest.cpp
index 1b0ea95..bc5d95e 100644
--- a/tests/client/modeltest.cpp
+++ b/tests/client/modeltest.cpp
@@ -25,6 +25,19 @@
#include <QtTest>
#include <QDebug>
+extern "C" {
+#include <gio/gio.h>
+}
+
+class TestMenuModel : public QMenuModel
+{
+public:
+ TestMenuModel(GMenuModel *other, QObject *parent=0)
+ : QMenuModel(other, parent)
+ {
+ }
+};
+
class ModelTest : public QObject
{
Q_OBJECT
@@ -248,6 +261,20 @@ private Q_SLOTS:
delete model;
}
+ /*
+ * Test if the model is clearead after GMenuModel be destroyed
+ */
+ void testDestroyGMenuModel()
+ {
+ GMenu *menu = g_menu_new();
+ g_menu_append(menu, "test-menu0", NULL);
+ g_menu_append(menu, "test-menu1", NULL);
+ TestMenuModel model(reinterpret_cast<GMenuModel*>(menu));
+ QCOMPARE(model.rowCount(), 2);
+
+ g_object_unref(menu);
+ QCOMPARE(model.rowCount(), 0);
+ }
};
QTEST_MAIN(ModelTest)