diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtDeclarative/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_1113.py | 31 | ||||
-rw-r--r-- | tests/QtDeclarative/bug_1113.qml | 17 |
3 files changed, 49 insertions, 0 deletions
diff --git a/tests/QtDeclarative/CMakeLists.txt b/tests/QtDeclarative/CMakeLists.txt index 2c842d3..b670f08 100644 --- a/tests/QtDeclarative/CMakeLists.txt +++ b/tests/QtDeclarative/CMakeLists.txt @@ -11,6 +11,7 @@ PYSIDE_TEST(bug_951.py) PYSIDE_TEST(bug_995.py) PYSIDE_TEST(bug_997.py) PYSIDE_TEST(bug_1029.py) +PYSIDE_TEST(bug_1113.py) PYSIDE_TEST(qdeclarativenetwork_test.py) PYSIDE_TEST(qdeclarativeview_test.py) PYSIDE_TEST(connect_python_qml.py) diff --git a/tests/QtDeclarative/bug_1113.py b/tests/QtDeclarative/bug_1113.py new file mode 100644 index 0000000..ca697be --- /dev/null +++ b/tests/QtDeclarative/bug_1113.py @@ -0,0 +1,31 @@ +''' unit test for BUG #1113 ''' + +import sys +from PySide import QtCore, QtGui, QtDeclarative +import helper + +class TestModel(QtCore.QAbstractListModel): + def __init__(self, parent=None): + super(TestModel, self).__init__(parent) + self._data = ["one", "two", "three"] + # this _must_ crash without the fix + obj = QtCore.QObject() + + def rowCount(self, parent=QtCore.QModelIndex()): + return len(self._data) + + def data(self, index, role): + return self._data[index.row()] + +if __name__ == "__main__": + QtDeclarative.qmlRegisterType(TestModel, "Test", 1,0, + "TestModel") + + app = QtGui.QApplication(sys.argv) + view = QtDeclarative.QDeclarativeView() + url = QtCore.QUrl.fromLocalFile(helper.adjust_filename("bug_1113.qml", + __file__)) + view.setSource(url) + QtCore.QTimer.singleShot(70, app.quit) + view.show() + sys.exit(app.exec_()) diff --git a/tests/QtDeclarative/bug_1113.qml b/tests/QtDeclarative/bug_1113.qml new file mode 100644 index 0000000..0283006 --- /dev/null +++ b/tests/QtDeclarative/bug_1113.qml @@ -0,0 +1,17 @@ +import QtQuick 1.1 +import Test 1.0 + +ListView { + width: 400; height: 240; + + model: TestModel { + } + + delegate: Item { + height: 32 + width: parent.width + Text { + text: model.display + } + } +} |