aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMohammadHossein Qanbari <[email protected]>2024-10-15 16:33:58 +0200
committerMohammadHossein Qanbari <[email protected]>2024-11-27 09:03:42 +0100
commit0edf656a2ea2c3fec34892b5f878855d0b094af7 (patch)
tree10e36c01eca41c44c6fd715e9e175cfe179597d4 /tests
parent77a20c00e64010c661b9121e8c114065ae5346e0 (diff)
Controls: Add TableViewDelegate
This patch introduces TableViewDelegate to the Controls module. Key features: - Ready-made delegate assignable to TableView - Handles table drawing using predefined styles - Usable without customization - Implements all required properties set by TableView - Provides API for changing background and label Test Suite: - Verifies TableViewDelegate properties and functionalities - Tests include: - Verification of selected, current, and content text properties - Validation of selection behavior and item clicking BLACKLISTing two tests (dragToSelect and pressAndHoldToSelect), which will be removed from the BLACKLIST in the next patch (to fix cell selection on the Android platform). Implementation derived from TreeViewDelegate, adapted for TableView use. TreeViewDelegate patch: 0ddb0d4b9b0c70c4fd4058ef4660e38fd933523e [ChangeLog][Controls] New delegate added: TableViewDelegate Fixes: QTBUG-114636 Change-Id: Ibb8b0a7622016e0c6fd58d696e507e7bb76daced Reviewed-by: Mitch Curtis <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quickcontrols/CMakeLists.txt4
-rw-r--r--tests/auto/quickcontrols/qquicktableviewdelegate/BLACKLIST6
-rw-r--r--tests/auto/quickcontrols/qquicktableviewdelegate/CMakeLists.txt39
-rw-r--r--tests/auto/quickcontrols/qquicktableviewdelegate/data/unmodified.qml32
-rw-r--r--tests/auto/quickcontrols/qquicktableviewdelegate/testmodel.cpp63
-rw-r--r--tests/auto/quickcontrols/qquicktableviewdelegate/testmodel.h43
-rw-r--r--tests/auto/quickcontrols/qquicktableviewdelegate/tst_qquicktableviewdelegate.cpp285
-rw-r--r--tests/benchmarks/quickcontrols/creationtime/tst_creationtime.cpp3
-rw-r--r--tests/benchmarks/quickcontrols/objectcount/tst_objectcount.cpp3
9 files changed, 476 insertions, 2 deletions
diff --git a/tests/auto/quickcontrols/CMakeLists.txt b/tests/auto/quickcontrols/CMakeLists.txt
index b7669d4f54..7d3815b606 100644
--- a/tests/auto/quickcontrols/CMakeLists.txt
+++ b/tests/auto/quickcontrols/CMakeLists.txt
@@ -54,6 +54,10 @@ add_subdirectory(styleimportscompiletimematerial)
add_subdirectory(styleimportscompiletimeqmlonly)
add_subdirectory(translation)
+if (QT_FEATURE_quick_tableview)
+ add_subdirectory(qquicktableviewdelegate)
+endif()
+
if (QT_FEATURE_quick_treeview)
add_subdirectory(qquicktreeviewdelegate)
endif()
diff --git a/tests/auto/quickcontrols/qquicktableviewdelegate/BLACKLIST b/tests/auto/quickcontrols/qquicktableviewdelegate/BLACKLIST
new file mode 100644
index 0000000000..ed6d7fd2cf
--- /dev/null
+++ b/tests/auto/quickcontrols/qquicktableviewdelegate/BLACKLIST
@@ -0,0 +1,6 @@
+# perhaps related to QTBUG-103072
+[dragToSelect]
+android
+# perhaps related to QTBUG-103064
+[pressAndHoldToSelect]
+android
diff --git a/tests/auto/quickcontrols/qquicktableviewdelegate/CMakeLists.txt b/tests/auto/quickcontrols/qquicktableviewdelegate/CMakeLists.txt
new file mode 100644
index 0000000000..9f045719ac
--- /dev/null
+++ b/tests/auto/quickcontrols/qquicktableviewdelegate/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qquicktableviewdelegate LANGUAGES C CXX ASM)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
+#####################################################################
+## tst_qquicktableviewdelegate Test:
+#####################################################################
+
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ data/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_qquicktableviewdelegate
+ SOURCES
+ testmodel.h testmodel.cpp
+ tst_qquicktableviewdelegate.cpp
+ LIBRARIES
+ Qt::QuickPrivate
+ Qt::QuickTestUtilsPrivate
+ Qt::QuickTemplates2Private
+ TESTDATA ${test_data}
+)
+
+qt_internal_extend_target(tst_qquicktableviewdelegate CONDITION ANDROID OR IOS
+ DEFINES
+ QT_QMLTEST_DATADIR=":/data"
+)
+
+qt_internal_extend_target(tst_qquicktableviewdelegate CONDITION NOT ANDROID AND NOT IOS
+ DEFINES
+ QT_QMLTEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
+)
diff --git a/tests/auto/quickcontrols/qquicktableviewdelegate/data/unmodified.qml b/tests/auto/quickcontrols/qquicktableviewdelegate/data/unmodified.qml
new file mode 100644
index 0000000000..44b3d09549
--- /dev/null
+++ b/tests/auto/quickcontrols/qquicktableviewdelegate/data/unmodified.qml
@@ -0,0 +1,32 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import TestModel
+import QtQuick.Controls
+
+Item {
+ width: 800
+ height: 600
+
+ property alias tableView: tableView
+ property alias selectionRectangle: selectionRectangle
+
+ TableView {
+ id: tableView
+ anchors.fill:parent
+ anchors.margins: 10
+ model: TestModel {}
+ clip: true
+
+ delegate: TableViewDelegate {
+ readonly property string displayText: contentItem ? contentItem.text : null
+ }
+ selectionModel: ItemSelectionModel { model: tableView.model }
+ }
+
+ SelectionRectangle {
+ id: selectionRectangle
+ target: tableView
+ }
+}
diff --git a/tests/auto/quickcontrols/qquicktableviewdelegate/testmodel.cpp b/tests/auto/quickcontrols/qquicktableviewdelegate/testmodel.cpp
new file mode 100644
index 0000000000..ec72977683
--- /dev/null
+++ b/tests/auto/quickcontrols/qquicktableviewdelegate/testmodel.cpp
@@ -0,0 +1,63 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "testmodel.h"
+
+TestModel::TestModel(QObject *parent)
+ : QAbstractTableModel(parent)
+ , m_columnCount(1)
+ , m_rowCount(1)
+{
+ m_data.insert({0,0}, {{Qt::DisplayRole, "0,0"},});
+}
+
+void TestModel::appendColumn()
+{
+ beginInsertColumns(QModelIndex{}, m_columnCount, m_columnCount);
+ ++m_columnCount;
+ endInsertColumns();
+}
+
+void TestModel::appendRow()
+{
+ beginInsertRows(QModelIndex{}, m_rowCount, m_rowCount);
+ ++m_rowCount;
+ endInsertRows();
+}
+
+bool TestModel::setData(int row, int column, const QVariant &value, int role)
+{
+ return setData(index(row, column), value, role);
+}
+
+QVariant TestModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant{};
+
+ auto it_table = m_data.find({index.row(), index.column()});
+ if (it_table == m_data.end())
+ return QVariant{};
+
+ const CellData &cellData = it_table.value();
+ auto it_cell = cellData.find(role);
+ return (it_cell == cellData.end()) ? QVariant{} : it_cell.value();
+}
+
+bool TestModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ if (!index.isValid())
+ return false;
+
+ const Position pos{index.row(), index.column()};
+ auto it_table = m_data.find(pos);
+ if (it_table != m_data.end())
+ it_table.value().insert(role, value);
+ else
+ m_data.insert(pos, {{role, value},});
+
+ emit dataChanged(index, index);
+
+ return true;
+}
+
diff --git a/tests/auto/quickcontrols/qquicktableviewdelegate/testmodel.h b/tests/auto/quickcontrols/qquicktableviewdelegate/testmodel.h
new file mode 100644
index 0000000000..83509b2cf2
--- /dev/null
+++ b/tests/auto/quickcontrols/qquicktableviewdelegate/testmodel.h
@@ -0,0 +1,43 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef TESTMODEL_H
+#define TESTMODEL_H
+
+#include <QtCore/qabstractitemmodel.h>
+
+class TestModel : public QAbstractTableModel
+{
+ Q_OBJECT
+
+public:
+ explicit TestModel(QObject *parent = nullptr);
+
+ void appendColumn();
+ void appendRow();
+
+ bool setData(int row, int column, const QVariant &value, int role);
+
+ // QAbstractItemModel interface
+ int rowCount(const QModelIndex & = QModelIndex{}) const override { return m_rowCount; }
+ int columnCount(const QModelIndex & = QModelIndex{}) const override { return m_columnCount; }
+ QVariant data(const QModelIndex &index, int role) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
+
+private:
+ // use appendRow() instead
+ using QAbstractTableModel::insertRow;
+ using QAbstractTableModel::insertRows;
+ // use appendColumn() instead
+ using QAbstractTableModel::insertColumn;
+ using QAbstractTableModel::insertColumns;
+
+private:
+ using CellData = QHash<int, QVariant>;
+ using Position = QPair<int, int>;
+ QHash<Position, CellData> m_data;
+ int m_columnCount = 0;
+ int m_rowCount = 0;
+};
+
+#endif // TESTMODEL_H
diff --git a/tests/auto/quickcontrols/qquicktableviewdelegate/tst_qquicktableviewdelegate.cpp b/tests/auto/quickcontrols/qquicktableviewdelegate/tst_qquicktableviewdelegate.cpp
new file mode 100644
index 0000000000..ecf0fe4bc6
--- /dev/null
+++ b/tests/auto/quickcontrols/qquicktableviewdelegate/tst_qquicktableviewdelegate.cpp
@@ -0,0 +1,285 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "testmodel.h"
+
+#include <QtQuickTest/quicktest.h>
+
+#include <QtQuick/qquickview.h>
+#include <QtQuick/private/qquicktableview_p.h>
+#include <QtQuick/private/qquicktableview_p_p.h>
+
+#include <QtQuickTemplates2/private/qquicktableviewdelegate_p.h>
+
+#include <QtQuickTestUtils/private/viewtestutils_p.h>
+#include <QtQuickTestUtils/private/visualtestutils_p.h>
+
+#include <QtTest/QtTest>
+
+using namespace QQuickViewTestUtils;
+using namespace QQuickVisualTestUtils;
+
+#define LOAD_TABLEVIEW(fileName) \
+ view->setSource(testFileUrl(fileName)); \
+ view->show(); \
+ QVERIFY(QTest::qWaitForWindowActive(view.get())); \
+ QQuickTableView *tableView = getTableView(); \
+ QVERIFY(tableView); \
+ [[maybe_unused]] auto tableViewPrivate = QQuickTableViewPrivate::get(tableView); \
+ [[maybe_unused]] auto model = tableView->model().value<TestModel *>()
+
+// ########################################################
+
+class tst_qquicktableviewdelegate : public QQmlDataTest
+{
+ Q_OBJECT
+
+public:
+ tst_qquicktableviewdelegate();
+
+private slots:
+ void initTestCase() override;
+ void showTableView();
+ void checkProperties();
+ void checkCurrentIndex();
+ void checkClickedSignal_data();
+ void checkClickedSignal();
+ void clearSelectionOnClick();
+ void dragToSelect();
+ void pressAndHoldToSelect();
+
+private:
+ QQuickTableView *getTableView();
+ QQuickTableViewDelegate *getDelegateItem(int row, int column);
+
+private:
+ std::unique_ptr<QQuickView> view = nullptr;
+};
+
+tst_qquicktableviewdelegate::tst_qquicktableviewdelegate()
+ : QQmlDataTest(QT_QMLTEST_DATADIR)
+{
+}
+
+void tst_qquicktableviewdelegate::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ qmlRegisterType<TestModel>("TestModel", 1, 0, "TestModel");
+ view.reset(createView());
+}
+
+void tst_qquicktableviewdelegate::showTableView()
+{
+ LOAD_TABLEVIEW("unmodified.qml");
+ QCOMPARE(tableViewPrivate->loadedRows.count(), 1);
+ QCOMPARE(tableViewPrivate->loadedColumns.count(), 1);
+}
+
+void tst_qquicktableviewdelegate::checkProperties()
+{
+ LOAD_TABLEVIEW("unmodified.qml");
+ QCOMPARE(tableViewPrivate->loadedRows.count(), 1);
+ QCOMPARE(tableViewPrivate->loadedColumns.count(), 1);
+
+ const QQuickTableViewDelegate *item = getDelegateItem(0, 0);
+ QVERIFY(item);
+ QCOMPARE(item->property("displayText"), "0,0");
+ QCOMPARE(item->tableView(), tableView);
+
+ constexpr auto TEXT_0_1 = "0,1";
+ model->appendColumn();
+ model->setData(0, 1, TEXT_0_1, Qt::DisplayRole);
+ QVERIFY(QQuickTest::qWaitForPolish(tableView));
+
+ QCOMPARE(tableViewPrivate->loadedRows.count(), 1);
+ QCOMPARE(tableViewPrivate->loadedColumns.count(), 2);
+
+ item = getDelegateItem(0, 1);
+ QVERIFY(item);
+ QCOMPARE(item->property("displayText"), TEXT_0_1);
+ QCOMPARE(item->tableView(), tableView);
+
+ constexpr auto TEXT_1_0 = "1,0";
+ constexpr auto TEXT_1_1 = "1,1";
+ model->appendRow();
+ model->setData(1, 0, TEXT_1_0, Qt::DisplayRole);
+ model->setData(1, 1, TEXT_1_1, Qt::DisplayRole);
+ QVERIFY(QQuickTest::qWaitForPolish(tableView));
+
+ QCOMPARE(tableViewPrivate->loadedRows.count(), 2);
+ QCOMPARE(tableViewPrivate->loadedColumns.count(), 2);
+
+ item = getDelegateItem(1, 0);
+ QVERIFY(item);
+ QCOMPARE(item->property("displayText"), TEXT_1_0);
+ QCOMPARE(item->tableView(), tableView);
+
+ item = getDelegateItem(1, 1);
+ QVERIFY(item);
+ QCOMPARE(item->property("displayText"), TEXT_1_1);
+ QCOMPARE(item->tableView(), tableView);
+}
+
+void tst_qquicktableviewdelegate::checkCurrentIndex()
+{
+ // Check that that a cell becomes current when you click on it
+ LOAD_TABLEVIEW("unmodified.qml");
+ QCOMPARE(tableViewPrivate->loadedRows.count(), 1);
+
+ const QQuickTableViewDelegate *item = getDelegateItem(0, 0);
+ QVERIFY(item);
+ QVERIFY(!item->current());
+ QVERIFY(!item->selected());
+ QVERIFY(!item->editing());
+ QVERIFY(!tableView->hasActiveFocus());
+
+ // Click on the label
+ const QPoint localPos = QPoint(item->width() / 2, item->height() / 2);
+ const QPoint pos = item->window()->contentItem()->mapFromItem(item, localPos).toPoint();
+ QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier, pos);
+ QVERIFY(item->current());
+ QVERIFY(!item->selected());
+ QVERIFY(!item->editing());
+ QVERIFY(tableView->hasActiveFocus());
+
+ // Select the cell
+ tableView->selectionModel()->setCurrentIndex(tableView->modelIndex({0, 0}), QItemSelectionModel::Select);
+ QVERIFY(item->current());
+ QVERIFY(item->selected());
+ QVERIFY(!item->editing());
+}
+
+void tst_qquicktableviewdelegate::checkClickedSignal_data()
+{
+ QTest::addColumn<bool>("pointerNavigationEnabled");
+ QTest::newRow("pointer navigation enabled") << true;
+ QTest::newRow("pointer navigation disabled") << false;
+}
+
+void tst_qquicktableviewdelegate::checkClickedSignal()
+{
+ // Check that the delegate emits clicked when clicking on the
+ // label, but not when clicking on the indicator. This API is
+ // a part of the AbstractButton API, and should work with or
+ // without TableView.pointerNavigationEnabled set.
+ QFETCH(bool, pointerNavigationEnabled);
+
+ LOAD_TABLEVIEW("unmodified.qml");
+ tableView->setPointerNavigationEnabled(pointerNavigationEnabled);
+
+ const auto item = tableView->itemAtIndex(tableView->index(0, 0));
+ QVERIFY(item);
+
+ QSignalSpy clickedSpy(item, SIGNAL(clicked()));
+
+ // Click on the label
+ const QPoint localPos = QPoint(item->width() / 2, item->height() / 2);
+ const QPoint pos = item->window()->contentItem()->mapFromItem(item, localPos).toPoint();
+ QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier, pos);
+ QCOMPARE(clickedSpy.size(), 1);
+ clickedSpy.clear();
+}
+
+void tst_qquicktableviewdelegate::clearSelectionOnClick()
+{
+ LOAD_TABLEVIEW("unmodified.qml");
+
+ // Select root item
+ const auto index = tableView->selectionModel()->model()->index(0, 0);
+ tableView->selectionModel()->select(index, QItemSelectionModel::Select);
+ QCOMPARE(tableView->selectionModel()->selectedIndexes().size(), 1);
+
+ // Click on a cell. This should remove the selection
+ const auto item = getDelegateItem(0, 0);
+ QVERIFY(item);
+ const QPoint localPos = QPoint(item->width() / 2, item->height() / 2);
+ const QPoint pos = item->window()->contentItem()->mapFromItem(item, localPos).toPoint();
+ QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier, pos);
+ QCOMPARE(tableView->selectionModel()->selectedIndexes().size(), 0);
+}
+
+void tst_qquicktableviewdelegate::dragToSelect()
+{
+ // Check that the delegate is not blocking the user from
+ // being able to select cells using Drag.
+ LOAD_TABLEVIEW("unmodified.qml");
+
+ // When TableView is not interactive, SelectionRectangle
+ // will use Drag by default.
+ tableView->setInteractive(false);
+
+ QVERIFY(!tableView->selectionModel()->hasSelection());
+ QCOMPARE(tableView->selectionBehavior(), QQuickTableView::SelectCells);
+
+ model->appendColumn();
+ model->setData(0, 1, "0,1", Qt::DisplayRole);
+ QCOMPARE(model->columnCount(), 2);
+ QCOMPARE(model->rowCount(), 1);
+
+ QVERIFY(QQuickTest::qWaitForPolish(tableView));
+
+ // Drag on from cell 0,0 to 0,1
+ const auto item0_0 = getDelegateItem(0, 0);
+ QVERIFY(item0_0);
+ const auto item0_1 = getDelegateItem(0, 1);
+ QVERIFY(item0_1);
+
+ QQuickWindow *window = tableView->window();
+ const QPoint localPos0_0(item0_0->width() / 2, item0_0->height() / 2);
+ const QPoint windowPos0_0 = window->contentItem()->mapFromItem(item0_0, localPos0_0).toPoint();
+ const QPoint localPos0_1(item0_1->width() / 2, item0_1->height() / 2);
+ const QPoint windowPos0_1 = window->contentItem()->mapFromItem(item0_1, localPos0_1).toPoint();
+
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, windowPos0_0);
+ QTest::mouseMove(window, windowPos0_1);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, windowPos0_1);
+
+ QCOMPARE(tableView->selectionModel()->selectedIndexes().size(), 2);
+ QVERIFY(item0_0->selected());
+ QVERIFY(item0_1->selected());
+}
+
+void tst_qquicktableviewdelegate::pressAndHoldToSelect()
+{
+ // Check that the delegate is not blocking the user from
+ // being able to select cells using PressAndHold
+ LOAD_TABLEVIEW("unmodified.qml");
+
+ // When TableView is interactive, SelectionRectangle
+ // will use PressAndHold by default.
+ tableView->setInteractive(true);
+
+ QVERIFY(!tableView->selectionModel()->hasSelection());
+ QCOMPARE(tableView->selectionBehavior(), QQuickTableView::SelectCells);
+
+ // PressAndHold on cell 0,0
+ const auto item0_0 = getDelegateItem(0, 0);
+ QVERIFY(item0_0);
+
+ QQuickWindow *window = tableView->window();
+ const QPoint localPos0_0(item0_0->width() / 2, item0_0->height() / 2);
+ const QPoint windowPos0_0 = window->contentItem()->mapFromItem(item0_0, localPos0_0).toPoint();
+
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, windowPos0_0);
+ QTRY_VERIFY(tableView->selectionModel()->hasSelection());
+ QCOMPARE(tableView->selectionModel()->selectedIndexes().size(), 1);
+ QVERIFY(item0_0->selected());
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, windowPos0_0);
+}
+
+QQuickTableView *tst_qquicktableviewdelegate::getTableView()
+{
+ return view->rootObject()->property("tableView").value<QQuickTableView *>();
+}
+
+QQuickTableViewDelegate *tst_qquicktableviewdelegate::getDelegateItem(int row, int column)
+{
+ auto tableView = getTableView();
+ if (!tableView)
+ return nullptr;
+ return qobject_cast<QQuickTableViewDelegate *>(tableView->itemAtCell({column, row}));
+}
+
+QTEST_MAIN(tst_qquicktableviewdelegate)
+
+#include "tst_qquicktableviewdelegate.moc"
diff --git a/tests/benchmarks/quickcontrols/creationtime/tst_creationtime.cpp b/tests/benchmarks/quickcontrols/creationtime/tst_creationtime.cpp
index 8f525ea766..44edd815e5 100644
--- a/tests/benchmarks/quickcontrols/creationtime/tst_creationtime.cpp
+++ b/tests/benchmarks/quickcontrols/creationtime/tst_creationtime.cpp
@@ -83,8 +83,9 @@ void tst_CreationTime::basic_data()
QTest::addColumn<QUrl>("url");
// Calendar is excluded because it's a singleton and can't be created.
// TreeViewDelegate is excluded since it's a delegate that can only be created by TreeView.
+ // TableViewDelegate is excluded since it's a delegate that can only be created by TableView.
addTestRowForEachControl(styleHelper.engine.data(), QQC2_IMPORT_PATH, "basic", "QtQuick/Controls/Basic",
- QStringList() << "ApplicationWindow" << "Calendar" << "TreeViewDelegate");
+ QStringList() << "ApplicationWindow" << "Calendar" << "TreeViewDelegate" << "TableViewDelegate");
}
void tst_CreationTime::fusion()
diff --git a/tests/benchmarks/quickcontrols/objectcount/tst_objectcount.cpp b/tests/benchmarks/quickcontrols/objectcount/tst_objectcount.cpp
index f4119f0737..1a06cdf629 100644
--- a/tests/benchmarks/quickcontrols/objectcount/tst_objectcount.cpp
+++ b/tests/benchmarks/quickcontrols/objectcount/tst_objectcount.cpp
@@ -64,8 +64,9 @@ static void initTestRows(QQmlEngine *engine)
{
// Calendar is excluded because it's a singleton and can't be created.
// TreeViewDelegate is excluded since it's a delegate that can only be created by TreeView.
+ // TableViewDelegate is excluded since it's a delegate that can only be created by TableView.
addTestRowForEachControl(engine, QQC2_IMPORT_PATH, "basic", "QtQuick/Controls/Basic",
- QStringList() << "Calendar" << "TreeViewDelegate");
+ QStringList() << "Calendar" << "TreeViewDelegate" << "TableViewDelegate");
addTestRowForEachControl(engine, QQC2_IMPORT_PATH, "fusion", "QtQuick/Controls/Fusion",
QStringList() << "ButtonPanel" << "CheckIndicator" << "RadioIndicator" << "SliderGroove"
<< "SliderHandle" << "SwitchIndicator" << "TreeViewDelegate");