summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/painting
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-02-23 19:54:34 +0100
committerEirik Aavitsland <eirik.aavitsland@qt.io>2024-02-27 03:47:11 +0100
commit2925683268ca9d8dc6811f8f64c50ca488b27acc (patch)
tree58bd8a3d32fffbf4d9b5bc49802725a49152566f /tests/auto/gui/painting
parentc1921abf65092f4732435a92732c8c11224d31fb (diff)
QPainterPath: detach and reset before streaming in
Otherwise we end up appending and modifying the shared object. Pick-to: 5.15 6.5 6.6 6.7 Task-number: QTBUG-122704 Change-Id: I01ec3c774d9943adb903fffd17b692c2e6d53e97 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/gui/painting')
-rw-r--r--tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
index 89631a7f28..c00dc3a78a 100644
--- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
@@ -765,6 +765,21 @@ void tst_QPainterPath::testOperatorDatastream()
}
QCOMPARE(other, path);
+
+ // Check reset & detach
+ QPainterPath p3;
+ p3.lineTo(1, 1);
+ QCOMPARE(p3.elementCount(), 2);
+ QPainterPath p4 = p3;
+ QCOMPARE(p4.elementCount(), 2);
+ {
+ QFile data(tempDir.path() + "/data");
+ QVERIFY(data.open(QFile::ReadOnly));
+ QDataStream stream(&data);
+ stream >> p3;
+ }
+ QCOMPARE(p3.elementCount(), path.elementCount());
+ QCOMPARE(p4.elementCount(), 2);
}
void tst_QPainterPath::closing()