summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
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.cpp23
-rw-r--r--tests/auto/widgets/widgets/qsplitter/BLACKLIST2
4 files changed, 56 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 5293ba487a..0eec2e7c75 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -339,6 +339,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);
@@ -1344,6 +1355,18 @@ void tst_QTreeView::columnHidden()
QCOMPARE(view.isColumnHidden(model.cols - 1), true);
model.simulateMoveRows();
QCOMPARE(view.isColumnHidden(model.cols - 1), true);
+
+ // 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