summaryrefslogtreecommitdiffstats
path: root/tests/QtDeclarative/qdeclarativeview_test.py
blob: 8101c5f01f3bbf55eb8058e08005b9084f4acfe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'''Test cases for QDeclarativeView'''

import unittest

from PySide.QtCore import QUrl, QStringList, QVariant
from PySide.QtGui import QPushButton
from PySide.QtDeclarative import QDeclarativeView

from helper import adjust_filename, TimedQApplication


class TestQDeclarativeView(TimedQApplication):

    def testQDeclarativeViewList(self):
        view = QDeclarativeView()

        dataList = QStringList(["Item 1", "Item 2", "Item 3", "Item 4"])

        ctxt = view.rootContext()
        ctxt.setContextProperty("myModel", dataList)

        url = QUrl.fromLocalFile(adjust_filename('view.qml', __file__))
        view.setSource(url)
        view.show()

        self.assertEqual(view.status(), QDeclarativeView.Ready)

        self.app.exec_()

if __name__ == '__main__':
    unittest.main()