summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-12-29 15:56:33 +0100
committerLars Knoll <lars.knoll@qt.io>2017-12-30 12:09:53 +0100
commitdb92f2f3aac60218756a1aa8811cf192acc0b0e6 (patch)
treef28a47aebb2f08e221fe7bffafce62a0a96cf7fd /tests/auto/widgets
parentdd61a1d98ea9fbffeaf0e2adcd0ddd58105f6a75 (diff)
parent44da5b863597e761df3545dc7ff02a9b53bbb13d (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: .qmake.conf mkspecs/win32-g++/qmake.conf src/corelib/global/qglobal_p.h src/corelib/global/qoperatingsystemversion_p.h src/corelib/io/qfilesystemengine_win.cpp src/network/bearer/qbearerengine.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/sql/doc/snippets/code/doc_src_sql-driver.cpp src/widgets/kernel/qwidget_p.h src/widgets/kernel/qwidgetwindow.cpp src/widgets/styles/qfusionstyle.cpp tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp Change-Id: I80e2722f481b12fff5d967c28f89208c0e9a1dd8
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp12
-rw-r--r--tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp21
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp24
-rw-r--r--tests/auto/widgets/widgets/qsplitter/BLACKLIST2
4 files changed, 57 insertions, 2 deletions
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 31df66e312..979d5c632e 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -239,13 +239,18 @@ void tst_QFileSystemModel::readOnly()
QCOMPARE(model->isReadOnly(), true);
QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat"));
QVERIFY2(file.open(), qPrintable(file.errorString()));
+ const QString fileName = file.fileName();
+ file.close();
+
+ const QFileInfo fileInfo(fileName);
+ QTRY_VERIFY(QDir(flatDirTestPath).entryInfoList().contains(fileInfo));
QModelIndex root = model->setRootPath(flatDirTestPath);
QTRY_VERIFY(model->rowCount(root) > 0);
- QVERIFY(!(model->flags(model->index(file.fileName())) & Qt::ItemIsEditable));
+ QVERIFY(!(model->flags(model->index(fileName)) & Qt::ItemIsEditable));
model->setReadOnly(false);
QCOMPARE(model->isReadOnly(), false);
- QVERIFY(model->flags(model->index(file.fileName())) & Qt::ItemIsEditable);
+ QVERIFY(model->flags(model->index(fileName)) & Qt::ItemIsEditable);
}
class CustomFileIconProvider : public QFileIconProvider
@@ -729,6 +734,9 @@ void tst_QFileSystemModel::sortPersistentIndex()
{
QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat"));
QVERIFY2(file.open(), qPrintable(file.errorString()));
+ const QFileInfo fileInfo(file.fileName());
+ file.close();
+ QTRY_VERIFY(QDir(flatDirTestPath).entryInfoList().contains(fileInfo));
QModelIndex root = model->setRootPath(flatDirTestPath);
QTRY_VERIFY(model->rowCount(root) > 0);
diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
index a1cb729849..dfe5baba71 100644
--- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -52,6 +52,7 @@ private slots:
void boundingRect2();
void draw();
void opacity();
+ void nestedOpaqueOpacity();
void grayscale();
void colorize();
void drawPixmapItem();
@@ -407,6 +408,26 @@ void tst_QGraphicsEffect::opacity()
QCOMPARE(effect->m_opacity, qreal(0.5));
}
+void tst_QGraphicsEffect::nestedOpaqueOpacity()
+{
+ // QTBUG-60231: Nesting widgets with a QGraphicsEffect on a toplevel with
+ // QGraphicsOpacityEffect caused crashes due to constructing several
+ // QPainter instances on a device in the fast path for
+ // QGraphicsOpacityEffect::opacity=1
+ QWidget topLevel;
+ topLevel.setWindowTitle(QTest::currentTestFunction());
+ topLevel.resize(320, 200);
+ QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect;
+ opacityEffect->setOpacity(1);
+ topLevel.setGraphicsEffect(opacityEffect);
+ QWidget *child = new QWidget(&topLevel);
+ child->resize(topLevel.size() / 2);
+ QGraphicsDropShadowEffect *childEffect = new QGraphicsDropShadowEffect;
+ child->setGraphicsEffect(childEffect);
+ topLevel.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
+}
+
void tst_QGraphicsEffect::grayscale()
{
if (qApp->desktop()->depth() < 24)
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index b2e1a2d9b5..4c6dd341b3 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -332,6 +332,17 @@ public:
endRemoveColumns();
}
+ void removeAddLastColumnLayoutChanged() // for taskQTBUG_41124
+ {
+ // make sure QHeaderView::_q_layoutChanged() is called
+ emit layoutAboutToBeChanged();
+ --cols;
+ emit layoutChanged();
+ emit layoutAboutToBeChanged();
+ ++cols;
+ emit layoutChanged();
+ }
+
void removeAllColumns()
{
beginRemoveColumns(QModelIndex(), 0, cols - 1);
@@ -1326,6 +1337,19 @@ void tst_QTreeView::columnHidden()
for (int c = 0; c < model.columnCount(); ++c)
QCOMPARE(view.isColumnHidden(c), true);
view.update();
+
+ // QTBUG_41124:
+ // QHeaderViewPrivate::_q_layoutChanged was not called because it was
+ // disconnected in QTreeView::setModel(). _q_layoutChanged restores
+ // the hidden sections which is tested here
+ view.setColumnHidden(model.cols - 1, true);
+ model.removeAddLastColumnLayoutChanged();
+ // we removed the last column and added a new one
+ // (with layoutToBeChanged/layoutChanged() for both) so column
+ // 1 is a new column and therefore must not be hidden when
+ // _q_layoutChanged() is called and is doing the right stuff
+ QCOMPARE(view.isColumnHidden(model.cols - 1), false);
+
}
void tst_QTreeView::rowHidden()
diff --git a/tests/auto/widgets/widgets/qsplitter/BLACKLIST b/tests/auto/widgets/widgets/qsplitter/BLACKLIST
new file mode 100644
index 0000000000..1352805cd7
--- /dev/null
+++ b/tests/auto/widgets/widgets/qsplitter/BLACKLIST
@@ -0,0 +1,2 @@
+[replaceWidget:visible, not collapsed]
+xcb