~zsombi/ubuntu-ui-toolkit/theme-as-singleton

« back to all changes in this revision

Viewing changes to tests/unit_x11/tst_theme_engine/tst_theme_enginetest.cpp

  • Committer: Zsombor Egri
  • Date: 2014-01-27 10:48:40 UTC
  • Revision ID: zsombor.egri@canonical.com-20140127104840-2ki8hjl0tces5ba7
test added to catch style refresh

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    void testNameSet();
61
61
    void testCreateStyleComponent();
62
62
    void testCreateStyleComponent_data();
 
63
    void testChangeThemeAfterCompletion();
63
64
    void testThemesRelativePath();
64
65
    void testThemesRelativePathWithParent();
65
66
    void testThemesRelativePathWithParentXDGDATA();
137
138
    QTest::newRow("No parent") << "TestStyle.qml" << "" << false;
138
139
}
139
140
 
 
141
void tst_UCTheme::testChangeThemeAfterCompletion()
 
142
{
 
143
    qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "../tst_theme_engine");
 
144
 
 
145
    QScopedPointer<QQuickView> view(loadTest("ChangeThemeAfterCompletion.qml"));
 
146
    QVERIFY(view);
 
147
 
 
148
    UCTheme *theme = UCTheme::instance();
 
149
    QVERIFY(theme);
 
150
 
 
151
    QQmlComponent *style = view->rootObject()->property("style").value<QQmlComponent*>();
 
152
    QVERIFY(!style);
 
153
    // change the theme
 
154
    QSignalSpy nameChanged(theme, SIGNAL(nameChanged()));
 
155
    theme->setName("TestModule.TestTheme");
 
156
    QTest::waitForEvents();
 
157
    QCOMPARE(nameChanged.count(), 1);
 
158
 
 
159
    style = view->rootObject()->property("style").value<QQmlComponent*>();
 
160
    QVERIFY(style);
 
161
}
 
162
 
140
163
void tst_UCTheme::testThemesRelativePath()
141
164
{
142
165
    qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "../tst_theme_engine");