diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-09-07 01:00:48 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-09-07 01:00:48 +0200 |
commit | f21330b7497db846deb0c16a8e70ac1fecb522ba (patch) | |
tree | 1a493eedb9c382462079d9c144970343f2dc6296 /tests | |
parent | e8dacba47a59944e4a5ca271c4698e5dfbdbe9d5 (diff) | |
parent | 35ebdeb83eb4057f5e50042747b13d0772051459 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I799e2ca2fefa140c8b73b73aa959c6ed8da6eae6
Diffstat (limited to 'tests')
6 files changed, 188 insertions, 1 deletions
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp index 646f96c3a1..82cd26971b 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp @@ -32,6 +32,7 @@ #include <QtCore/QCoreApplication> #include <QtGui/QStandardItem> +#include <QtWidgets/QComboBox> #include <QtWidgets/QTreeView> #include <QtWidgets/QTableView> @@ -506,6 +507,58 @@ void tst_QSortFilterProxyModel::prependRow() QCOMPARE(proxy.rowCount(QModelIndex()), 1); //only the "root" item is there } +void tst_QSortFilterProxyModel::appendRowFromCombobox_data() +{ + QTest::addColumn<QString>("pattern"); + QTest::addColumn<QStringList>("initial"); + QTest::addColumn<QString>("newitem"); + QTest::addColumn<QStringList>("expected"); + + QTest::newRow("filter_out_second_last_item") + << "^[0-9]*$" + << (QStringList() << "a" << "1") + << "2" + << (QStringList() << "a" << "1" << "2"); + + QTest::newRow("filter_out_everything") + << "^c*$" + << (QStringList() << "a" << "b") + << "c" + << (QStringList() << "a" << "b" << "c"); + + QTest::newRow("no_filter") + << "" + << (QStringList() << "0" << "1") + << "2" + << (QStringList() << "0" << "1" << "2"); + + QTest::newRow("filter_out_last_item") + << "^[a-z]*$" + << (QStringList() << "a" << "1") + << "b" + << (QStringList() << "a" << "1" << "b"); +} + +void tst_QSortFilterProxyModel::appendRowFromCombobox() +{ + QFETCH(QString, pattern); + QFETCH(QStringList, initial); + QFETCH(QString, newitem); + QFETCH(QStringList, expected); + + QStringListModel model(initial); + + QSortFilterProxyModel proxy; + proxy.setSourceModel(&model); + proxy.setFilterRegExp(pattern); + + QComboBox comboBox; + comboBox.setModel(&proxy); + comboBox.addItem(newitem); + + QCOMPARE(model.stringList(), expected); +} + void tst_QSortFilterProxyModel::removeRows_data() { QTest::addColumn<QStringList>("initial"); diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.h b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.h index 4ea5e8fb6a..82d4b7344e 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.h +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.h @@ -72,6 +72,8 @@ private slots: void insertRows_data(); void insertRows(); void prependRow(); + void appendRowFromCombobox_data(); + void appendRowFromCombobox(); void removeRows_data(); void removeRows(); void removeColumns_data(); diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index f6ed3e142d..e2d7a41bd1 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -750,7 +750,11 @@ void tst_QStandardItemModel::data() QCOMPARE(m_model->data(m_model->index(0, 0), Qt::DisplayRole).toString(), QLatin1String("initialitem")); QCOMPARE(m_model->data(m_model->index(0, 0), Qt::ToolTipRole).toString(), QLatin1String("tooltip")); - + const QMap<int, QVariant> itmData = m_model->itemData(m_model->index(0, 0)); + QCOMPARE(itmData.value(Qt::DisplayRole), QLatin1String("initialitem")); + QCOMPARE(itmData.value(Qt::ToolTipRole), QLatin1String("tooltip")); + QVERIFY(!itmData.contains(Qt::UserRole - 1)); + QVERIFY(m_model->itemData(QModelIndex()).isEmpty()); } void tst_QStandardItemModel::clearItemData() diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 76186f5575..09bea20d26 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -131,6 +131,13 @@ public: setAutoBufferSwap(false); } + void resizeEvent(QResizeEvent *e) + { + m_thread->lock(); + QGLWidget::resizeEvent(e); + m_thread->unlock(); + } + void paintEvent(QPaintEvent *) { m_thread->lock(); diff --git a/tests/auto/tools/uic/baseline/pixmapfunction.ui b/tests/auto/tools/uic/baseline/pixmapfunction.ui new file mode 100644 index 0000000000..8edafc7248 --- /dev/null +++ b/tests/auto/tools/uic/baseline/pixmapfunction.ui @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Form</class> + <widget class="QWidget" name="Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>149</width> + <height>112</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap>labelPixmap</pixmap> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton"> + <property name="text"> + <string>PushButton</string> + </property> + <property name="icon"> + <iconset> + <normaloff>buttonIconNormalOff</normaloff> + <normalon>buttonIconNormalOn</normalon> + <disabledoff>buttonIconDisabledOff</disabledoff> + <disabledon>buttonIconDisabledOn</disabledon> + </iconset> + </property> + </widget> + </item> + </layout> + </widget> + <pixmapfunction>pixmapFunction</pixmapfunction> + <resources/> + <connections/> +</ui> diff --git a/tests/auto/tools/uic/baseline/pixmapfunction.ui.h b/tests/auto/tools/uic/baseline/pixmapfunction.ui.h new file mode 100644 index 0000000000..1644380c15 --- /dev/null +++ b/tests/auto/tools/uic/baseline/pixmapfunction.ui.h @@ -0,0 +1,74 @@ +/******************************************************************************** +** Form generated from reading UI file 'pixmapfunction.ui' +** +** Created by: Qt User Interface Compiler version 5.12.0 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef PIXMAPFUNCTION_H +#define PIXMAPFUNCTION_H + +#include <QtCore/QVariant> +#include <QtGui/QIcon> +#include <QtWidgets/QApplication> +#include <QtWidgets/QLabel> +#include <QtWidgets/QPushButton> +#include <QtWidgets/QVBoxLayout> +#include <QtWidgets/QWidget> + +QT_BEGIN_NAMESPACE + +class Ui_Form +{ +public: + QVBoxLayout *verticalLayout; + QLabel *label; + QPushButton *pushButton; + + void setupUi(QWidget *Form) + { + if (Form->objectName().isEmpty()) + Form->setObjectName(QString::fromUtf8("Form")); + Form->resize(149, 112); + verticalLayout = new QVBoxLayout(Form); + verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); + label = new QLabel(Form); + label->setObjectName(QString::fromUtf8("label")); + label->setPixmap(QPixmap(pixmapFunction("labelPixmap"))); + + verticalLayout->addWidget(label); + + pushButton = new QPushButton(Form); + pushButton->setObjectName(QString::fromUtf8("pushButton")); + QIcon icon; + icon.addPixmap(QPixmap(pixmapFunction("buttonIconNormalOff")), QIcon::Normal, QIcon::Off); + icon.addPixmap(QPixmap(pixmapFunction("buttonIconNormalOn")), QIcon::Normal, QIcon::On); + icon.addPixmap(QPixmap(pixmapFunction("buttonIconDisabledOff")), QIcon::Disabled, QIcon::Off); + icon.addPixmap(QPixmap(pixmapFunction("buttonIconDisabledOn")), QIcon::Disabled, QIcon::On); + pushButton->setIcon(icon); + + verticalLayout->addWidget(pushButton); + + + retranslateUi(Form); + + QMetaObject::connectSlotsByName(Form); + } // setupUi + + void retranslateUi(QWidget *Form) + { + Form->setWindowTitle(QApplication::translate("Form", "Form", nullptr)); + label->setText(QString()); + pushButton->setText(QApplication::translate("Form", "PushButton", nullptr)); + } // retranslateUi + +}; + +namespace Ui { + class Form: public Ui_Form {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // PIXMAPFUNCTION_H |