diff options
Diffstat (limited to 'tests/auto/widgets')
8 files changed, 172 insertions, 1 deletions
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 2c0b3f2bcb..51bed6ddfe 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -226,6 +226,21 @@ void tst_QFileSystemModel::rootPath() QCOMPARE(rootChanged.count(), oldCount + 1); QCOMPARE(model->rootDirectory().absolutePath(), newdir.path()); } + +#ifdef Q_OS_WIN + // check case insensitive root node on windows, tests QTBUG-71701 + QModelIndex index = model->setRootPath(QString("\\\\localhost\\c$")); + QVERIFY(index.isValid()); + QCOMPARE(model->rootPath(), QString("//localhost/c$")); + + index = model->setRootPath(QString("\\\\localhost\\C$")); + QVERIFY(index.isValid()); + QCOMPARE(model->rootPath(), QString("//localhost/C$")); + + index = model->setRootPath(QString("\\\\LOCALHOST\\C$")); + QVERIFY(index.isValid()); + QCOMPARE(model->rootPath(), QString("//LOCALHOST/C$")); +#endif } void tst_QFileSystemModel::readOnly() diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 52fac891c0..b75defe168 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -241,6 +241,7 @@ private slots: void taskQTBUG_7232_AllowUserToControlSingleStep(); void taskQTBUG_8376(); void taskQTBUG_61476(); + void taskQTBUG_42469_crash(); void testInitialFocus(); void fetchUntilScreenFull(); }; @@ -4966,6 +4967,29 @@ void tst_QTreeView::taskQTBUG_61476() QCOMPARE(lastTopLevel->checkState(), Qt::Checked); } +void tst_QTreeView::taskQTBUG_42469_crash() +{ + QTreeWidget treeWidget; + QTreeWidgetItem *itemOne = new QTreeWidgetItem(QStringList("item1")); + QTreeWidgetItem *itemTwo = new QTreeWidgetItem(QStringList("item2")); + treeWidget.addTopLevelItem(itemOne); + treeWidget.addTopLevelItem(itemTwo); + treeWidget.topLevelItem(1)->addChild(new QTreeWidgetItem(QStringList("child1"))); + + treeWidget.setAnimated(true); + QObject::connect(&treeWidget, &QTreeWidget::itemExpanded, [&](QTreeWidgetItem* p_item) { + auto tempCount = treeWidget.topLevelItemCount(); + for (int j = 0; j < tempCount; ++j) + if (treeWidget.topLevelItem(j) != p_item) { + auto temp = treeWidget.topLevelItem(j); + temp->setHidden(true); + } + }); + + treeWidget.show(); + itemTwo->setExpanded(true); +} + void tst_QTreeView::fetchUntilScreenFull() { class TreeModel : public QAbstractItemModel diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 7da56ab797..b129868bbd 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -151,6 +151,7 @@ private slots: void getMimeDataWithInvalidItem(); void testVisualItemRect(); void reparentHiddenItem(); + void persistentChildIndex(); #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void clearItemData(); #endif @@ -3597,6 +3598,21 @@ void tst_QTreeWidget::reparentHiddenItem() QVERIFY(grandChild->isHidden()); } +void tst_QTreeWidget::persistentChildIndex() // QTBUG-90030 +{ + QTreeWidget tree; + QTreeWidgetItem *toplevel = new QTreeWidgetItem(QStringList{QStringLiteral("toplevel")}); + tree.addTopLevelItem(toplevel); + QModelIndex firstIndex = tree.model()->index(0, 0); + QTreeWidgetItem *child1 = new QTreeWidgetItem(QStringList{QStringLiteral("child1")}); + QTreeWidgetItem *child2 = new QTreeWidgetItem(QStringList{QStringLiteral("child2")}); + toplevel->addChildren({child1, child2}); + QPersistentModelIndex persistentIdx = tree.model()->index(1, 0, firstIndex); + QCOMPARE(persistentIdx.data().toString(), QStringLiteral("child2")); + tree.model()->removeRows(0, 1, firstIndex); + QCOMPARE(persistentIdx.data().toString(), QStringLiteral("child2")); +} + #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void tst_QTreeWidget::clearItemData() { diff --git a/tests/auto/widgets/kernel/qgesturerecognizer/BLACKLIST b/tests/auto/widgets/kernel/qgesturerecognizer/BLACKLIST new file mode 100644 index 0000000000..f9104cc307 --- /dev/null +++ b/tests/auto/widgets/kernel/qgesturerecognizer/BLACKLIST @@ -0,0 +1,3 @@ +# See qtbase/src/testlib/qtestblacklist.cpp for format +[panGesture] +linux diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index c8fe1841c8..c38ddbf4dc 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -69,6 +69,7 @@ private slots: void controlTypes2(); void adjustSizeShouldMakeSureLayoutIsActivated(); void testRetainSizeWhenHidden(); + void removeWidget(); }; tst_QLayout::tst_QLayout() @@ -381,5 +382,28 @@ void tst_QLayout::testRetainSizeWhenHidden() QCOMPARE(widget.sizeHint().height(), normalHeight); } +void tst_QLayout::removeWidget() +{ + QHBoxLayout layout; + QCOMPARE(layout.count(), 0); + QWidget w; + layout.addWidget(&w); + QCOMPARE(layout.count(), 1); + layout.removeWidget(&w); + QCOMPARE(layout.count(), 0); + + QPointer<QLayout> childLayout(new QHBoxLayout); + layout.addLayout(childLayout); + QCOMPARE(layout.count(), 1); + + layout.removeWidget(nullptr); + QCOMPARE(layout.count(), 1); + + layout.removeItem(childLayout); + QCOMPARE(layout.count(), 0); + + QVERIFY(!childLayout.isNull()); +} + QTEST_MAIN(tst_QLayout) #include "tst_qlayout.moc" diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 70ea8433a6..ec38d565e4 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -12,6 +12,7 @@ ubuntu-16.04 rhel-7.6 opensuse-leap ubuntu +sles [raise] opensuse-leap # QTBUG-68175 @@ -37,6 +38,7 @@ ubuntu-16.04 rhel-7.6 opensuse-leap ubuntu +sles-15 [windowState] # QTBUG-75270 winrt diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index d8bb34933a..32437050f5 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -167,6 +167,7 @@ private slots: void task_QTBUG_52027_mapCompleterIndex(); void checkMenuItemPosWhenStyleSheetIsSet(); void checkEmbeddedLineEditWhenStyleSheetIsSet(); + void propagateStyleChanges(); private: PlatformInputContext m_platformInputContext; @@ -3586,5 +3587,50 @@ void tst_QComboBox::checkEmbeddedLineEditWhenStyleSheetIsSet() qApp->setStyleSheet(oldCss); } +/*! + Tests that the style-based frame style propagates to the internal container + widget of QComboBox when the style changes by verifying that the respective + styleHint is asked for when the style changes. + + See QTBUG-92488 +*/ +void tst_QComboBox::propagateStyleChanges() +{ + class FrameStyle : public QProxyStyle + { + public: + FrameStyle(int frameStyle, QStyle *style = nullptr) + : QProxyStyle(style), frameStyle(frameStyle) + {} + + int styleHint(QStyle::StyleHint hint, const QStyleOption *opt, + const QWidget *widget, QStyleHintReturn *returnData) const + { + if (hint == QStyle::SH_ComboBox_PopupFrameStyle) { + inquired = true; + return frameStyle; + } + return QProxyStyle::styleHint(hint, opt, widget, returnData); + } + + int frameStyle; + mutable bool inquired = false; + }; + + FrameStyle framelessStyle(QFrame::NoFrame); + FrameStyle frameStyle(QFrame::Plain | QFrame::Sunken); + + QComboBox combo; + // container will be created and take settings from this style + combo.setStyle(&framelessStyle); + QVERIFY(framelessStyle.inquired); + combo.addItem(QLatin1String("Open")); + combo.addItem(QLatin1String("Close")); + // needed because of QComboBox's adjustSizeTimer not doing anything otherwise + combo.setSizeAdjustPolicy(QComboBox::AdjustToContents); + combo.setStyle(&frameStyle); + QVERIFY(frameStyle.inquired); +} + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index e3b046e448..91bc638257 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -1,4 +1,4 @@ -/**************************************************************************** +/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ @@ -282,6 +282,8 @@ private slots: void nativeSubWindows(); void task_209615(); void task_236750(); + void qtbug92240_title_data(); + void qtbug92240_title(); private: QMdiSubWindow *activeWindow; @@ -2749,6 +2751,45 @@ void tst_QMdiArea::task_236750() subWindow->showMinimized(); } +// QTBUG-92240: When subwindows are maximized, their title is supposed to +// appear on the main window. When DontMaximizeSubWindowOnActivation was set, +// titles of previously created maximized windows interfered, resulting in +// "QTBUG-92240 - [1] - [2]". +void tst_QMdiArea::qtbug92240_title_data() +{ + QTest::addColumn<bool>("dontMaximize"); + QTest::newRow("default") << false; + QTest::newRow("dontMaximize") << true; +} + +void tst_QMdiArea::qtbug92240_title() +{ + QFETCH(bool, dontMaximize); + +#ifdef Q_OS_MACOS + QSKIP("Not supported on macOS"); +#endif + + QMainWindow w; + const QString title = QStringLiteral("QTBUG-92240"); + w.setWindowTitle(title); + w.menuBar()->addMenu(QStringLiteral("File")); + w.show(); + + auto *mdiArea = new QMdiArea; + w.setCentralWidget(mdiArea); + if (dontMaximize) + mdiArea->setOption(QMdiArea::DontMaximizeSubWindowOnActivation); + auto *sw1 = mdiArea->addSubWindow(new QWidget); + sw1->setWindowTitle(QStringLiteral("1")); + sw1->showMaximized(); + QTRY_COMPARE(w.windowTitle(), QLatin1String("QTBUG-92240 - [1]")); + auto *sw2 = mdiArea->addSubWindow(new QWidget); + sw2->setWindowTitle(QStringLiteral("2")); + sw2->showMaximized(); + QTRY_COMPARE(w.windowTitle(), QLatin1String("QTBUG-92240 - [2]")); +} + QTEST_MAIN(tst_QMdiArea) #include "tst_qmdiarea.moc" |