From 2faccdf9a6586cb9b6f7bc276c39c814ab354003 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 3 Dec 2018 13:36:49 +0100 Subject: Don't insert multiple names for the same role It doesn't make a lot of sense to have two names for the same role. Use 'fileIcon' exclusively for the Qt::Decoration/ FileIconRole. Change-Id: Icaa46ba4aa61efc56ba007a14bab5e59ea26cd35 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto/widgets/itemviews') diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index 5097f2e356..546b2ab3a8 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -697,7 +697,7 @@ void tst_QDirModel::roleNames_data() { QTest::addColumn("role"); QTest::addColumn("roleName"); - QTest::newRow("decoration") << int(Qt::DecorationRole) << QByteArray("decoration"); + QTest::newRow("decoration") << int(Qt::DecorationRole) << QByteArray("fileIcon"); QTest::newRow("display") << int(Qt::DisplayRole) << QByteArray("display"); QTest::newRow("fileIcon") << int(QDirModel::FileIconRole) << QByteArray("fileIcon"); QTest::newRow("filePath") << int(QDirModel::FilePathRole) << QByteArray("filePath"); @@ -713,8 +713,8 @@ void tst_QDirModel::roleNames() QVERIFY(roles.contains(role)); QFETCH(QByteArray, roleName); - QList values = roles.values(role); - QVERIFY(values.contains(roleName)); + QCOMPARE(roles.values(role).count(), 1); + QCOMPARE(roles.value(role), roleName); } -- cgit v1.2.3 From c15a069830baf87f57c84e86326cf86ba9a39713 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 12 Jun 2019 20:49:06 +0200 Subject: QTreeView: make sure to not ask the old model during setModel Within QTreeView::setModel() the header might emit columnCountChanged which then tries to update the geometries based on the old model which is wrong. Fix it by setting geometryRecursionBlock to true so QTreeView::updateGeometries() will not ask the old model for it's data. Fixes: QTBUG-75982 Change-Id: Ia0dd36cd7c6c5347fbc285deac43da6941accbe7 Reviewed-by: Richard Moe Gustavsen --- tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/auto/widgets/itemviews') diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 44195d3b25..58ca924fe2 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -2862,6 +2862,7 @@ public: }; Node *root; + bool crash = false; EvilModel(QObject *parent = nullptr): QAbstractItemModel(parent), root(new Node) {} @@ -2870,6 +2871,11 @@ public: delete root; } + void setCrash() + { + crash = true; + } + void change() { emit layoutAboutToBeChanged(); @@ -2938,6 +2944,10 @@ public: QVariant data(const QModelIndex &idx, int role) const override { + if (crash) { + QTest::qFail("Should not get here...", __FILE__, __LINE__); + return QVariant(); + } if (idx.isValid() && role == Qt::DisplayRole) { Node *parentNode = root; if (idx.isValid()) { @@ -2957,6 +2967,7 @@ void tst_QTreeView::evilModel_data() { QTest::addColumn("visible"); QTest::newRow("visible") << false; + QTest::newRow("visible") << true; } void tst_QTreeView::evilModel() @@ -3126,6 +3137,9 @@ void tst_QTreeView::evilModel() model.change(); view.setRootIndex(secondLevel); + + model.setCrash(); + view.setModel(nullptr); } void tst_QTreeView::indexRowSizeHint() -- cgit v1.2.3 From 96c27eb710a37780e79e09df2ebce1d5e4922c9d Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 25 Jun 2019 20:47:13 +0200 Subject: QList/Table/TreeWidgetItem: Allow reseting values by passing the default value The convenience functions setBackground(), setForeground() and setSizeHint() a default constructed value as 'reset'. This means a default constructed QBrush or QSize is returned in the data() function which leads to an unexpected background or forground color or size hint. Therefore check if the passed value is a default constructed value and set an empty QVariant instead which. [ChangeLog][QtWidgets][ItemViews] The convenience views QList/Table/TreeWidgetItem now treat a default constructed QBrush or QSize as an empty QVariant which allows to reset the values set to it's default values. Task-number: QTBUG-76423 Change-Id: I840570bbad3e5fd8c5b4b58903b4fd0066dbdeb7 Reviewed-by: Richard Moe Gustavsen --- .../itemviews/qlistwidget/tst_qlistwidget.cpp | 14 ++++++++++++ .../itemviews/qtablewidget/tst_qtablewidget.cpp | 25 +++++++++++++++++++++- .../itemviews/qtreewidget/tst_qtreewidget.cpp | 14 ++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) (limited to 'tests/auto/widgets/itemviews') diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index cb083fdcbe..dcb932de66 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -1512,6 +1512,20 @@ void tst_QListWidget::itemData() QCOMPARE(flags.count(), 6); for (int i = 0; i < 4; ++i) QCOMPARE(flags[Qt::UserRole + i].toString(), QString::number(i + 1)); + + item.setBackground(QBrush(Qt::red)); + item.setForeground(QBrush(Qt::red)); + item.setSizeHint(QSize(10, 10)); + QCOMPARE(item.data(Qt::BackgroundRole), QVariant(QBrush(Qt::red))); + QCOMPARE(item.data(Qt::ForegroundRole), QVariant(QBrush(Qt::red))); + QCOMPARE(item.data(Qt::SizeHintRole), QVariant(QSize(10, 10))); + // an empty brush should result in a QVariant() + item.setBackground(QBrush()); + item.setForeground(QBrush()); + item.setSizeHint(QSize()); + QCOMPARE(item.data(Qt::BackgroundRole), QVariant()); + QCOMPARE(item.data(Qt::ForegroundRole), QVariant()); + QCOMPARE(item.data(Qt::SizeHintRole), QVariant()); } void tst_QListWidget::changeDataWithSorting() diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp index f640996690..38dae7743f 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp @@ -1404,9 +1404,17 @@ void tst_QTableWidget::setItemData() QCOMPARE(table.currentRoles, QVector({Qt::DisplayRole, Qt::EditRole, Qt::ToolTipRole})); QCOMPARE(table.model()->data(idx, Qt::DisplayRole).toString(), QLatin1String("Display")); + QCOMPARE(table.model()->data(idx, Qt::EditRole).toString(), QLatin1String("Display")); QCOMPARE(table.model()->data(idx, Qt::ToolTipRole).toString(), QLatin1String("ToolTip")); QCOMPARE(dataChangedSpy.count(), 1); - QCOMPARE(idx, qvariant_cast(dataChangedSpy.takeFirst().at(0))); + QCOMPARE(idx, qvariant_cast(dataChangedSpy.first().at(0))); + QCOMPARE(idx, qvariant_cast(dataChangedSpy.first().at(1))); + const auto roles = qvariant_cast>(dataChangedSpy.first().at(2)); + QCOMPARE(roles.size(), 3); + QVERIFY(roles.contains(Qt::DisplayRole)); + QVERIFY(roles.contains(Qt::EditRole)); + QVERIFY(roles.contains(Qt::ToolTipRole)); + dataChangedSpy.clear(); table.model()->setItemData(idx, data); QCOMPARE(dataChangedSpy.count(), 0); @@ -1416,6 +1424,21 @@ void tst_QTableWidget::setItemData() table.model()->setItemData(idx, data); QCOMPARE(table.model()->data(idx, Qt::DisplayRole).toString(), QLatin1String("dizplaye")); QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(QVector({Qt::DisplayRole, Qt::EditRole}), qvariant_cast>(dataChangedSpy.first().at(2))); + + item->setBackground(QBrush(Qt::red)); + item->setForeground(QBrush(Qt::green)); + item->setSizeHint(QSize(10, 10)); + QCOMPARE(item->data(Qt::BackgroundRole), QVariant(QBrush(Qt::red))); + QCOMPARE(item->data(Qt::ForegroundRole), QVariant(QBrush(Qt::green))); + QCOMPARE(item->data(Qt::SizeHintRole), QVariant(QSize(10, 10))); + // an empty brush should result in a QVariant() + item->setBackground(QBrush()); + item->setForeground(QBrush()); + item->setSizeHint(QSize()); + QCOMPARE(item->data(Qt::BackgroundRole), QVariant()); + QCOMPARE(item->data(Qt::ForegroundRole), QVariant()); + QCOMPARE(item->data(Qt::SizeHintRole), QVariant()); } void tst_QTableWidget::cellWidget() diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 2118bb5a29..7da56ab797 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -1994,6 +1994,20 @@ void tst_QTreeWidget::itemData() QCOMPARE(flags[Qt::UserRole + i].toString(), QString::number(i + 1)); flags = widget.model()->itemData(widget.model()->index(0, 1)); QCOMPARE(flags.count(), 0); + + item.setBackground(0, QBrush(Qt::red)); + item.setForeground(0, QBrush(Qt::green)); + item.setSizeHint(0, QSize(10, 10)); + QCOMPARE(item.data(0, Qt::BackgroundRole), QVariant(QBrush(Qt::red))); + QCOMPARE(item.data(0, Qt::ForegroundRole), QVariant(QBrush(Qt::green))); + QCOMPARE(item.data(0, Qt::SizeHintRole), QVariant(QSize(10, 10))); + // an empty brush should result in a QVariant() + item.setBackground(0, QBrush()); + item.setForeground(0, QBrush()); + item.setSizeHint(0, QSize()); + QCOMPARE(item.data(0, Qt::BackgroundRole), QVariant()); + QCOMPARE(item.data(0, Qt::ForegroundRole), QVariant()); + QCOMPARE(item.data(0, Qt::SizeHintRole), QVariant()); } void tst_QTreeWidget::enableDisable() -- cgit v1.2.3 From d556d7a6b80d862c1b010358e16ee29004a32f75 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 25 Nov 2019 10:49:54 +0100 Subject: Avoid initializing QFlags with 0 or nullptr in tests Amends qtbase/af2daafde72db02454d24b7d691aa6861525ab99. Change-Id: Ib5d17611e43e7ab2c63c7f0587f549377f262e32 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp | 2 +- tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/widgets/itemviews') diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 12b24798f4..ea3eb5fd0c 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -1297,7 +1297,7 @@ void tst_QTableView::moveCursorStrikesBack() int newRow = -1; int newColumn = -1; for (auto cursorMoveAction : cursorMoveActions) { - QModelIndex newIndex = view.moveCursor(cursorMoveAction, nullptr); + QModelIndex newIndex = view.moveCursor(cursorMoveAction, {}); view.setCurrentIndex(newIndex); newRow = newIndex.row(); newColumn = newIndex.column(); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 9750a31824..d332c7e291 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -4918,7 +4918,7 @@ void tst_QTreeView::taskQTBUG_61476() QEvent::MouseButtonPress) QTRY_VERIFY(!tv.isExpanded(mi)); - QTest::mouseRelease(tv.viewport(), Qt::LeftButton, nullptr, pos); + QTest::mouseRelease(tv.viewport(), Qt::LeftButton, {}, pos); QTRY_VERIFY(!tv.isExpanded(mi)); QCOMPARE(lastTopLevel->checkState(), Qt::Checked); } -- cgit v1.2.3 From e70fe301d919d059ad982574660149a1233a9649 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 23 Nov 2019 20:29:48 +0100 Subject: Widget autotests: replace deprecated QWidget::repaint() calls Replace QWidget::repaint() with update() + wait until the paint event is received. Task-number: QTBUG-80237 Change-Id: I57da7cd8fa119344484b849a88729bca7b48616c Reviewed-by: Richard Moe Gustavsen --- .../widgets/itemviews/qtreeview/tst_qtreeview.cpp | 52 +++++++++++++--------- 1 file changed, 30 insertions(+), 22 deletions(-) (limited to 'tests/auto/widgets/itemviews') diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index d332c7e291..23e2ec8516 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -77,6 +77,30 @@ static void initStandardTreeModel(QStandardItemModel *model) model->insertRow(2, item); } +class TreeView : public QTreeView +{ + Q_OBJECT +public: + using QTreeView::QTreeView; + using QTreeView::selectedIndexes; + + void paintEvent(QPaintEvent *event) override + { + QTreeView::paintEvent(event); + wasPainted = true; + } + bool wasPainted = false; +public slots: + void handleSelectionChanged() + { + //let's select the last item + QModelIndex idx = model()->index(0, 0); + selectionModel()->select(QItemSelection(idx, idx), QItemSelectionModel::Select); + disconnect(selectionModel(), &QItemSelectionModel::selectionChanged, + this, &TreeView::handleSelectionChanged); + } +}; + class tst_QTreeView : public QObject { Q_OBJECT @@ -2980,7 +3004,7 @@ void tst_QTreeView::evilModel() { QFETCH(bool, visible); // init - QTreeView view; + TreeView view; EvilModel model; view.setModel(&model); view.setVisible(visible); @@ -3018,7 +3042,7 @@ void tst_QTreeView::evilModel() view.scrollTo(thirdLevel); model.change(); - view.repaint(); + view.update(); // will not do anything since view is not visible model.change(); QTest::mouseDClick(view.viewport(), Qt::LeftButton); @@ -3175,7 +3199,7 @@ void tst_QTreeView::filterProxyModelCrash() QSortFilterProxyModel proxy; proxy.setSourceModel(&model); - QTreeView view; + TreeView view; view.setModel(&proxy); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); @@ -3184,7 +3208,8 @@ void tst_QTreeView::filterProxyModelCrash() QTest::qWait(20); proxy.invalidate(); - view.repaint(); //used to crash + view.update(); //used to crash + QTRY_VERIFY(view.wasPainted); } void tst_QTreeView::renderToPixmap_data() @@ -3652,10 +3677,7 @@ void tst_QTreeView::task220298_selectColumns() } }; - class TreeView : public QTreeView { - public: - using QTreeView::selectedIndexes; - } view; + TreeView view; Model model; view.setModel(&model); view.show(); @@ -4004,20 +4026,6 @@ void tst_QTreeView::task254234_proxySort() QCOMPARE(view.model()->data(view.model()->index(1, 1)).toString(), QString::fromLatin1("g")); } -class TreeView : public QTreeView -{ - Q_OBJECT -public slots: - void handleSelectionChanged() - { - //let's select the last item - QModelIndex idx = model()->index(0, 0); - selectionModel()->select(QItemSelection(idx, idx), QItemSelectionModel::Select); - disconnect(selectionModel(), &QItemSelectionModel::selectionChanged, - this, &TreeView::handleSelectionChanged); - } -}; - void tst_QTreeView::task248022_changeSelection() { //we check that changing the selection between the mouse press and the mouse release -- cgit v1.2.3 From 985f4910249a0308b746695e64aa1a6205492421 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 25 Nov 2019 21:30:25 +0100 Subject: QTreeView: Reset the pressed index if the decoration was pressed on We need to reset the pressed index when the decoration was pressed on otherwise if the mouse ends up over an already selected item that was previously clicked on. This prevents it from thinking that the mouse has been released on this item right after pressing on it. Fixes: QTBUG-59067 Change-Id: Iab372ae20db3682ab0812661f86533079ba4083c Reviewed-by: Christian Ehrlicher --- .../auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'tests/auto/widgets/itemviews') diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 58ca924fe2..b2ca62227f 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -4875,13 +4875,27 @@ void tst_QTreeView::taskQTBUG_61476() const QPoint pos = rect.center(); QTest::mousePress(tv.viewport(), Qt::LeftButton, {}, pos); - if (tv.style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, nullptr, &tv) == - QEvent::MouseButtonPress) + const bool expandsOnPress = + (tv.style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, nullptr, &tv) == QEvent::MouseButtonPress); + if (expandsOnPress) QTRY_VERIFY(!tv.isExpanded(mi)); QTest::mouseRelease(tv.viewport(), Qt::LeftButton, nullptr, pos); QTRY_VERIFY(!tv.isExpanded(mi)); QCOMPARE(lastTopLevel->checkState(), Qt::Checked); + + // Test that it does not toggle the check state of a previously selected item when collapsing an + // item causes it to position the item under the mouse to be the decoration for the selected item + tv.expandAll(); + tv.verticalScrollBar()->setValue(tv.verticalScrollBar()->maximum()); + // It is not enough to programmatically select the item, we need to have it clicked on + QTest::mouseClick(tv.viewport(), Qt::LeftButton, {}, tv.visualRect(lastTopLevel->index()).center()); + QTest::mousePress(tv.viewport(), Qt::LeftButton, {}, pos); + if (expandsOnPress) + QTRY_VERIFY(!tv.isExpanded(mi)); + QTest::mouseRelease(tv.viewport(), Qt::LeftButton, nullptr, pos); + QTRY_VERIFY(!tv.isExpanded(mi)); + QCOMPARE(lastTopLevel->checkState(), Qt::Checked); } QTEST_MAIN(tst_QTreeView) -- cgit v1.2.3 From be9398c8d4ab0b7eba74b607d82dc43cd40443b8 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 2 Dec 2019 21:07:44 +0100 Subject: QListModel: fix moveRows() QListModel::moveRows() had an issue when the destination was before the source row. Change-Id: I4ce8b425451f2f53c7eb3b211e9590753dec618a Reviewed-by: Luca Beldi Reviewed-by: David Faure --- .../itemviews/qlistwidget/tst_qlistwidget.cpp | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'tests/auto/widgets/itemviews') diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index dcb932de66..67d8764b61 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -177,8 +177,9 @@ void tst_QListWidget::moveRowsInvalid_data() result->addItems({"A", "B", "C", "D", "E", "F"}); return result; }; + constexpr int rowCount = 6; - QTest::addRow("destination_equal_source") << createWidget() << QModelIndex() << 0 << 1 << QModelIndex() << 1; + QTest::addRow("destination_equal_source") << createWidget() << QModelIndex() << 0 << 1 << QModelIndex() << 0; QTest::addRow("count_equal_0") << createWidget() << QModelIndex() << 0 << 0 << QModelIndex() << 2; QListWidget* tempWidget = createWidget(); QTest::addRow("move_child") << tempWidget << tempWidget->model()->index(0, 0) << 0 << 1 << QModelIndex() << 2; @@ -187,10 +188,11 @@ void tst_QListWidget::moveRowsInvalid_data() QTest::addRow("negative_count") << createWidget() << QModelIndex() << 0 << -1 << QModelIndex() << 2; QTest::addRow("negative_source_row") << createWidget() << QModelIndex() << -1 << 1 << QModelIndex() << 2; QTest::addRow("negative_destination_row") << createWidget() << QModelIndex() << 0 << 1 << QModelIndex() << -1; - QTest::addRow("source_row_equal_rowCount") << createWidget() << QModelIndex() << 6 << 1 << QModelIndex() << 1; - QTest::addRow("destination_row_greater_rowCount") << createWidget() << QModelIndex() << 0 << 1 << QModelIndex() << 6 + 1; + QTest::addRow("source_row_equal_rowCount") << createWidget() << QModelIndex() << rowCount << 1 << QModelIndex() << 1; + QTest::addRow("source_row_equal_destination_row") << createWidget() << QModelIndex() << 2 << 1 << QModelIndex() << 2; + QTest::addRow("source_row_equal_destination_row_plus1") << createWidget() << QModelIndex() << 2 << 1 << QModelIndex() << 3; + QTest::addRow("destination_row_greater_rowCount") << createWidget() << QModelIndex() << 0 << 1 << QModelIndex() << rowCount + 1; QTest::addRow("move_row_within_source_range") << createWidget() << QModelIndex() << 0 << 3 << QModelIndex() << 2; - QTest::addRow("destination_row_before_0") << createWidget() << QModelIndex() << 1 << 1 << QModelIndex() << 0; } void tst_QListWidget::moveRowsInvalid() @@ -221,20 +223,20 @@ void tst_QListWidget::moveRows_data() QTest::newRow("1_Item_from_top_to_middle") << 0 << 1 << 3 << QStringList{"B", "C", "A", "D", "E", "F"}; QTest::newRow("1_Item_from_top_to_bottom") << 0 << 1 << 6 << QStringList{"B", "C", "D", "E", "F", "A"}; - QTest::newRow("1_Item_from_middle_to_top") << 2 << 1 << 1 << QStringList{"C", "A", "B", "D", "E", "F"}; - QTest::newRow("1_Item_from_bottom_to_middle") << 5 << 1 << 3 << QStringList{"A", "B", "F", "C", "D", "E"}; - QTest::newRow("1_Item_from_bottom to_top") << 5 << 1 << 1 << QStringList{"F", "A", "B", "C", "D", "E"}; + QTest::newRow("1_Item_from_middle_to_top") << 2 << 1 << 0 << QStringList{"C", "A", "B", "D", "E", "F"}; + QTest::newRow("1_Item_from_bottom_to_middle") << 5 << 1 << 2 << QStringList{"A", "B", "F", "C", "D", "E"}; + QTest::newRow("1_Item_from_bottom to_top") << 5 << 1 << 0 << QStringList{"F", "A", "B", "C", "D", "E"}; QTest::newRow("1_Item_from_middle_to_bottom") << 2 << 1 << 6 << QStringList{"A", "B", "D", "E", "F", "C"}; - QTest::newRow("1_Item_from_middle_to_middle_before") << 2 << 1 << 1 << QStringList{"C", "A", "B", "D", "E", "F"}; + QTest::newRow("1_Item_from_middle_to_middle_before") << 2 << 1 << 1 << QStringList{"A", "C", "B", "D", "E", "F"}; QTest::newRow("1_Item_from_middle_to_middle_after") << 2 << 1 << 4 << QStringList{"A", "B", "D", "C", "E", "F"}; QTest::newRow("2_Items_from_top_to_middle") << 0 << 2 << 3 << QStringList{"C", "A", "B", "D", "E", "F"}; QTest::newRow("2_Items_from_top_to_bottom") << 0 << 2 << 6 << QStringList{"C", "D", "E", "F", "A", "B"}; - QTest::newRow("2_Items_from_middle_to_top") << 2 << 2 << 1 << QStringList{"C", "D", "A", "B", "E", "F"}; - QTest::newRow("2_Items_from_bottom_to_middle") << 4 << 2 << 3 << QStringList{"A", "B", "E", "F", "C", "D"}; - QTest::newRow("2_Items_from_bottom_to_top") << 4 << 2 << 1 << QStringList{"E", "F", "A", "B", "C", "D"}; + QTest::newRow("2_Items_from_middle_to_top") << 2 << 2 << 0 << QStringList{"C", "D", "A", "B", "E", "F"}; + QTest::newRow("2_Items_from_bottom_to_middle") << 4 << 2 << 2 << QStringList{"A", "B", "E", "F", "C", "D"}; + QTest::newRow("2_Items_from_bottom_to_top") << 4 << 2 << 0 << QStringList{"E", "F", "A", "B", "C", "D"}; QTest::newRow("2_Items_from_middle_to_bottom") << 2 << 2 << 6 << QStringList{"A", "B", "E", "F", "C", "D"}; - QTest::newRow("2_Items_from_middle_to_middle_before") << 3 << 2 << 2 << QStringList{"A", "D", "E", "B", "C", "F"}; + QTest::newRow("2_Items_from_middle_to_middle_before") << 3 << 2 << 1 << QStringList{"A", "D", "E", "B", "C", "F"}; QTest::newRow("2_Items_from_middle_to_middle_after") << 1 << 2 << 5 << QStringList{"A", "D", "E", "B", "C", "F"}; } -- cgit v1.2.3 From e1dbb737012e3e7aa818b45bf2804b866f4b7d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 13 Jan 2020 18:35:08 +0100 Subject: Blacklist tst_QTableView::mouseWheel on macOS There's a timing issue that affects the position of the vertical scrollbar when scrolling by pixels. Change-Id: I29d73574785be539a5870b498a902b1aba887e9c Reviewed-by: Simon Hausmann --- tests/auto/widgets/itemviews/qtableview/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/auto/widgets/itemviews') diff --git a/tests/auto/widgets/itemviews/qtableview/BLACKLIST b/tests/auto/widgets/itemviews/qtableview/BLACKLIST index 9648cef3de..ff870915be 100644 --- a/tests/auto/widgets/itemviews/qtableview/BLACKLIST +++ b/tests/auto/widgets/itemviews/qtableview/BLACKLIST @@ -1,3 +1,5 @@ [moveCursorBiggerJump] osx +[mouseWheel:scroll down per pixel] +macos -- cgit v1.2.3