~tpeeters/ubuntu-ui-toolkit/10-tabsModelIndex

« back to all changes in this revision

Viewing changes to tests/unit_x11/tst_layouts/tst_layouts.cpp

  • Committer: tpeeters
  • Date: 2014-03-24 19:13:15 UTC
  • mfrom: (967.1.15 ubuntu-ui-toolkit)
  • Revision ID: tim.peeters@canonical.com-20140324191315-cgmt5x2h6v2xq1jh
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
#include "ullayouts.h"
30
30
#include "ucunits.h"
 
31
#include "uctestcase.h"
31
32
#include <QtQuick/private/qquickanchors_p.h>
32
33
#include <QtQuick/private/qquickanchors_p_p.h>
33
34
 
58
59
 
59
60
    QQuickView * loadTest(const QString &file)
60
61
    {
61
 
        QQuickView *view = new QQuickView;
62
 
        view->engine()->addImportPath(m_modulePath);
63
 
 
64
 
        view->setSource(QUrl::fromLocalFile(file));
65
 
        if (!view->rootObject()) {
66
 
            delete view;
67
 
            view = 0;
68
 
        } else {
69
 
            view->show();
70
 
            QTest::qWaitForWindowExposed(view);
71
 
        }
72
 
        return view;
 
62
        UbuntuTestCase* testCase = new UbuntuTestCase(file);
 
63
        return qobject_cast<QQuickView*>(testCase);
73
64
    }
74
65
 
75
66
    QQuickItem *testItem(QQuickItem *that, const QString &identifier)
85
76
private Q_SLOTS:
86
77
    void initTestCase()
87
78
    {
88
 
        QString modules("../../../modules");
89
 
        QVERIFY(QDir(modules).exists());
90
 
 
91
 
        m_modulePath = QDir(modules).absolutePath();
92
79
    }
93
80
 
94
81
    void cleanupTestCase()
97
84
 
98
85
    void testCase_NoLayouts()
99
86
    {
100
 
        QScopedPointer<QQuickView> view(loadTest("NoLayouts.qml"));
101
 
        QVERIFY(view);
102
 
 
103
 
        ULLayouts *layouts = qobject_cast<ULLayouts*>(testItem(view->rootObject(), "layouts"));
104
 
        QVERIFY(layouts);
105
 
 
 
87
        QScopedPointer<UbuntuTestCase> testCase(new UbuntuTestCase("NoLayouts.qml"));
 
88
        ULLayouts *layouts = testCase->findItem<ULLayouts*>("layouts");
106
89
        QVERIFY(layouts->layoutList().isEmpty());
107
90
    }
108
91