From fb4aef9c70ac29bde97b39b7737171c1879899ed Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Fri, 18 Jan 2013 10:40:38 +0100 Subject: [PATCH] Accessibility: Test for do not crash if the column count is 0 This tests the fix submitted in bb5e11b56dd2f5fe2957f151a38 Task-number: QTBUG-28611 Change-Id: I7b15aa6b46be3607bd7079294d8e7d18bd507d1c Reviewed-by: Frederik Gladhorn --- tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 2d0dd71cdb6..ea322b20a10 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -2458,6 +2458,12 @@ void tst_QAccessibility::listTest() void tst_QAccessibility::treeTest() { QTreeWidget *treeView = new QTreeWidget; + + // Empty model (do not crash, etc) + treeView->setColumnCount(0); + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView); + QCOMPARE(iface->child(0), static_cast(0)); + treeView->setColumnCount(2); QTreeWidgetItem *header = new QTreeWidgetItem; header->setText(0, "Artist"); @@ -2493,7 +2499,6 @@ void tst_QAccessibility::treeTest() QCoreApplication::processEvents(); QTest::qWait(100); - QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView); QCOMPARE(verifyHierarchy(iface), 0); QCOMPARE((int)iface->role(), (int)QAccessible::Tree);