diff options
author | Renato Araujo Oliveira Filho <renato.filho@canonical.com> | 2012-10-11 16:15:17 -0300 |
---|---|---|
committer | Renato Araujo Oliveira Filho <renato.filho@canonical.com> | 2012-10-11 16:15:17 -0300 |
commit | 9bf14725a2333ca9535e734e2d6f3d7168a090d4 (patch) | |
tree | afcccd60f592a703b5da4107c8aae80c7ef81487 /tests/client/qmltest.cpp | |
parent | f430d60b0a1a458985d41cb964b1a6e569c2e63e (diff) | |
download | qmenumodel-9bf14725a2333ca9535e734e2d6f3d7168a090d4.tar.gz qmenumodel-9bf14725a2333ca9535e734e2d6f3d7168a090d4.tar.bz2 qmenumodel-9bf14725a2333ca9535e734e2d6f3d7168a090d4.zip |
Created unit test for crash during model destruction.
Diffstat (limited to 'tests/client/qmltest.cpp')
-rw-r--r-- | tests/client/qmltest.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/client/qmltest.cpp b/tests/client/qmltest.cpp index e9db4ac..4e6f288 100644 --- a/tests/client/qmltest.cpp +++ b/tests/client/qmltest.cpp @@ -84,6 +84,35 @@ private Q_SLOTS: QTest::qWait(500); } + /* + * Test the menu model disappearing from the bus and reappearing + * while the QML application is running. + */ + void testServiceDisappear() + { + m_script.publishMenu(); + m_script.run(); + QTest::qWait(500); + + QQuickView *view = new QQuickView; + view->engine()->addImportPath(QML_BASE_DIR); + view->engine()->rootContext()->setContextProperty("globalBusType", DBusEnums::SessionBus); + view->engine()->rootContext()->setContextProperty("globalBusName", MENU_SERVICE_NAME); + view->engine()->rootContext()->setContextProperty("globalObjectPath", MENU_OBJECT_PATH); + view->setSource(QUrl::fromLocalFile(LOADMODEL2_QML)); + view->show(); + QTest::qWait(500); + + m_script.unpublishMenu(); + QTest::qWait(500); + + m_script.publishMenu(); + m_script.run(); + QTest::qWait(500); + + delete view; + QTest::qWait(1000); + } }; QTEST_MAIN(QMLTest) |