diff options
author | Palo Kisa <palo.kisa@gmail.com> | 2018-01-08 22:35:32 +0100 |
---|---|---|
committer | Palo Kisa <palo.kisa@gmail.com> | 2018-01-10 12:34:26 +0000 |
commit | b9cddbd84b74fdda30190800ed827dc80aa65f6c (patch) | |
tree | 80c35b8a1baa6816d01de5a48e249b52a7ee6c28 /tests/auto | |
parent | 2e719713be8ac3b1e26b23221f12db136d9d5103 (diff) | |
download | qtsvg-b9cddbd84b74fdda30190800ed827dc80aa65f6c.tar.gz |
svgiconengine: Fix isNull() for deserialized icons
In 4a9470e55ce08752501868c60762268fdf2c44af there was introduced
specific isNull() implementation for QSvgIconEngine. But the existing
check was not sufficient for the scenarios where the QIcon is
constructed by deserialization from QDataStream (from previously
serialized valid svg QIcon).
We also need to check the svgBuffers as the previously serialized
svgFiles are silently ignored by QSvgIconEngine::read().
Change-Id: Id64ce233baead053c8b5ca61f1d416e46a8c6088
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qicon_svg/tst_qicon_svg.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qicon_svg/tst_qicon_svg.cpp b/tests/auto/qicon_svg/tst_qicon_svg.cpp index 170ec37..0875ee1 100644 --- a/tests/auto/qicon_svg/tst_qicon_svg.cpp +++ b/tests/auto/qicon_svg/tst_qicon_svg.cpp @@ -152,6 +152,16 @@ void tst_QIcon_Svg::isNull() //valid svg, we're not null QIcon icon(prefix + "heart.svg"); QVERIFY(!icon.isNull()); + + // check for non null of serialized/deserialized valid icon + QByteArray buf; + QDataStream out(&buf, QIODevice::WriteOnly); + out << icon; + + QIcon icon2; + QDataStream in(buf); + in >> icon2; + QVERIFY(!icon2.isNull()); } { //invalid svg, but a pixmap added means we're not null |