summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/moc/tst_moc.cpp20
-rw-r--r--tests/auto/qdate/tst_qdate.cpp50
-rw-r--r--tests/auto/qfontmetrics/tst_qfontmetrics.cpp2
-rw-r--r--tests/auto/qgl/qgl.pro1
-rw-r--r--tests/auto/qglbuffer/qglbuffer.pro2
-rw-r--r--tests/auto/qglthreads/qglthreads.pro2
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp152
-rw-r--r--tests/auto/qimagereader/images/corrupt.svg32
-rw-r--r--tests/auto/qimagereader/images/corrupt.svgzbin0 -> 407 bytes
-rw-r--r--tests/auto/qimagereader/images/rect.svg462
-rw-r--r--tests/auto/qimagereader/images/rect.svgzbin0 -> 5082 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.pro1
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc4
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp64
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp14
-rw-r--r--tests/auto/qobject/tst_qobject.cpp20
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp21
-rw-r--r--tests/auto/qstatictext/tst_qstatictext.cpp171
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp39
-rw-r--r--tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp36
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp39
-rw-r--r--tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp13
22 files changed, 1117 insertions, 28 deletions
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 30c2721..a56d842 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -1302,6 +1302,26 @@ void tst_Moc::QTBUG5590_dummyProperty()
QCOMPARE(o.value2(), 82);
}
+class QTBUG7421_ReturnConstTemplate: public QObject
+{ Q_OBJECT
+public slots:
+ const QList<int> returnConstTemplate1() { return QList<int>(); }
+ QList<int> const returnConstTemplate2() { return QList<int>(); }
+ const int returnConstInt() { return 0; }
+ const QString returnConstString(const QString s) { return s; }
+ QString const returnConstString2( QString const s) { return s; }
+};
+
+class QTBUG9354_constInName: public QObject
+{ Q_OBJECT
+public slots:
+ void slotChooseScientificConst0(struct science_constant const &) {};
+ void foo(struct science_const const &) {};
+ void foo(struct constconst const &) {};
+ void foo(struct constconst *) {};
+ void foo(struct const_ *) {};
+};
+
QTEST_APPLESS_MAIN(tst_Moc)
#include "tst_moc.moc"
diff --git a/tests/auto/qdate/tst_qdate.cpp b/tests/auto/qdate/tst_qdate.cpp
index 7223291..60772eb 100644
--- a/tests/auto/qdate/tst_qdate.cpp
+++ b/tests/auto/qdate/tst_qdate.cpp
@@ -99,6 +99,7 @@ private slots:
void standaloneShortMonthName() const;
void longMonthName() const;
void standaloneLongMonthName() const;
+ void roundtrip() const;
};
Q_DECLARE_METATYPE(QDate)
@@ -668,17 +669,18 @@ void tst_QDate::toString_format()
void tst_QDate::isLeapYear()
{
- QVERIFY(QDate::isLeapYear(-4444));
- QVERIFY(!QDate::isLeapYear(-4443));
- QVERIFY(QDate::isLeapYear(-8));
- QVERIFY(!QDate::isLeapYear(-7));
- QVERIFY(QDate::isLeapYear(-4));
+ QVERIFY(QDate::isLeapYear(-4445));
+ QVERIFY(!QDate::isLeapYear(-4444));
+ QVERIFY(!QDate::isLeapYear(-6));
+ QVERIFY(QDate::isLeapYear(-5));
+ QVERIFY(!QDate::isLeapYear(-4));
QVERIFY(!QDate::isLeapYear(-3));
QVERIFY(!QDate::isLeapYear(-2));
- QVERIFY(!QDate::isLeapYear(-1));
- QVERIFY(!QDate::isLeapYear(1));
- QVERIFY(!QDate::isLeapYear(1));
+ QVERIFY(QDate::isLeapYear(-1));
+ QVERIFY(!QDate::isLeapYear(0)); // Doesn't exist
QVERIFY(!QDate::isLeapYear(1));
+ QVERIFY(!QDate::isLeapYear(2));
+ QVERIFY(!QDate::isLeapYear(3));
QVERIFY(QDate::isLeapYear(4));
QVERIFY(!QDate::isLeapYear(7));
QVERIFY(QDate::isLeapYear(8));
@@ -910,5 +912,37 @@ void tst_QDate::standaloneLongMonthName() const
}
}
+void tst_QDate::roundtrip() const
+{
+ // Test round trip, this exercises setDate(), isValid(), isLeapYear(),
+ // year(), month(), day(), julianDayFromDate(), and getDateFromJulianDay()
+ // to ensure they are internally consistent (but doesn't guarantee correct)
+
+ // Test Julian round trip in both BC and AD
+ QDate testDate;
+ QDate loopDate = QDate::fromJulianDay(1684899); // 1 Jan 100 BC
+ while ( loopDate.toJulianDay() <= 1757948 ) { // 31 Dec 100 AD
+ testDate.setDate( loopDate.year(), loopDate.month(), loopDate.day() );
+ QCOMPARE( loopDate.toJulianDay(), testDate.toJulianDay() );
+ loopDate = loopDate.addDays(1);
+ }
+
+ // Test Julian and Gregorian round trip during changeover period
+ loopDate = QDate::fromJulianDay(2298153); // 1 Jan 1580 AD
+ while ( loopDate.toJulianDay() <= 2300334 ) { // 31 Dec 1585 AD
+ testDate.setDate( loopDate.year(), loopDate.month(), loopDate.day() );
+ QCOMPARE( loopDate.toJulianDay(), testDate.toJulianDay() );
+ loopDate = loopDate.addDays(1);
+ }
+
+ // Test Gregorian round trip during current useful period
+ loopDate = QDate::fromJulianDay(2378497); // 1 Jan 1900 AD
+ while ( loopDate.toJulianDay() <= 2488433 ) { // 31 Dec 2100 AD
+ testDate.setDate( loopDate.year(), loopDate.month(), loopDate.day() );
+ QCOMPARE( loopDate.toJulianDay(), testDate.toJulianDay() );
+ loopDate = loopDate.addDays(1);
+ }
+}
+
QTEST_APPLESS_MAIN(tst_QDate)
#include "tst_qdate.moc"
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
index 46f2b15..5d73764 100644
--- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
@@ -259,7 +259,7 @@ void tst_QFontMetrics::bearingIncludedInBoundingRect()
font.setItalic(false);
QRect brectNormal = QFontMetrics(font).boundingRect("ITALIC");
- QVERIFY(brectItalic.width() > brectNormal.width());
+ QVERIFY(brectItalic.width() >= brectNormal.width());
}
QTEST_MAIN(tst_QFontMetrics)
diff --git a/tests/auto/qgl/qgl.pro b/tests/auto/qgl/qgl.pro
index 5f058f9..20f8018 100644
--- a/tests/auto/qgl/qgl.pro
+++ b/tests/auto/qgl/qgl.pro
@@ -7,6 +7,7 @@ requires(contains(QT_CONFIG,opengl))
QT += opengl
contains(QT_CONFIG,egl):DEFINES += QGL_EGL
+win32:!wince*: DEFINES += QT_NO_EGL
SOURCES += tst_qgl.cpp
RESOURCES = qgl.qrc
diff --git a/tests/auto/qglbuffer/qglbuffer.pro b/tests/auto/qglbuffer/qglbuffer.pro
index 07d05bb..5627d2d 100644
--- a/tests/auto/qglbuffer/qglbuffer.pro
+++ b/tests/auto/qglbuffer/qglbuffer.pro
@@ -6,4 +6,6 @@ load(qttest_p4)
requires(contains(QT_CONFIG,opengl))
QT += opengl
+win32:!wince*: DEFINES += QT_NO_EGL
+
SOURCES += tst_qglbuffer.cpp
diff --git a/tests/auto/qglthreads/qglthreads.pro b/tests/auto/qglthreads/qglthreads.pro
index 73b75d4..883eef2 100644
--- a/tests/auto/qglthreads/qglthreads.pro
+++ b/tests/auto/qglthreads/qglthreads.pro
@@ -2,6 +2,8 @@ load(qttest_p4)
requires(contains(QT_CONFIG,opengl))
QT += opengl
+win32:!wince*: DEFINES += QT_NO_EGL
+
HEADERS += tst_qglthreads.h
SOURCES += tst_qglthreads.cpp
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 01ef9a2..3d86c48 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -61,6 +61,7 @@
#include <QScrollBar>
#include <QVBoxLayout>
#include <QGraphicsEffect>
+#include <QInputContext>
#include "../../shared/util.h"
@@ -424,6 +425,7 @@ private slots:
void modality_keyEvents();
void itemIsInFront();
void scenePosChange();
+ void updateMicroFocus();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -4318,6 +4320,21 @@ protected:
break;
case QGraphicsItem::ItemScenePositionHasChanged:
break;
+ case QGraphicsItem::ItemRotationChange:
+ oldValues << rotation();
+ break;
+ case QGraphicsItem::ItemRotationHasChanged:
+ break;
+ case QGraphicsItem::ItemScaleChange:
+ oldValues << scale();
+ break;
+ case QGraphicsItem::ItemScaleHasChanged:
+ break;
+ case QGraphicsItem::ItemTransformOriginPointChange:
+ oldValues << transformOriginPoint();
+ break;
+ case QGraphicsItem::ItemTransformOriginPointHasChanged:
+ break;
}
return itemChangeReturnValue.isValid() ? itemChangeReturnValue : value;
}
@@ -4414,6 +4431,48 @@ void tst_QGraphicsItem::itemChange()
QCOMPARE(tester.zValue(), qreal(2.0));
}
{
+ // ItemRotationChange / ItemRotationHasChanged
+ tester.itemChangeReturnValue = qreal(15.0);
+ tester.setRotation(10.0);
+ ++changeCount; // notification sent too
+ ++changeCount;
+ QCOMPARE(tester.changes.size(), changeCount);
+ QCOMPARE(tester.changes.at(tester.changes.size() - 2), QGraphicsItem::ItemRotationChange);
+ QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemRotationHasChanged);
+ QCOMPARE(tester.values.at(tester.changes.size() - 2), QVariant(qreal(10.0)));
+ QCOMPARE(tester.values.at(tester.changes.size() - 1), QVariant(qreal(15.0)));
+ QCOMPARE(tester.oldValues.last(), QVariant(qreal(0.0)));
+ QCOMPARE(tester.rotation(), qreal(15.0));
+ }
+ {
+ // ItemScaleChange / ItemScaleHasChanged
+ tester.itemChangeReturnValue = qreal(2.0);
+ tester.setScale(1.5);
+ ++changeCount; // notification sent too
+ ++changeCount;
+ QCOMPARE(tester.changes.size(), changeCount);
+ QCOMPARE(tester.changes.at(tester.changes.size() - 2), QGraphicsItem::ItemScaleChange);
+ QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemScaleHasChanged);
+ QCOMPARE(tester.values.at(tester.changes.size() - 2), QVariant(qreal(1.5)));
+ QCOMPARE(tester.values.at(tester.changes.size() - 1), QVariant(qreal(2.0)));
+ QCOMPARE(tester.oldValues.last(), QVariant(qreal(1.0)));
+ QCOMPARE(tester.scale(), qreal(2.0));
+ }
+ {
+ // ItemTransformOriginPointChange / ItemTransformOriginPointHasChanged
+ tester.itemChangeReturnValue = QPointF(2.0, 2.0);
+ tester.setTransformOriginPoint(1.0, 1.0);
+ ++changeCount; // notification sent too
+ ++changeCount;
+ QCOMPARE(tester.changes.size(), changeCount);
+ QCOMPARE(tester.changes.at(tester.changes.size() - 2), QGraphicsItem::ItemTransformOriginPointChange);
+ QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemTransformOriginPointHasChanged);
+ QCOMPARE(tester.values.at(tester.changes.size() - 2), QVariant(QPointF(1.0, 1.0)));
+ QCOMPARE(tester.values.at(tester.changes.size() - 1), QVariant(QPointF(2.0, 2.0)));
+ QCOMPARE(tester.oldValues.last(), QVariant(QPointF(0.0, 0.0)));
+ QCOMPARE(tester.transformOriginPoint(), QPointF(2.0, 2.0));
+ }
+ {
// ItemFlagsChange
tester.itemChangeReturnValue = QGraphicsItem::ItemIsSelectable;
tester.setFlag(QGraphicsItem::ItemIsSelectable, false);
@@ -7463,10 +7522,19 @@ void tst_QGraphicsItem::itemSendsGeometryChanges()
QTransform x = QTransform().rotate(45);
QPointF pos(10, 10);
qreal o(0.5);
+ qreal r(10.0);
+ qreal s(1.5);
+ QPointF origin(1.0, 1.0);
item.setTransform(x);
item.setPos(pos);
+ item.setRotation(r);
+ item.setScale(s);
+ item.setTransformOriginPoint(origin);
QCOMPARE(item.transform(), x);
QCOMPARE(item.pos(), pos);
+ QCOMPARE(item.rotation(), r);
+ QCOMPARE(item.scale(), s);
+ QCOMPARE(item.transformOriginPoint(), origin);
QCOMPARE(item.changes.size(), 0);
item.setOpacity(o);
@@ -7480,6 +7548,13 @@ void tst_QGraphicsItem::itemSendsGeometryChanges()
QCOMPARE(item.transform(), QTransform());
QCOMPARE(item.pos(), QPointF());
QCOMPARE(item.opacity(), o);
+ item.setRotation(0.0);
+ item.setScale(1.0);
+ item.setTransformOriginPoint(0.0, 0.0);
+ QCOMPARE(item.changes.size(), 14); // rotation + scale + origin
+ QCOMPARE(item.rotation(), qreal(0.0));
+ QCOMPARE(item.scale(), qreal(1.0));
+ QCOMPARE(item.transformOriginPoint(), QPointF(0.0, 0.0));
QCOMPARE(item.changes, QList<QGraphicsItem::GraphicsItemChange>()
<< QGraphicsItem::ItemOpacityChange
@@ -7489,7 +7564,13 @@ void tst_QGraphicsItem::itemSendsGeometryChanges()
<< QGraphicsItem::ItemTransformChange
<< QGraphicsItem::ItemTransformHasChanged
<< QGraphicsItem::ItemPositionChange
- << QGraphicsItem::ItemPositionHasChanged);
+ << QGraphicsItem::ItemPositionHasChanged
+ << QGraphicsItem::ItemRotationChange
+ << QGraphicsItem::ItemRotationHasChanged
+ << QGraphicsItem::ItemScaleChange
+ << QGraphicsItem::ItemScaleHasChanged
+ << QGraphicsItem::ItemTransformOriginPointChange
+ << QGraphicsItem::ItemTransformOriginPointHasChanged);
}
// Make sure we update moved items correctly.
@@ -9909,6 +9990,75 @@ void tst_QGraphicsItem::scenePosChange()
QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
}
+class MyInputContext : public QInputContext
+{
+public:
+ MyInputContext() : nbUpdates(0) {}
+ ~MyInputContext() {}
+
+ QString identifierName() { return QString(); }
+ QString language() { return QString(); }
+
+ void reset() {}
+
+ bool isComposing() const { return false; }
+
+ void update() { nbUpdates++; }
+
+ bool nbUpdates;
+};
+
+class MyInputWidget : public QGraphicsWidget
+{
+public:
+ MyInputWidget()
+ {
+ setFlag(QGraphicsItem::ItemIsFocusable, true);
+ setFlag(QGraphicsItem::ItemAcceptsInputMethod, true);
+ }
+ void mousePressEvent(QGraphicsSceneMouseEvent *event)
+ {
+ event->accept();
+ }
+
+ void doUpdateMicroFocus()
+ {
+ updateMicroFocus();
+ }
+};
+
+void tst_QGraphicsItem::updateMicroFocus()
+{
+ QGraphicsScene scene;
+ QWidget parent;
+ QGridLayout layout;
+ parent.setLayout(&layout);
+ QGraphicsView view(&scene);
+ QGraphicsView view2(&scene);
+ layout.addWidget(&view, 0, 0);
+ layout.addWidget(&view2, 0, 1);
+ MyInputContext ic2;
+ view2.setInputContext(&ic2);
+ MyInputContext ic;
+ view.setInputContext(&ic);
+ MyInputWidget input;
+ input.setPos(0, 0);
+ input.resize(150, 150);
+ scene.addItem(&input);
+ input.setFocus();
+ parent.show();
+ view.setFocus();
+ qApp->setAutoSipEnabled(true);
+ QApplication::setActiveWindow(&parent);
+ QTest::qWaitForWindowShown(&parent);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&parent));
+ input.doUpdateMicroFocus();
+ QApplication::processEvents();
+ QCOMPARE(ic.nbUpdates, 1);
+ //No update since view2 does not have the focus.
+ QCOMPARE(ic2.nbUpdates, 0);
+}
+
void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor()
{
struct Item : public QGraphicsTextItem
diff --git a/tests/auto/qimagereader/images/corrupt.svg b/tests/auto/qimagereader/images/corrupt.svg
new file mode 100644
index 0000000..8747df0
--- /dev/null
+++ b/tests/auto/qimagereader/images/corrupt.svg
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.0"
+ width="40px"
+ height="5px"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="test.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ inkscape:window-height="1005"
+ \ No newline at end of file
diff --git a/tests/auto/qimagereader/images/corrupt.svgz b/tests/auto/qimagereader/images/corrupt.svgz
new file mode 100644
index 0000000..67fdcee
--- /dev/null
+++ b/tests/auto/qimagereader/images/corrupt.svgz
Binary files differ
diff --git a/tests/auto/qimagereader/images/rect.svg b/tests/auto/qimagereader/images/rect.svg
new file mode 100644
index 0000000..c56549a
--- /dev/null
+++ b/tests/auto/qimagereader/images/rect.svg
@@ -0,0 +1,462 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.0"
+ width="128"
+ height="128"
+ viewBox="0 0 105.427 137.439"
+ id="Livello_1"
+ xml:space="preserve"
+ style="overflow:visible"><defs
+ id="defs2727"><linearGradient
+ x1="26.294399"
+ y1="11.6704"
+ x2="71.901901"
+ y2="133.0273"
+ id="linearGradient3352"
+ xlink:href="#XMLID_34_"
+ gradientUnits="userSpaceOnUse" /><linearGradient
+ x1="36.838902"
+ y1="7.7075"
+ x2="82.446297"
+ y2="129.0645"
+ id="linearGradient3354"
+ xlink:href="#XMLID_34_"
+ gradientUnits="userSpaceOnUse" /><linearGradient
+ x1="33.882301"
+ y1="23.583"
+ x2="39.972198"
+ y2="23.583"
+ id="XMLID_34_"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ id="stop2672"
+ style="stop-color:#ff5d5d;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2674"
+ style="stop-color:#e20800;stop-opacity:1"
+ offset="1" />
+ </linearGradient><linearGradient
+ x1="33.882301"
+ y1="23.583"
+ x2="39.972198"
+ y2="23.583"
+ id="linearGradient3368"
+ xlink:href="#XMLID_34_"
+ gradientUnits="userSpaceOnUse" /><linearGradient
+ x1="54.356899"
+ y1="1.124"
+ x2="99.964401"
+ y2="122.481"
+ id="linearGradient3370"
+ xlink:href="#XMLID_34_"
+ gradientUnits="userSpaceOnUse" /><linearGradient
+ x1="15.8457"
+ y1="15.5972"
+ x2="61.453098"
+ y2="136.9541"
+ id="linearGradient3376"
+ xlink:href="#XMLID_34_"
+ gradientUnits="userSpaceOnUse" /><linearGradient
+ x1="43.438"
+ y1="5.2275"
+ x2="89.045403"
+ y2="126.5845"
+ id="linearGradient3382"
+ xlink:href="#XMLID_34_"
+ gradientUnits="userSpaceOnUse" /><linearGradient
+ x1="8.1176996"
+ y1="14.9019"
+ x2="70.759598"
+ y2="117.2331"
+ id="linearGradient3792"
+ xlink:href="#XMLID_30_"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.9991,-4.18e-2,4.18e-2,0.9991,-2.4309,1.195)" /><linearGradient
+ x1="10.5708"
+ y1="10.1548"
+ x2="73.2117"
+ y2="112.4844"
+ id="linearGradient3794"
+ xlink:href="#XMLID_30_"
+ gradientUnits="userSpaceOnUse" /><linearGradient
+ x1="6.2178001"
+ y1="72.223602"
+ x2="79.360802"
+ y2="72.223602"
+ id="XMLID_26_"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0,2.1512354)">
+ <stop
+ id="stop2578"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2580"
+ style="stop-color:#eeeeec;stop-opacity:1"
+ offset="1" />
+ </linearGradient><filter
+ id="filter5869"><feGaussianBlur
+ id="feGaussianBlur5871"
+ stdDeviation="1.2254964"
+ inkscape:collect="always" /></filter><filter
+ id="filter5873"><feGaussianBlur
+ id="feGaussianBlur5875"
+ stdDeviation="1.3615922"
+ inkscape:collect="always" /></filter><filter
+ id="filter2854"><feGaussianBlur
+ id="feGaussianBlur2856"
+ stdDeviation="0.8944793"
+ inkscape:collect="always" /></filter></defs>
+<filter
+ id="AI_Sfocatura_1">
+ <feGaussianBlur
+ id="feGaussianBlur2545"
+ stdDeviation="1" />
+</filter>
+<g
+ transform="translate(-3.2052027,3.2058836)"
+ id="g2547">
+ <g
+ transform="matrix(0.9982563,0,0,0.9982563,-1.5492234e-2,0.2232388)"
+ id="g2549">
+ <g
+ id="g2551">
+ <linearGradient
+ x1="6.2178001"
+ y1="68.029297"
+ x2="79.360802"
+ y2="68.029297"
+ id="XMLID_24_"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ id="stop2554"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2556"
+ style="stop-color:#eeeeec;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 9.542,121.224 C 7.713,121.224 6.217,119.728 6.217,117.9 L 6.217,18.16 C 6.217,16.331 7.713,14.835 9.542,14.835 L 76.036,14.835 C 77.864,14.835 79.36,16.331 79.36,18.16 L 79.36,117.9 C 79.36,119.728 77.864,121.224 76.036,121.224 L 9.542,121.224 z"
+ id="path2558"
+ style="fill:url(#XMLID_24_)" />
+ </g>
+ <g
+ id="g2560">
+ <linearGradient
+ x1="10.5718"
+ y1="15.3989"
+ x2="73.212097"
+ y2="117.7277"
+ id="XMLID_25_"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ id="stop2563"
+ style="stop-color:#77b753;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2565"
+ style="stop-color:#00892c;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 11.204,18.159 C 10.29,18.159 9.542,18.907 9.542,19.821 L 9.542,116.237 C 9.542,117.151 10.29,117.899 11.204,117.899 L 74.375,117.899 C 75.289,117.899 76.037,117.151 76.037,116.237 L 76.037,19.821 C 76.037,18.907 75.289,18.159 74.375,18.159 L 11.204,18.159 z"
+ id="path2567"
+ style="fill:url(#XMLID_25_)" />
+ </g>
+ </g>
+ <g
+ transform="matrix(0.9982563,0,0,0.9982563,1.05825,0.2232388)"
+ id="g2569">
+ <path
+ d="M 11.639,126.468 C 9.811,126.468 8.314,124.972 8.314,123.143 L 8.314,23.403 C 8.314,21.574 9.811,20.078 11.639,20.078 L 78.134,20.078 C 79.962,20.078 81.458,21.574 81.458,23.403 L 81.458,123.143 C 81.458,124.972 79.962,126.468 78.134,126.468 L 23.696022,126.468 L 11.639,126.468 z"
+ transform="matrix(1.041449,0,0,1,-4.451967,3.1512354)"
+ id="path2575"
+ style="opacity:0.6;filter:url(#filter2854)" /><path
+ d="M 9.542,127.56924 C 7.714,127.56924 6.218,126.07324 6.218,124.24624 L 6.218,24.505236 C 6.218,22.677236 7.714,21.181236 9.542,21.181236 L 76.037,21.181236 C 77.865,21.181236 79.361,22.677236 79.361,24.505236 L 79.361,124.24624 C 79.361,126.07324 77.865,127.56924 76.037,127.56924 L 9.542,127.56924 z"
+ id="path2582"
+ style="fill:url(#XMLID_26_)" />
+ <g
+ transform="translate(0,2.1512354)"
+ id="g2584">
+ <g
+ transform="matrix(1.0276326,0,0,1,-2.2508995,0)"
+ id="g2586"
+ style="opacity:0.5;filter:url(#AI_Sfocatura_1)">
+ <path
+ d="M 11.639,123.321 C 9.811,123.321 8.314,121.824 8.314,119.997 L 81.458,119.997 C 81.458,121.824 79.962,123.321 78.134,123.321 L 11.639,123.321 z"
+ id="path2588" />
+ </g>
+ <linearGradient
+ x1="6.2178001"
+ y1="69.078102"
+ x2="79.360802"
+ y2="69.078102"
+ id="XMLID_27_"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ id="stop2591"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2593"
+ style="stop-color:#eeeeec;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 9.542,122.272 C 7.714,122.272 6.218,120.776 6.218,118.947 L 6.218,19.207 C 6.218,17.378 7.714,15.882 9.542,15.882 L 76.037,15.882 C 77.865,15.882 79.361,17.378 79.361,19.207 L 79.361,118.947 C 79.361,120.776 77.865,122.272 76.037,122.272 L 9.542,122.272 z"
+ id="path2595"
+ style="fill:url(#XMLID_27_)" />
+ </g>
+ <g
+ transform="translate(0,3.2268531)"
+ id="g2597">
+ <g
+ transform="matrix(1.0368435,0,0,1,-3.0011994,-1.0756177)"
+ id="g2599"
+ style="opacity:0.5;filter:url(#AI_Sfocatura_1)">
+ <path
+ d="M 11.639,120.175 C 9.811,120.175 8.314,118.679 8.314,116.85 L 81.458,116.85 C 81.458,118.679 79.962,120.175 78.134,120.175 L 11.639,120.175 z"
+ id="path2601" />
+ </g>
+ <linearGradient
+ x1="6.2178001"
+ y1="65.931602"
+ x2="79.360802"
+ y2="65.931602"
+ id="XMLID_28_"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0,-1.0756177)">
+ <stop
+ id="stop2604"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2606"
+ style="stop-color:#eeeeec;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 9.542,118.05038 C 7.714,118.05038 6.218,116.55438 6.218,114.72638 L 6.218,14.986382 C 6.218,13.157382 7.714,11.661382 9.542,11.661382 L 76.037,11.661382 C 77.865,11.661382 79.361,13.157382 79.361,14.986382 L 79.361,114.72638 C 79.361,116.55438 77.865,118.05038 76.037,118.05038 L 9.542,118.05038 z"
+ id="path2608"
+ style="fill:url(#XMLID_28_)" />
+ </g>
+ <g
+ transform="translate(0,1.8317954)"
+ id="g2610">
+ <g
+ transform="matrix(1.0184218,0,0,1.0158314,-1.4821779,-1.8527316)"
+ id="g2612"
+ style="opacity:0.5;filter:url(#AI_Sfocatura_1)">
+ <path
+ d="M 10.639,117.029 C 8.811,117.029 7.314,115.532 7.314,113.704 L 7.314,13.964 C 7.314,12.135 8.811,10.639 10.639,10.639 L 77.134,10.639 C 78.962,10.639 80.458,12.135 80.458,13.964 L 80.458,113.704 C 80.458,115.532 78.962,117.029 77.134,117.029 L 10.639,117.029 z"
+ id="path2614" />
+ </g>
+ <linearGradient
+ x1="6.2178001"
+ y1="62.785599"
+ x2="79.360802"
+ y2="62.785599"
+ id="XMLID_29_"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ id="stop2617"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2619"
+ style="stop-color:#eeeeec;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 9.542,115.98 C 7.714,115.98 6.218,114.483 6.218,112.656 L 6.218,12.916 C 6.218,11.087 7.714,9.591 9.542,9.591 L 76.037,9.591 C 77.865,9.591 79.361,11.087 79.361,12.916 L 79.361,112.657 C 79.361,114.484 77.865,115.981 76.037,115.981 L 9.542,115.981 L 9.542,115.98 z"
+ id="path2621"
+ style="fill:url(#XMLID_29_)" />
+ <linearGradient
+ x1="10.5708"
+ y1="10.1548"
+ x2="73.2117"
+ y2="112.4844"
+ id="XMLID_30_"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ id="stop2624"
+ style="stop-color:#73bdf2;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2626"
+ style="stop-color:#3592ee;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 11.204,12.916 C 10.289,12.916 9.541,13.664 9.541,14.578 L 9.541,110.994 C 9.541,111.909 10.289,112.657 11.204,112.657 L 74.373,112.657 C 75.288,112.657 76.036,111.909 76.036,110.994 L 76.036,14.578 C 76.036,13.664 75.288,12.916 74.373,12.916 L 11.204,12.916 L 11.204,12.916 z"
+ id="path2628"
+ style="fill:url(#linearGradient3794)" />
+ </g>
+ </g>
+ <g
+ transform="matrix(0.9961334,-6.5068755e-2,6.5068755e-2,0.9961334,-5.7493275,-6.3015051)"
+ id="g2630">
+ <g
+ transform="matrix(1.0311837,0,0,1.0154411,-2.8218065,-1.9088007)"
+ id="g2632"
+ style="opacity:0.6;filter:url(#filter5869)">
+ <path
+ d="M 10.744,123.615 C 8.917,123.691 7.36,122.259 7.283,120.432 L 3.118,20.779 C 3.042,18.952 4.474,17.395 6.301,17.319 L 72.737,14.542 C 74.563,14.465 76.121,15.898 76.198,17.725 L 80.363,117.377 C 80.439,119.204 79.007,120.761 77.181,120.839 L 10.744,123.615 z"
+ id="path2634" />
+ </g>
+ <g
+ id="g2636">
+
+ <linearGradient
+ x1="3.7607"
+ y1="67.532204"
+ x2="76.909698"
+ y2="67.532204"
+ id="XMLID_31_"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.9991,-4.18e-2,4.18e-2,0.9991,-2.4309,1.195)">
+ <stop
+ id="stop2639"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2641"
+ style="stop-color:#eeeeec;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 9.695,121.518 C 7.868,121.595 6.311,120.163 6.234,118.335 L 2.069,18.682 C 1.993,16.855 3.425,15.298 5.252,15.222 L 71.688,12.444 C 73.514,12.368 75.072,13.8 75.149,15.627 L 79.314,115.28 C 79.391,117.106 77.959,118.663 76.131,118.741 L 9.695,121.518 z"
+ id="path2643"
+ style="fill:url(#XMLID_31_)" />
+ </g>
+ <path
+ d="M 7.051,18.474 C 6.138,18.513 5.422,19.291 5.46,20.204 L 9.486,116.535 C 9.525,117.448 10.303,118.164 11.217,118.126 L 74.331,115.489 C 75.244,115.451 75.96,114.672 75.922,113.759 L 71.897,17.427 C 71.859,16.513 71.08,15.797 70.167,15.836 L 7.051,18.474 z"
+ id="path2652"
+ style="fill:url(#linearGradient3792);fill-opacity:1" />
+ <path
+ d="M 9.5625,22.375 C 10.84375,52.927083 12.125,83.479167 13.40625,114.03125 C 32.885417,113.21875 52.364583,112.40625 71.84375,111.59375 C 70.5625,81.041667 69.28125,50.489583 68,19.9375 C 48.520833,20.75 29.041667,21.5625 9.5625,22.375 z"
+ id="path4189"
+ style="opacity:0.6;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:1.00000001, 1.00000001;stroke-dashoffset:0;stroke-opacity:1" /></g>
+ <g
+ transform="matrix(0.9982563,0,0,0.9982563,10.72193,-5.1454722)"
+ id="g2654">
+ <g
+ transform="translate(-4.2156998e-8,1.0756177)"
+ id="g2656"
+ style="opacity:0.6;filter:url(#filter5873)">
+ <path
+ d="M 10.854785,112.52047 C 9.0174891,112.09656 7.8676311,110.2731 8.2990859,108.46891 L 31.839177,9.9940152 C 32.271664,8.1888112 34.127539,7.0580233 35.964835,7.481942 L 102.78149,22.901224 C 104.61776,23.325142 105.76865,25.149615 105.33616,26.954819 L 81.79607,125.42768 C 81.364615,127.23289 79.507708,128.36368 77.671444,127.93976 L 10.854785,112.52047 z"
+ id="path2658" />
+ </g>
+ <g
+ id="g2660">
+
+ <linearGradient
+ x1="16.688499"
+ y1="-8.9546003"
+ x2="94.108398"
+ y2="105.6356"
+ id="XMLID_33_"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.9735,0.2287,-0.2287,0.9735,14.4454,7.996)">
+ <stop
+ id="stop2663"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2665"
+ style="stop-color:#eeeeec;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 12.707,111.688 C 10.927,111.271 9.813,109.472 10.231,107.692 L 33.037,10.593 C 33.455,8.813 35.254,7.698 37.034,8.116 L 101.767,23.32 C 103.546,23.738 104.661,25.537 104.243,27.317 L 81.436,124.415 C 81.019,126.195 79.219,127.31 77.44,126.892 L 12.707,111.688 z"
+ id="path2667"
+ style="fill:url(#XMLID_33_)" />
+ </g>
+ <path
+ d="M 33.925,25.17 L 35.435,25.3 C 35.369,25.76 35.413,26.134 35.567,26.422 C 35.721,26.71 35.941,26.887 36.226,26.954 C 36.538,27.027 36.832,26.947 37.114,26.715 C 37.396,26.483 37.594,26.116 37.712,25.615 C 37.821,25.149 37.805,24.759 37.661,24.445 C 37.517,24.132 37.298,23.939 37.004,23.87 C 36.811,23.825 36.571,23.817 36.281,23.846 L 36.797,22.386 C 37.187,22.487 37.522,22.455 37.801,22.292 C 38.076,22.127 38.26,21.847 38.353,21.451 C 38.431,21.12 38.41,20.843 38.291,20.618 C 38.172,20.392 37.984,20.25 37.729,20.19 C 37.473,20.13 37.226,20.187 36.987,20.358 C 36.749,20.531 36.562,20.825 36.427,21.24 L 35.104,20.624 C 35.455,19.78 35.886,19.208 36.401,18.909 C 36.915,18.61 37.492,18.536 38.131,18.686 C 38.85,18.855 39.36,19.244 39.663,19.853 C 39.967,20.462 40.045,21.076 39.9,21.695 C 39.802,22.113 39.618,22.468 39.35,22.758 C 39.081,23.049 38.726,23.276 38.287,23.439 C 38.699,23.661 38.996,24.004 39.18,24.471 C 39.362,24.937 39.383,25.471 39.242,26.073 C 39.036,26.949 38.604,27.613 37.948,28.064 C 37.29,28.515 36.601,28.655 35.88,28.486 C 35.189,28.323 34.661,27.944 34.297,27.347 C 33.931,26.751 33.808,26.025 33.925,25.17 z"
+ id="path2676"
+ style="fill:url(#linearGradient3368);fill-opacity:1" />
+ <linearGradient
+ x1="26.294399"
+ y1="11.6704"
+ x2="71.901901"
+ y2="133.0273"
+ id="XMLID_35_"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ id="stop2679"
+ style="stop-color:#ff8080;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2681"
+ style="stop-color:#e20800;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 32.977,38.964 C 33.619,37.58 34.903,36.55 35.811,35.945 C 36.752,35.319 37.49,34.55 37.729,33.53 C 38.094,31.979 36.471,30.257 34.621,31.997 C 33.74,29.616 31.507,30.433 31.143,31.984 C 30.903,33.003 31.223,34.019 31.786,35 C 32.329,35.946 33.021,37.439 32.977,38.964 z"
+ id="path2683"
+ style="fill:url(#linearGradient3352);fill-opacity:1" />
+ <path
+ d="M 80.223,109.559 L 78.711,109.43 C 78.779,108.969 78.734,108.595 78.58,108.308 C 78.426,108.02 78.205,107.842 77.922,107.776 C 77.61,107.703 77.315,107.782 77.033,108.014 C 76.751,108.246 76.553,108.614 76.433,109.114 C 76.324,109.581 76.341,109.97 76.484,110.284 C 76.629,110.598 76.849,110.79 77.142,110.859 C 77.335,110.904 77.576,110.913 77.865,110.883 L 77.349,112.343 C 76.958,112.242 76.624,112.274 76.345,112.439 C 76.07,112.603 75.886,112.883 75.792,113.279 C 75.714,113.609 75.735,113.887 75.854,114.112 C 75.973,114.339 76.161,114.481 76.416,114.541 C 76.672,114.602 76.918,114.545 77.156,114.372 C 77.394,114.2 77.582,113.906 77.717,113.49 L 79.039,114.106 C 78.689,114.95 78.258,115.521 77.742,115.82 C 77.228,116.119 76.652,116.193 76.013,116.043 C 75.294,115.874 74.783,115.486 74.48,114.876 C 74.175,114.268 74.097,113.653 74.244,113.034 C 74.342,112.616 74.525,112.262 74.795,111.971 C 75.063,111.681 75.418,111.453 75.857,111.289 C 75.445,111.069 75.146,110.725 74.964,110.259 C 74.78,109.793 74.761,109.259 74.902,108.657 C 75.109,107.78 75.541,107.117 76.197,106.666 C 76.855,106.216 77.543,106.075 78.265,106.244 C 78.956,106.406 79.484,106.786 79.849,107.382 C 80.217,107.978 80.34,108.704 80.223,109.559 z"
+ id="path2694"
+ style="fill:#e20800;fill-opacity:1" /><path
+ d="M 81.063,95.83 C 80.422,97.214 79.138,98.244 78.23,98.85 C 77.29,99.477 76.55,100.246 76.311,101.264 C 75.947,102.815 77.57,104.536 79.419,102.797 C 80.301,105.178 82.533,104.361 82.898,102.811 C 83.138,101.791 82.819,100.776 82.255,99.795 C 81.711,98.849 81.021,97.355 81.063,95.83 z"
+ id="path2701"
+ style="fill:url(#linearGradient3382);fill-opacity:1" />
+ <linearGradient
+ x1="54.356899"
+ y1="1.124"
+ x2="99.964401"
+ y2="122.481"
+ id="XMLID_39_"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ id="stop2704"
+ style="stop-color:#ff8080;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2706"
+ style="stop-color:#e20800;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 63.174,42.222 C 64.361,39.656 66.742,37.748 68.427,36.625 C 70.171,35.463 71.54,34.04 71.985,32.15 C 72.66,29.274 69.651,26.081 66.22,29.307 C 64.585,24.892 60.448,26.406 59.772,29.281 C 59.329,31.172 59.921,33.055 60.965,34.873 C 61.97,36.628 63.253,39.396 63.174,42.222 z"
+ id="path2708"
+ style="fill:url(#linearGradient3370);fill-opacity:1" />
+ <linearGradient
+ x1="36.838902"
+ y1="7.7075"
+ x2="82.446297"
+ y2="129.0645"
+ id="XMLID_40_"
+ xlink:href="#XMLID_39_"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ id="stop2711"
+ style="stop-color:#ff8080;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2713"
+ style="stop-color:#e20800;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <path
+ d="M 55.486,74.959 C 56.672,72.393 59.054,70.485 60.737,69.362 C 62.481,68.2 63.851,66.777 64.296,64.886 C 64.97,62.01 61.962,58.818 58.532,62.043 C 56.897,57.628 52.759,59.142 52.082,62.018 C 51.638,63.908 52.23,65.792 53.275,67.609 C 54.281,69.364 55.565,72.132 55.486,74.959 z"
+ id="path2715"
+ style="fill:url(#linearGradient3354);fill-opacity:1" />
+ <path
+ d="M 51.37,92.488 C 50.182,95.054 47.801,96.961 46.117,98.084 C 44.373,99.246 43.004,100.67 42.559,102.561 C 41.884,105.436 44.893,108.627 48.323,105.404 C 49.958,109.82 54.096,108.304 54.772,105.428 C 55.217,103.538 54.623,101.655 53.579,99.836 C 52.573,98.082 51.291,95.314 51.37,92.488 z"
+ id="path2724"
+ style="fill:url(#linearGradient3376);fill-opacity:1" />
+ </g>
+</g>
+</svg> \ No newline at end of file
diff --git a/tests/auto/qimagereader/images/rect.svgz b/tests/auto/qimagereader/images/rect.svgz
new file mode 100644
index 0000000..c2e193b
--- /dev/null
+++ b/tests/auto/qimagereader/images/rect.svgz
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro
index 5b061b0..402e94b 100644
--- a/tests/auto/qimagereader/qimagereader.pro
+++ b/tests/auto/qimagereader/qimagereader.pro
@@ -9,6 +9,7 @@ RESOURCES += qimagereader.qrc
!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
!contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG
!contains(QT_CONFIG, no-tiff):DEFINES += QTEST_HAVE_TIFF
+!contains(QT_CONFIG, no-svg):DEFINES += QTEST_HAVE_SVG
win32-msvc:QMAKE_CXXFLAGS -= -Zm200
win32-msvc:QMAKE_CXXFLAGS += -Zm800
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index bc48244..278427b 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -61,5 +61,9 @@
<file>images/four-frames.gif</file>
<file>images/qt-gif-anim.gif</file>
<file>images/qt-gif-noanim.gif</file>
+ <file>images/rect.svg</file>
+ <file>images/rect.svgz</file>
+ <file>images/corrupt.svg</file>
+ <file>images/corrupt.svgz</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 99244c2..1b4c502 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -245,6 +245,10 @@ void tst_QImageReader::readImage_data()
QTest::newRow("MNG: ball") << QString("ball.mng") << true << QByteArray("mng");
QTest::newRow("MNG: fire") << QString("fire.mng") << true << QByteArray("mng");
#endif
+#if defined QTEST_HAVE_SVG
+ QTest::newRow("SVG: rect") << QString("rect.svg") << true << QByteArray("svg");
+ QTest::newRow("SVGZ: rect") << QString("rect.svgz") << true << QByteArray("svgz");
+#endif
}
void tst_QImageReader::readImage()
@@ -294,7 +298,6 @@ void tst_QImageReader::readImage()
QVERIFY(!image2Reader.format().isEmpty());
}
QCOMPARE(image, image2);
-
do {
QVERIFY2(!image.isNull(), io.errorString().toLatin1().constData());
} while (!(image = io.read()).isNull());
@@ -342,6 +345,10 @@ void tst_QImageReader::setScaledSize_data()
QTest::newRow("MNG: ball") << "ball" << QSize(200, 200) << QByteArray("mng");
QTest::newRow("MNG: fire") << "fire" << QSize(200, 200) << QByteArray("mng");
#endif // QTEST_HAVE_MNG
+#if defined QTEST_HAVE_SVG
+ QTest::newRow("SVG: rect") << "rect" << QSize(200, 200) << QByteArray("svg");
+ QTest::newRow("SVGZ: rect") << "rect" << QSize(200, 200) << QByteArray("svgz");
+#endif
}
void tst_QImageReader::setScaledSize()
@@ -409,6 +416,10 @@ void tst_QImageReader::setClipRect_data()
QTest::newRow("MNG: ball") << "ball" << QRect(0, 0, 50, 50) << QByteArray("mng");
QTest::newRow("MNG: fire") << "fire" << QRect(0, 0, 50, 50) << QByteArray("mng");
#endif // QTEST_HAVE_MNG
+#if defined QTEST_HAVE_SVG
+ QTest::newRow("SVG: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svg");
+ QTest::newRow("SVGZ: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svgz");
+#endif
}
void tst_QImageReader::setClipRect()
@@ -456,6 +467,10 @@ void tst_QImageReader::setScaledClipRect_data()
QTest::newRow("MNG: ball") << "ball" << QRect(0, 0, 50, 50) << QByteArray("mng");
QTest::newRow("MNG: fire") << "fire" << QRect(0, 0, 50, 50) << QByteArray("mng");
#endif // QTEST_HAVE_MNG
+#if defined QTEST_HAVE_SVG
+ QTest::newRow("SVG: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svg");
+ QTest::newRow("SVGZ: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svgz");
+#endif
}
void tst_QImageReader::setScaledClipRect()
@@ -509,6 +524,8 @@ void tst_QImageReader::imageFormat_data()
QTest::newRow("png-2") << QString("YCbCr_cmyk.png") << QByteArray("png") << QImage::Format_RGB32;
QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng") << QImage::Format_Invalid;
QTest::newRow("mng-2") << QString("fire.mng") << QByteArray("mng") << QImage::Format_Invalid;
+ QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg") << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz") << QImage::Format_ARGB32_Premultiplied;
}
void tst_QImageReader::imageFormat()
@@ -530,6 +547,10 @@ void tst_QImageReader::imageFormat()
#ifndef QTEST_HAVE_MNG
return;
#endif // !QTEST_HAVE_MNG
+ if (QByteArray("svg") == format || QByteArray("svgz") == format)
+#ifndef QTEST_HAVE_SVG
+ return;
+#endif // !QTEST_HAVE_SVG
QSKIP(("Qt does not support the " + format + " format.").constData(), SkipSingle);
} else {
QCOMPARE(QImageReader::imageFormat(prefix + fileName), format);
@@ -604,6 +625,10 @@ void tst_QImageReader::setBackgroundColor_data()
QTest::newRow("MNG: ball") << QString("ball.mng") << QColor(Qt::yellow);
QTest::newRow("MNG: fire") << QString("fire.mng") << QColor(Qt::gray);
#endif
+#if defined QTEST_HAVE_SVG
+ QTest::newRow("SVG: rect") << QString("rect.svg") << QColor(Qt::darkGreen);
+ QTest::newRow("SVGZ: rect") << QString("rect.svgz") << QColor(Qt::darkGreen);
+#endif
}
void tst_QImageReader::setBackgroundColor()
@@ -641,6 +666,10 @@ void tst_QImageReader::supportsAnimation_data()
QTest::newRow("MNG: ball") << QString("ball.mng") << true;
QTest::newRow("MNG: fire") << QString("fire.mng") << true;
#endif
+#if defined QTEST_HAVE_SVG
+ QTest::newRow("SVG: rect") << QString("rect.svg") << false;
+ QTest::newRow("SVGZ: rect") << QString("rect.svgz") << false;
+#endif
}
void tst_QImageReader::supportsAnimation()
@@ -979,6 +1008,10 @@ void tst_QImageReader::readFromDevice_data()
QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng");
QTest::newRow("mng-2") << QString("fire.mng") << QByteArray("mng");
#endif // QTEST_HAVE_MNG
+#if defined QTEST_HAVE_SVG
+ QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg");
+ QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz");
+#endif
}
void tst_QImageReader::readFromDevice()
@@ -1059,6 +1092,10 @@ void tst_QImageReader::readFromFileAfterJunk_data()
QTest::newRow("png") << QString("kollada.png") << QByteArray("png");
// QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng");
// QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng");
+#if defined QTEST_HAVE_SVG
+ QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg");
+ QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz");
+#endif
}
void tst_QImageReader::readFromFileAfterJunk()
@@ -1081,7 +1118,7 @@ void tst_QImageReader::readFromFileAfterJunk()
QVERIFY(!imageData.isNull());
int iterations = 10;
- if (format == "ppm" || format == "pbm" || format == "pgm")
+ if (format == "ppm" || format == "pbm" || format == "pgm" || format == "svg" || format == "svgz")
iterations = 1;
if (format == "mng" || !QImageWriter::supportedImageFormats().contains(format)) {
@@ -1233,6 +1270,20 @@ void tst_QImageReader::readFromResources_data()
<< QByteArray("mng") << QSize(32, 32)
<< QString("");
#endif
+#ifdef QTEST_HAVE_SVG
+ QTest::newRow("rect.svg") << QString("rect.svg")
+ << QByteArray("svg") << QSize(105, 137)
+ << QString("");
+ QTest::newRow("rect.svgz") << QString("rect.svgz")
+ << QByteArray("svgz") << QSize(105, 137)
+ << QString("");
+ QTest::newRow("corrupt.svg") << QString("corrupt.svg")
+ << QByteArray("svg") << QSize(0, 0)
+ << QString("");
+ QTest::newRow("corrupt.svgz") << QString("corrupt.svgz")
+ << QByteArray("svgz") << QSize(0, 0)
+ << QString("");
+#endif
QTest::newRow("image.pbm") << QString("image.pbm")
<< QByteArray("pbm") << QSize(16, 6)
<< QString("");
@@ -1405,6 +1456,10 @@ void tst_QImageReader::readCorruptImage_data()
#if defined QTEST_HAVE_TIFF
QTest::newRow("corrupt tiff") << QString("corrupt-data.tif") << true << QString("");
#endif
+#if defined QTEST_HAVE_SVG
+ QTest::newRow("corrupt svg") << QString("corrupt.svg") << true << QString("");
+ QTest::newRow("corrupt svgz") << QString("corrupt.svgz") << true << QString("");
+#endif
}
void tst_QImageReader::readCorruptImage()
@@ -1753,6 +1808,11 @@ void tst_QImageReader::testIgnoresFormatAndExtension_data()
#if defined QTEST_HAVE_TIFF
QTest::newRow("image_100dpi.tif") << "image_100dpi" << "tif" << "tiff";
#endif
+
+#if defined QTEST_HAVE_SVG
+ QTest::newRow("rect.svg") << "rect" << "svg" << "svg";
+ QTest::newRow("rect.svgz") << "rect" << "svgz" << "svgz";
+#endif
}
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp
index bb4a0d2..c0b1303 100644
--- a/tests/auto/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp
@@ -706,6 +706,12 @@ void tst_QMetaObject::normalizedSignature_data()
QTest::newRow("const6") << "void foo(QList<const int>)" << "void foo(QList<const int>)";
QTest::newRow("const7") << "void foo(QList<const int*>)" << "void foo(QList<const int*>)";
QTest::newRow("const8") << "void foo(QList<int const*>)" << "void foo(QList<const int*>)";
+ QTest::newRow("const9") << "void foo(const Foo<Bar>)" << "void foo(Foo<Bar>)";
+ QTest::newRow("const10") << "void foo(Foo<Bar>const)" << "void foo(Foo<Bar>)";
+ QTest::newRow("const11") << "void foo(Foo<Bar> *const)" << "void foo(Foo<Bar>*const)";
+ QTest::newRow("const12") << "void foo(Foo<Bar>const*const *const)" << "void foo(Foo<Bar>*const*const)";
+ QTest::newRow("const13") << "void foo(const Foo<Bar>&)" << "void foo(Foo<Bar>)";
+ QTest::newRow("const14") << "void foo(Foo<Bar>const&)" << "void foo(Foo<Bar>)";
}
void tst_QMetaObject::normalizedSignature()
@@ -734,6 +740,14 @@ void tst_QMetaObject::normalizedType_data()
QTest::newRow("template7") << "QList<QList<int> >" << "QList<QList<int> >";
QTest::newRow("value1") << "const QString &" << "QString";
QTest::newRow("value2") << "QString const &" << "QString";
+ QTest::newRow("constInName1") << "constconst" << "constconst";
+ QTest::newRow("constInName2") << "constconst*" << "constconst*";
+ QTest::newRow("constInName3") << "const constconst&" << "constconst";
+ QTest::newRow("constInName4") << "constconst const*const" << "constconst*const";
+ QTest::newRow("class") << "const class foo&" << "foo";
+ QTest::newRow("struct") << "const struct foo*" << "const foo*";
+ QTest::newRow("struct2") << "struct foo const*" << "const foo*";
+ QTest::newRow("enum") << "enum foo" << "foo";
}
void tst_QMetaObject::normalizedType()
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 8da3484..08b7c19 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -2088,6 +2088,9 @@ signals:
void typePointerConstRefSignal(Class * const &);
+ void constTemplateSignal1( Template<int > );
+ void constTemplateSignal2( Template< const int >);
+
public slots:
void uintPointerSlot(uint *) { }
void ulongPointerSlot(ulong *) { }
@@ -2124,6 +2127,10 @@ public slots:
void typeConstRefSlot(Template<Class const &> const &) {}
void typePointerConstRefSlot(Class * const &) {}
+
+ void constTemplateSlot1(Template<int > const) {}
+ void constTemplateSlot2(const Template<int > ) {}
+ void constTemplateSlot3(const Template< const int >) {}
};
#include "oldnormalizeobject.h"
@@ -2526,6 +2533,19 @@ void tst_QObject::normalize()
QVERIFY(object.connect(&object,
SIGNAL(typePointerConstRefSignal(Class*)),
SLOT(typePointerConstRefSlot(Class*))));
+
+ QVERIFY( connect(&object, SIGNAL(constTemplateSignal1(Template <int>)),
+ &object , SLOT(constTemplateSlot1 (Template<int > ) ) ));
+ QVERIFY( connect(&object, SIGNAL(constTemplateSignal1(Template <int>)),
+ &object , SLOT(constTemplateSlot2 (Template<int > ) ) ));
+ QVERIFY( connect(&object, SIGNAL(constTemplateSignal2(Template <const int>)),
+ &object , SLOT(constTemplateSlot3(Template<int const > ) ) ));
+
+ //type does not match
+ QTest::ignoreMessage(QtWarningMsg, "QObject::connect: Incompatible sender/receiver arguments\n"
+ " NormalizeObject::constTemplateSignal1(Template<int>) --> NormalizeObject::constTemplateSlot3(Template<const int>)");
+ QVERIFY(!connect(&object, SIGNAL(constTemplateSignal1(Template <int>)),
+ &object , SLOT(constTemplateSlot3(Template<int const> ) ) ));
}
class SiblingDeleter : public QObject
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 0615b63..3c6c7b2 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -161,6 +161,7 @@ private slots:
void qRegExpInport_data();
void qRegExpInport();
+ void reentrency();
};
tst_QScriptEngine::tst_QScriptEngine()
@@ -4577,5 +4578,25 @@ void tst_QScriptEngine::qRegExpInport()
}
}
+static QScriptValue createAnotherEngine(QScriptContext *, QScriptEngine *)
+{
+ QScriptEngine eng;
+ eng.evaluate("function foo(x, y) { return x + y; }" );
+ eng.evaluate("hello = 5; world = 6" );
+ return eng.evaluate("foo(hello,world)").toInt32();
+}
+
+
+void tst_QScriptEngine::reentrency()
+{
+ QScriptEngine eng;
+ eng.globalObject().setProperty("foo", eng.newFunction(createAnotherEngine));
+ eng.evaluate("function bar() { return foo(); } hello = 9; function getHello() { return hello; }");
+ QCOMPARE(eng.evaluate("foo() + getHello() + foo()").toInt32(), 5+6 + 9 + 5+6);
+ QCOMPARE(eng.evaluate("foo").call().toInt32(), 5+6);
+ QCOMPARE(eng.evaluate("hello").toInt32(), 9);
+ QCOMPARE(eng.evaluate("foo() + hello").toInt32(), 5+6+9);
+}
+
QTEST_MAIN(tst_QScriptEngine)
#include "tst_qscriptengine.moc"
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp
index 16832ad..c7801ac 100644
--- a/tests/auto/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/qstatictext/tst_qstatictext.cpp
@@ -69,7 +69,7 @@ private slots:
void drawToRect_data();
void drawToRect();
void setFont();
- void setMaximumSize();
+ void setTextWidth();
void prepareToCorrectData();
void prepareToWrongData();
@@ -79,6 +79,12 @@ private slots:
void projectedPainter();
void rotatedScaledAndTranslatedPainter();
void transformationChanged();
+
+ void plainTextVsRichText();
+
+ void setPenPlainText();
+ void setPenRichText();
+ void richTextOverridesPen();
};
void tst_QStaticText::init()
@@ -121,7 +127,7 @@ void tst_QStaticText::drawToPoint()
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
text.setTextFormat(Qt::PlainText);
text.setPerformanceHint(performanceHint);
- p.drawStaticText(QPointF(11, 12), text);
+ p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text);
}
QCOMPARE(imageDrawStaticText, imageDrawText);
@@ -150,12 +156,19 @@ void tst_QStaticText::drawToRect()
imageDrawStaticText.fill(Qt::white);
{
QPainter p(&imageDrawStaticText);
- QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", QSizeF(10, 500));
+ QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
+ text.setTextWidth(10),
+ p.setClipRect(QRectF(11, 12, 10, 500));
text.setPerformanceHint(performanceHint);
text.setTextFormat(Qt::PlainText);
p.drawStaticText(QPointF(11, 12), text);
}
+#if defined(DEBUG_SAVE_IMAGE)
+ imageDrawText.save("drawToRect_imageDrawText.png");
+ imageDrawStaticText.save("drawToRect_imageDrawStaticText.png");
+#endif
+
QCOMPARE(imageDrawStaticText, imageDrawText);
}
@@ -181,7 +194,7 @@ void tst_QStaticText::prepareToCorrectData()
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
text.prepare(transform, p.font());
text.setTextFormat(Qt::PlainText);
- p.drawStaticText(QPointF(11, 12), text);
+ p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text);
}
if (!supportsTransformations())
@@ -209,7 +222,7 @@ void tst_QStaticText::prepareToWrongData()
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
text.prepare(transform, p.font());
text.setTextFormat(Qt::PlainText);
- p.drawStaticText(QPointF(11, 12), text);
+ p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text);
}
QCOMPARE(imageDrawStaticText, imageDrawText);
@@ -226,10 +239,10 @@ void tst_QStaticText::setFont()
imageDrawText.fill(Qt::white);
{
QPainter p(&imageDrawText);
- p.drawText(0, 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
+ p.drawText(QRectF(0, 0, 1000, 1000), 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
p.setFont(font);
- p.drawText(11, 120, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
+ p.drawText(QRectF(11, 120, 1000, 1000), 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
}
QPixmap imageDrawStaticText(1000, 1000);
@@ -247,10 +260,15 @@ void tst_QStaticText::setFont()
p.drawStaticText(11, 120, text);
}
+#if defined(DEBUG_SAVE_IMAGE)
+ imageDrawText.save("setFont_imageDrawText.png");
+ imageDrawStaticText.save("setFont_imageDrawStaticText.png");
+#endif
+
QCOMPARE(imageDrawStaticText, imageDrawText);
}
-void tst_QStaticText::setMaximumSize()
+void tst_QStaticText::setTextWidth()
{
QPixmap imageDrawText(1000, 1000);
imageDrawText.fill(Qt::white);
@@ -264,7 +282,8 @@ void tst_QStaticText::setMaximumSize()
{
QPainter p(&imageDrawStaticText);
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
- text.setMaximumSize(QSizeF(10, 500));
+ text.setTextWidth(10);
+ p.setClipRect(QRectF(11, 12, 10, 500));
p.drawStaticText(QPointF(11, 12), text);
}
@@ -291,7 +310,7 @@ void tst_QStaticText::translatedPainter()
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
text.setTextFormat(Qt::PlainText);
- p.drawStaticText(QPointF(11, 12), text);
+ p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text);
}
QCOMPARE(imageDrawStaticText, imageDrawText);
@@ -323,7 +342,7 @@ void tst_QStaticText::rotatedPainter()
{
QPainter p(&imageDrawText);
p.rotate(30.0);
- p.drawText(0, 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
+ p.drawText(QRectF(0, 0, 1000, 100), 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
}
QPixmap imageDrawStaticText(1000, 1000);
@@ -367,7 +386,7 @@ void tst_QStaticText::scaledPainter()
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
text.setTextFormat(Qt::PlainText);
- p.drawStaticText(QPointF(11, 12), text);
+ p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text);
}
if (!supportsTransformations())
@@ -398,7 +417,7 @@ void tst_QStaticText::projectedPainter()
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
text.setTextFormat(Qt::PlainText);
- p.drawStaticText(QPointF(11, 12), text);
+ p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text);
}
QCOMPARE(imageDrawStaticText, imageDrawText);
@@ -428,7 +447,7 @@ void tst_QStaticText::rotatedScaledAndTranslatedPainter()
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
text.setTextFormat(Qt::PlainText);
- p.drawStaticText(QPointF(11, 12), text);
+ p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text);
}
#if defined(DEBUG_SAVE_IMAGE)
@@ -450,10 +469,10 @@ void tst_QStaticText::transformationChanged()
p.rotate(33.0);
p.scale(0.5, 0.7);
- p.drawText(0, 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
+ p.drawText(QRectF(0, 0, 1000, 1000), 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
p.scale(7.0, 5.0);
- p.drawText(0, 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
+ p.drawText(QRectF(0, 0, 1000, 1000), 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
}
QPixmap imageDrawStaticText(1000, 1000);
@@ -482,5 +501,125 @@ void tst_QStaticText::transformationChanged()
QCOMPARE(imageDrawStaticText, imageDrawText);
}
+void tst_QStaticText::plainTextVsRichText()
+{
+ QPixmap imagePlainText(1000, 1000);
+ imagePlainText.fill(Qt::white);
+ {
+ QPainter p(&imagePlainText);
+
+ QStaticText staticText;
+ staticText.setText("FOObar");
+ staticText.setTextFormat(Qt::PlainText);
+
+ p.drawStaticText(10, 10, staticText);
+ }
+
+ QPixmap imageRichText(1000, 1000);
+ imageRichText.fill(Qt::white);
+ {
+ QPainter p(&imageRichText);
+
+ QStaticText staticText;
+ staticText.setText("<html><body>FOObar</body></html>");
+ staticText.setTextFormat(Qt::RichText);
+
+ p.drawStaticText(10, 10, staticText);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ imagePlainText.save("plainTextVsRichText_imagePlainText.png");
+ imageRichText.save("plainTextVsRichText_imageRichText.png");
+#endif
+
+ QCOMPARE(imagePlainText, imageRichText);
+}
+
+void tst_QStaticText::setPenPlainText()
+{
+ QFont font = QApplication::font();
+ font.setStyleStrategy(QFont::NoAntialias);
+
+ QFontMetricsF fm(font);
+ QPixmap image(qCeil(fm.width("XXXXX")), qCeil(fm.height()));
+ image.fill(Qt::white);
+ {
+ QPainter p(&image);
+ p.setFont(font);
+ p.setPen(Qt::green);
+
+ QStaticText staticText("XXXXX");
+ staticText.setTextFormat(Qt::PlainText);
+ p.drawStaticText(0, fm.ascent(), staticText);
+ }
+
+ QImage img = image.toImage();
+ for (int x=0; x<img.width(); ++x) {
+ for (int y=0; y<img.height(); ++y) {
+ QRgb pixel = img.pixel(x, y);
+ QVERIFY(pixel == QColor(Qt::white).rgba()
+ || pixel == QColor(Qt::green).rgba());
+ }
+ }
+}
+
+void tst_QStaticText::setPenRichText()
+{
+ QFont font = QApplication::font();
+ font.setStyleStrategy(QFont::NoAntialias);
+
+ QFontMetricsF fm(font);
+ QPixmap image(qCeil(fm.width("XXXXX")), qCeil(fm.height()));
+ image.fill(Qt::white);
+ {
+ QPainter p(&image);
+ p.setFont(font);
+ p.setPen(Qt::green);
+
+ QStaticText staticText;
+ staticText.setText("<html><body>XXXXX</body></html>");
+ staticText.setTextFormat(Qt::RichText);
+ p.drawStaticText(0, 0, staticText);
+ }
+
+ QImage img = image.toImage();
+ for (int x=0; x<img.width(); ++x) {
+ for (int y=0; y<img.height(); ++y) {
+ QRgb pixel = img.pixel(x, y);
+ QVERIFY(pixel == QColor(Qt::white).rgba()
+ || pixel == QColor(Qt::green).rgba());
+ }
+ }
+}
+
+void tst_QStaticText::richTextOverridesPen()
+{
+ QFont font = QApplication::font();
+ font.setStyleStrategy(QFont::NoAntialias);
+
+ QFontMetricsF fm(font);
+ QPixmap image(qCeil(fm.width("XXXXX")), qCeil(fm.height()));
+ image.fill(Qt::white);
+ {
+ QPainter p(&image);
+ p.setFont(font);
+ p.setPen(Qt::green);
+
+ QStaticText staticText;
+ staticText.setText("<html><body><font color=\"#ff0000\">XXXXX</font></body></html>");
+ staticText.setTextFormat(Qt::RichText);
+ p.drawStaticText(0, 0, staticText);
+ }
+
+ QImage img = image.toImage();
+ for (int x=0; x<img.width(); ++x) {
+ for (int y=0; y<img.height(); ++y) {
+ QRgb pixel = img.pixel(x, y);
+ QVERIFY(pixel == QColor(Qt::white).rgba()
+ || pixel == QColor(Qt::red).rgba());
+ }
+ }
+}
+
QTEST_MAIN(tst_QStaticText)
#include "tst_qstatictext.moc"
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index 1c64ade..4e7123f 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -2178,6 +2178,45 @@ void tst_QTextCodec::moreToFromUnicode_data() {
koi8_u_ba.append(x);
}
QTest::newRow("KOI8-U") << QByteArray("KOI8-U") << koi8_u_ba;
+
+
+ QByteArray big5_ba;
+ for (unsigned char u=0xa1; u<=0xf9; u++) {
+ if (u==0xc8) {
+ continue;
+ }
+ for (unsigned char v=0x40; v<=0x7e; v++) {
+ big5_ba.append(u);
+ big5_ba.append(v);
+ }
+ unsigned char v_up;
+ switch (u) {
+ case 0xa3: v_up=0xbf; break;
+ case 0xc7: v_up=0xfc; break;
+ case 0xf9: v_up=0xd5; break;
+ default: v_up=0xfe;
+ }
+
+ for (unsigned char v=0xa1; v<=v_up; v++) {
+ if (u==0xa2 && (v==0xcc || v==0xce)) {
+ continue;
+ }
+ big5_ba.append(u);
+ big5_ba.append(v);
+ }
+ }
+
+ QTest::newRow("BIG5") << QByteArray("BIG5") << big5_ba;
+
+ QByteArray gb2312_ba;
+ for (unsigned char u=0xa1; u<=0xf7; u++) {
+ for (unsigned char v=0xa1; v<=0xfe; v++) {
+ gb2312_ba.append(u);
+ gb2312_ba.append(v);
+ }
+ }
+
+ QTest::newRow("GB2312") << QByteArray("GB2312") << gb2312_ba;
}
void tst_QTextCodec::moreToFromUnicode()
diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
index 841f5b9..018c036 100644
--- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -1068,6 +1068,42 @@ void tst_QTextScriptEngine::greek()
QSKIP("couln't find DejaVu Sans", SkipAll);
}
}
+
+ {
+ if (QFontDatabase().families(QFontDatabase::Any).contains("SBL Greek")) {
+ QFont f("SBL Greek");
+ for (int uc = 0x1f00; uc <= 0x1fff; ++uc) {
+ QString str;
+ str.append(uc);
+ if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) {
+ //qDebug() << "skipping" << hex << uc;
+ continue;
+ }
+ if (uc == 0x1fc1 || uc == 0x1fed)
+ continue;
+ QVERIFY( decomposedShaping(f, QChar(uc) ) );
+
+ }
+
+ const ShapeTable shape_table [] = {
+ { { 0x3b1, 0x300, 0x313, 0x0 },
+ { 0xb8, 0x3d3, 0x3c7, 0x0 } },
+ { { 0x3b1, 0x313, 0x300, 0x0 },
+ { 0xd4, 0x0 } },
+
+ { {0}, {0} }
+ };
+
+
+ const ShapeTable *s = shape_table;
+ while (s->unicode[0]) {
+ QVERIFY( shaping(f, s) );
+ ++s;
+ }
+ } else {
+ QSKIP("couln't find SBL_grk", SkipAll);
+ }
+ }
#else
QSKIP("X11 specific test", SkipAll);
#endif
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index bdc0a0c..2de189d 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -237,6 +237,7 @@ private slots:
void task245654_changeModelAndExpandAll();
void doubleClickedWithSpans();
void taskQTBUG_6450_selectAllWith1stColumnHidden();
+ void taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint();
};
class QtTestModel: public QAbstractItemModel
@@ -3714,5 +3715,43 @@ void tst_QTreeView::taskQTBUG_6450_selectAllWith1stColumnHidden()
QVERIFY(tree.selectionModel()->isRowSelected(i, QModelIndex()));
}
+class TreeViewQTBUG_9216 : public QTreeView
+{
+ Q_OBJECT
+public:
+ void paintEvent(QPaintEvent *event)
+ {
+ if (doCompare)
+ QCOMPARE(event->rect(), viewport()->rect());
+ QTreeView::paintEvent(event);
+ painted++;
+ }
+ int painted;
+ bool doCompare;
+};
+
+void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint()
+{
+ QStandardItemModel model(10, 10, this);
+ for (int row = 0; row < 10; row++)
+ for (int col = 0; col < 10; col++)
+ model.setItem(row, col, new QStandardItem(QString("row %0, col %1").arg(row).arg(col)));
+ TreeViewQTBUG_9216 view;
+ view.setUniformRowHeights(true);
+ view.setModel(&model);
+ view.painted = 0;
+ view.doCompare = false;
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ QTRY_VERIFY(view.painted > 0);
+
+ QTest::qWait(100); // This one is needed to make the test fail before the patch.
+ view.painted = 0;
+ view.doCompare = true;
+ model.setData(model.index(0, 0), QVariant(QSize(50, 50)), Qt::SizeHintRole);
+ QTest::qWait(100);
+ QTRY_VERIFY(view.painted > 0);
+}
+
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"
diff --git a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp
index 1c43069..5708726 100644
--- a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -133,6 +133,12 @@ void tst_QVarLengthArray::oldTests()
QVERIFY(sa.data() == &sa[0]);
QVERIFY(sa[0] == 0xfee);
QVERIFY(sa[10] == 0xff);
+ QVERIFY(sa.at(0) == 0xfee);
+ QVERIFY(sa.at(10) == 0xff);
+ QVERIFY(sa.value(0) == 0xfee);
+ QVERIFY(sa.value(10) == 0xff);
+ QVERIFY(sa.value(1000) == 0);
+ QVERIFY(sa.value(1000, 12) == 12);
QVERIFY(sa.size() == 512);
sa.reserve(1024);
QVERIFY(sa.capacity() == 1024);
@@ -168,6 +174,13 @@ void tst_QVarLengthArray::oldTests()
QCOMPARE(sa.size(), 12);
QCOMPARE(sa[10], QString("hello"));
QCOMPARE(sa[11], QString("world"));
+ QCOMPARE(sa.at(10), QString("hello"));
+ QCOMPARE(sa.at(11), QString("world"));
+ QCOMPARE(sa.value(10), QString("hello"));
+ QCOMPARE(sa.value(11), QString("world"));
+ QCOMPARE(sa.value(10000), QString());
+ QCOMPARE(sa.value(1212112, QString("none")), QString("none"));
+ QCOMPARE(sa.value(-12, QString("neg")), QString("neg"));
sa.append(arr, 1);
QCOMPARE(sa.size(), 13);