diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-04-11 11:36:29 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:08 -0300 |
commit | 442a0ca932a663251deeefb37428b4d8df70a139 (patch) | |
tree | 4a31f74a3c1b2824131ef6853747297c3b577590 /tests | |
parent | 99c656e2a5b15d3e655d5fefa53ac43fc492ab2b (diff) |
Created unit test for bug #814.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtDeclarative/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_814.py | 39 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_814.qml | 9 |
3 files changed, 49 insertions, 0 deletions
diff --git a/tests/QtDeclarative/CMakeLists.txt b/tests/QtDeclarative/CMakeLists.txt index 01a417262..7cad2d7ff 100644 --- a/tests/QtDeclarative/CMakeLists.txt +++ b/tests/QtDeclarative/CMakeLists.txt @@ -2,6 +2,7 @@ PYSIDE_TEST(bug_451.py) PYSIDE_TEST(bug_456.py) PYSIDE_TEST(bug_557.py) PYSIDE_TEST(bug_726.py) +PYSIDE_TEST(bug_814.py) PYSIDE_TEST(qdeclarativenetwork_test.py) PYSIDE_TEST(qdeclarativeview_test.py) PYSIDE_TEST(connect_python_qml.py) diff --git a/tests/QtDeclarative/bug_814.py b/tests/QtDeclarative/bug_814.py new file mode 100644 index 000000000..43fcc5f61 --- /dev/null +++ b/tests/QtDeclarative/bug_814.py @@ -0,0 +1,39 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Test case for PySide bug 814 +# http://bugs.pyside.org/show_bug.cgi?id=814 +# 2011-04-08 Thomas Perl <m@thp.io> +# Released under the same terms as PySide itself + +from PySide.QtCore import QUrl, QAbstractListModel, QModelIndex +from PySide.QtDeclarative import QDeclarativeView + +from helper import adjust_filename, TimedQApplication +import unittest + +class ListModel(QAbstractListModel): + def __init__(self): + QAbstractListModel.__init__(self) + self.setRoleNames({0: 'modelData'}) + + def rowCount(self, parent=QModelIndex()): + return 3 + + def data(self, index, role): + if index.isValid() and role == 0: + return 'blubb' + return None + +class TestBug814(TimedQApplication): + def testAbstractItemModelTransferToQML(self): + view = QDeclarativeView() + view.setSource(QUrl.fromLocalFile(adjust_filename('bug_814.qml', __file__))) + root = view.rootObject() + model = ListModel() + root.setProperty('model', model) + view.show() + +if __name__ == '__main__': + unittest.main() + diff --git a/tests/QtDeclarative/bug_814.qml b/tests/QtDeclarative/bug_814.qml new file mode 100644 index 000000000..f772c3a84 --- /dev/null +++ b/tests/QtDeclarative/bug_814.qml @@ -0,0 +1,9 @@ + +import Qt 4.7 + +ListView { + width: 300; height: 300 + delegate: Text { text: modelData } + model: 3 +} + |