summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-10-30 12:42:27 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-10-30 12:42:27 (GMT)
commitdc1b1b37e1ebe055d3bd46bc43e0c3b9612560bc (patch)
tree05f9f9bc92322c9b42257c00ae2df14700fdd35f /tests
parent79a7c969983eafeef67cce28724c3981cf3af1ea (diff)
parente95e69f7d1209cceacdef0f26416b93c1d83e8e0 (diff)
downloadQt-dc1b1b37e1ebe055d3bd46bc43e0c3b9612560bc.zip
Qt-dc1b1b37e1ebe055d3bd46bc43e0c3b9612560bc.tar.gz
Qt-dc1b1b37e1ebe055d3bd46bc43e0c3b9612560bc.tar.bz2
Merge commit 'origin/4.6' into 4.6
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp19
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result8
-rw-r--r--tests/auto/qboxlayout/tst_qboxlayout.cpp1
-rw-r--r--tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp2
-rw-r--r--tests/auto/qdatetime/tst_qdatetime.cpp7
-rw-r--r--tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp3
-rw-r--r--tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp99
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp4
-rw-r--r--tests/auto/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp2
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp2
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp2
-rw-r--r--tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp2
-rw-r--r--tests/auto/qsound/tst_qsound.cpp2
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp74
-rw-r--r--tests/auto/qurl/tst_qurl.cpp47
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp2
16 files changed, 247 insertions, 29 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
index 8201add..e243e66 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
@@ -228,3 +228,22 @@ QT_TRID_NOOP("this_a_id")
//~ some thing
//% "This needs to be here. Really."
QString test = qtTrId("this_another_id", n);
+
+
+
+class YetAnotherTest : QObject {
+ Q_OBJECT
+
+ int function(void)
+ {
+ //
+ //:
+ //=
+ //~
+ //#
+ //=============
+ //~~~~~~~~~~~~~
+ //:::::::::::::
+ tr("nothing");
+ }
+};
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
index d63c7c3..26e5a65 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -278,6 +278,14 @@ backslashed \ stuff.</source>
</message>
</context>
<context>
+ <name>YetAnotherTest</name>
+ <message>
+ <location filename="main.cpp" line="247"/>
+ <source>nothing</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>scope</name>
<message numerus="yes">
<location filename="main.cpp" line="187"/>
diff --git a/tests/auto/qboxlayout/tst_qboxlayout.cpp b/tests/auto/qboxlayout/tst_qboxlayout.cpp
index 7ff444b..8887288 100644
--- a/tests/auto/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/qboxlayout/tst_qboxlayout.cpp
@@ -211,7 +211,6 @@ void tst_QBoxLayout::setGeometry()
QRect newGeom(0, 0, 70, 70);
lay2->setGeometry(newGeom);
- QApplication::processEvents();
QVERIFY2(newGeom.contains(dial->geometry()), "dial->geometry() should be smaller and within newGeom");
}
diff --git a/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp
index 002aeb7..dedc0cb 100644
--- a/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp
+++ b/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp
@@ -379,7 +379,7 @@ void tst_QDataWidgetMapper::comboBox()
model->setData(model->index(0, 1), QString("read write item z"), Qt::EditRole);
QCOMPARE(readOnlyBox.currentIndex(), 2);
- QEXPECT_FAIL("", "See tasks 125493 and 147153", Abort);
+ QEXPECT_FAIL("", "See task 125493 and QTBUG-428", Abort);
QCOMPARE(readWriteBox.currentText(), QString("read write item z"));
}
diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp
index 8fb0c91..c53780e 100644
--- a/tests/auto/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/qdatetime/tst_qdatetime.cpp
@@ -447,7 +447,14 @@ void tst_QDateTime::toString_enumformat()
QCOMPARE(str2, QString("1995-05-20T12:34:56"));
QString str3 = dt1.toString(Qt::LocalDate);
+ qDebug() << str3;
QVERIFY(!str3.isEmpty());
+ //check for date/time components in any order
+ QVERIFY(str3.contains("1995"));
+ //day and month may be in numeric or word form
+ QVERIFY(str3.contains("12"));
+ QVERIFY(str3.contains("34"));
+ QVERIFY(str3.contains("56"));
}
void tst_QDateTime::addDays()
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
index 0201bc4..b40cf43 100644
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -379,7 +379,8 @@ void tst_QGraphicsEffect::grayscale()
item->setPen(Qt::NoPen);
item->setBrush(QColor(122, 193, 66)); // Qt light green
- QGraphicsGrayscaleEffect *effect = new QGraphicsGrayscaleEffect;
+ QGraphicsColorizeEffect *effect = new QGraphicsColorizeEffect;
+ effect->setColor(Qt::black);
item->setGraphicsEffect(effect);
QPainter painter;
diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index 855950b..fbeb425 100644
--- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
@@ -166,6 +166,9 @@ private slots:
void deviceRect();
void pixmap();
+ void pixmapPadding_data();
+ void pixmapPadding();
+
private:
QGraphicsView *view;
QGraphicsScene *scene;
@@ -318,6 +321,102 @@ void tst_QGraphicsEffectSource::pixmap()
QCOMPARE(pixmap1, pixmap2);
}
+class PaddingEffect : public QGraphicsEffect
+{
+public:
+ PaddingEffect(QObject *parent) : QGraphicsEffect(parent)
+ {
+ }
+
+ QRectF boundingRectFor(const QRectF &src) const {
+ return src.adjusted(-10, -10, 10, 10);
+ }
+
+ void draw(QPainter *, QGraphicsEffectSource *source) {
+ pix = source->pixmap(coordinateMode, &offset, padMode);
+ }
+
+ QPixmap pix;
+ QPoint offset;
+ QGraphicsEffectSource::PixmapPadMode padMode;
+ Qt::CoordinateSystem coordinateMode;
+};
+
+void tst_QGraphicsEffectSource::pixmapPadding_data()
+{
+ QTest::addColumn<int>("coordinateMode");
+ QTest::addColumn<int>("padMode");
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QPoint>("offset");
+ QTest::addColumn<uint>("ulPixel");
+
+ QTest::newRow("log,nopad") << int(Qt::LogicalCoordinates)
+ << int(QGraphicsEffectSource::NoExpandPadMode)
+ << QSize(10, 10) << QPoint(0, 0)
+ << 0xffff0000u;
+
+ QTest::newRow("log,transparent") << int(Qt::LogicalCoordinates)
+ << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode)
+ << QSize(12, 12) << QPoint(-1, -1)
+ << 0x00000000u;
+
+ QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates)
+ << int(QGraphicsEffectSource::ExpandToEffectRectPadMode)
+ << QSize(30, 30) << QPoint(-10, -10)
+ << 0x00000000u;
+
+ QTest::newRow("dev,nopad") << int(Qt::DeviceCoordinates)
+ << int(QGraphicsEffectSource::NoExpandPadMode)
+ << QSize(20, 20) << QPoint(40, 40)
+ << 0xffff0000u;
+
+ QTest::newRow("dev,transparent") << int(Qt::DeviceCoordinates)
+ << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode)
+ << QSize(22, 22) << QPoint(39, 39)
+ << 0x00000000u;
+
+ QTest::newRow("dev,effectrect") << int(Qt::DeviceCoordinates)
+ << int(QGraphicsEffectSource::ExpandToEffectRectPadMode)
+ << QSize(40, 40) << QPoint(30, 30)
+ << 0x00000000u;
+
+}
+
+void tst_QGraphicsEffectSource::pixmapPadding()
+{
+ QPixmap dummyTarget(100, 100);
+ QPainter dummyPainter(&dummyTarget);
+ dummyPainter.translate(40, 40);
+ dummyPainter.scale(2, 2);
+
+ QPixmap pm(10, 10);
+ pm.fill(Qt::red);
+
+ QGraphicsScene *scene = new QGraphicsScene();
+ PaddingEffect *effect = new PaddingEffect(scene);
+ QGraphicsPixmapItem *pmItem = new QGraphicsPixmapItem(pm);
+ scene->addItem(pmItem);
+ pmItem->setGraphicsEffect(effect);
+
+ QFETCH(int, coordinateMode);
+ QFETCH(int, padMode);
+ QFETCH(QPoint, offset);
+ QFETCH(QSize, size);
+ QFETCH(uint, ulPixel);
+
+ effect->padMode = (QGraphicsEffectSource::PixmapPadMode) padMode;
+ effect->coordinateMode = (Qt::CoordinateSystem) coordinateMode;
+
+ scene->render(&dummyPainter, scene->itemsBoundingRect(), scene->itemsBoundingRect());
+
+ QCOMPARE(effect->pix.size(), size);
+ QCOMPARE(effect->offset, offset);
+ QCOMPARE(effect->pix.toImage().pixel(0, 0), ulPixel);
+
+ // ### Fix corruption in scene destruction, then enable...
+ // delete scene;
+}
+
QTEST_MAIN(tst_QGraphicsEffectSource)
#include "tst_qgraphicseffectsource.moc"
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 28f249f..684ad4f 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -3111,7 +3111,7 @@ void tst_QGraphicsItem::boundingRects()
void tst_QGraphicsItem::boundingRects2()
{
QGraphicsPixmapItem pixmap(QPixmap::fromImage(QImage(100, 100, QImage::Format_ARGB32_Premultiplied)));
- QCOMPARE(pixmap.boundingRect(), QRectF(-0.5, -0.5, 101, 101));
+ QCOMPARE(pixmap.boundingRect(), QRectF(0, 0, 100, 100));
QGraphicsLineItem line(0, 0, 100, 0);
line.setPen(QPen(Qt::black, 1));
@@ -4041,7 +4041,7 @@ void tst_QGraphicsItem::defaultItemTest_QGraphicsPixmapItem()
item.setOffset(QPointF(-10, -10));
QCOMPARE(item.offset(), QPointF(-10, -10));
- QCOMPARE(item.boundingRect(), QRectF(-10.5, -10.5, 301, 201));
+ QCOMPARE(item.boundingRect(), QRectF(-10, -10, 300, 200));
}
void tst_QGraphicsItem::defaultItemTest_QGraphicsTextItem()
diff --git a/tests/auto/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp b/tests/auto/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
index e25aef0..5a62dc0 100644
--- a/tests/auto/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
+++ b/tests/auto/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
@@ -165,7 +165,7 @@ void tst_QGraphicsPixmapItem::boundingRect_data()
QTest::addColumn<QPixmap>("pixmap");
QTest::addColumn<QRectF>("boundingRect");
QTest::newRow("null") << QPixmap() << QRectF();
- QTest::newRow("10x10") << QPixmap(10, 10) << QRectF(-0.5, -0.5, 11, 11);
+ QTest::newRow("10x10") << QPixmap(10, 10) << QRectF(0, 0, 10, 10);
}
// public QRectF boundingRect() const
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 89628d8..f07453c 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -3788,7 +3788,7 @@ void tst_QGraphicsView::task259503_scrollingArtifacts()
{
// qDebug() << event->region();
// qDebug() << updateRegion;
- QEXPECT_FAIL("", "The event region doesn't include the original item position region. See task #259503.", Continue);
+ QEXPECT_FAIL("", "The event region doesn't include the original item position region. See QTBUG-4416", Continue);
QCOMPARE(event->region(), updateRegion);
}
}
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 53b6230..8e02c74 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -1134,6 +1134,8 @@ void tst_QPixmap::fromSymbianCFbsBitmap_data()
QTest::newRow("EColor4K big") << EColor4K << largeWidth << largeHeight << QColor(Qt::red);
QTest::newRow("EColor64K small") << EColor64K << smallWidth << smallHeight << QColor(Qt::green);
QTest::newRow("EColor64K big") << EColor64K << largeWidth << largeHeight << QColor(Qt::green);
+ QTest::newRow("EColor16M small") << EColor16M << smallWidth << smallHeight << QColor(Qt::yellow);
+ QTest::newRow("EColor16M big") << EColor16M << largeWidth << largeHeight << QColor(Qt::yellow);
QTest::newRow("EColor16MU small") << EColor16MU << smallWidth << smallHeight << QColor(Qt::red);
QTest::newRow("EColor16MU big") << EColor16MU << largeWidth << largeHeight << QColor(Qt::red);
QTest::newRow("EColor16MA small opaque") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0);
diff --git a/tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp b/tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp
index 5a9bad7..a80c787 100644
--- a/tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp
+++ b/tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp
@@ -383,7 +383,7 @@ void tst_QPixmapFilter::dropShadowBoundingRectFor()
QPixmapDropShadowFilter filter;
filter.setBlurRadius(0);
- QCOMPARE(filter.blurRadius(), 0);
+ QCOMPARE(filter.blurRadius(), 0.);
const QRectF rect1(0, 0, 50, 50);
const QRectF rect2(30, 20, 10, 40);
diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp
index fdbf6a2..56a330b 100644
--- a/tests/auto/qsound/tst_qsound.cpp
+++ b/tests/auto/qsound/tst_qsound.cpp
@@ -66,7 +66,7 @@ void tst_QSound::checkFinished()
QTest::qWait(5000);
#if defined(Q_WS_QWS)
- QEXPECT_FAIL("", "QSound buggy on embedded (task 122221)", Abort);
+ QEXPECT_FAIL("", "QSound buggy on embedded (task QTBUG-157)", Abort);
#endif
QVERIFY(sound.isFinished() );
}
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 1516346..975b301 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -117,6 +117,7 @@ private slots:
void cleanup();
void rootState();
+ void machineWithParent();
void addAndRemoveState();
void stateEntryAndExit();
void assignProperty();
@@ -124,6 +125,7 @@ private slots:
void postEvent();
void cancelDelayedEvent();
void postDelayedEventAndStop();
+ void stopAndPostEvent();
void stateFinished();
void parallelStates();
void parallelRootState();
@@ -205,6 +207,7 @@ private slots:
void goToState();
void task260403_clonedSignals();
+ void postEventFromOtherThread();
};
tst_QStateMachine::tst_QStateMachine()
@@ -1043,6 +1046,14 @@ void tst_QStateMachine::rootState()
QCOMPARE(s2->parentState(), static_cast<QState*>(&machine));
}
+void tst_QStateMachine::machineWithParent()
+{
+ QObject object;
+ QStateMachine *machine = new QStateMachine(&object);
+ QCOMPARE(machine->parent(), &object);
+ QCOMPARE(machine->parentState(), (QObject*)0);
+}
+
void tst_QStateMachine::addAndRemoveState()
{
#ifdef QT_BUILD_INTERNAL
@@ -1681,6 +1692,22 @@ void tst_QStateMachine::postDelayedEventAndStop()
QVERIFY(machine.configuration().contains(s1));
}
+void tst_QStateMachine::stopAndPostEvent()
+{
+ QStateMachine machine;
+ QState *s1 = new QState(&machine);
+ machine.setInitialState(s1);
+ QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ machine.start();
+ QTRY_COMPARE(startedSpy.count(), 1);
+ QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
+ machine.stop();
+ QCOMPARE(stoppedSpy.count(), 0);
+ machine.postEvent(new QEvent(QEvent::User));
+ QTRY_COMPARE(stoppedSpy.count(), 1);
+ QCoreApplication::processEvents();
+}
+
void tst_QStateMachine::stateFinished()
{
QStateMachine machine;
@@ -4188,5 +4215,52 @@ void tst_QStateMachine::task260403_clonedSignals()
QCOMPARE(t1->eventSignalIndex, emitter.metaObject()->indexOfSignal("signalWithDefaultArg()"));
}
+class EventPosterThread : public QThread
+{
+ Q_OBJECT
+public:
+ EventPosterThread(QStateMachine *machine, QObject *parent = 0)
+ : QThread(parent), m_machine(machine), m_count(0)
+ {
+ moveToThread(this);
+ QObject::connect(m_machine, SIGNAL(started()),
+ this, SLOT(postEvent()));
+ }
+protected:
+ virtual void run()
+ {
+ exec();
+ }
+private Q_SLOTS:
+ void postEvent()
+ {
+ m_machine->postEvent(new QEvent(QEvent::User));
+ if (++m_count < 10000)
+ QTimer::singleShot(0, this, SLOT(postEvent()));
+ else
+ quit();
+ }
+private:
+ QStateMachine *m_machine;
+ int m_count;
+};
+
+void tst_QStateMachine::postEventFromOtherThread()
+{
+ QStateMachine machine;
+ EventPosterThread poster(&machine);
+ StringEventPoster *s1 = new StringEventPoster("foo", &machine);
+ s1->addTransition(new EventTransition(QEvent::User, s1));
+ QFinalState *f = new QFinalState(&machine);
+ s1->addTransition(&poster, SIGNAL(finished()), f);
+ machine.setInitialState(s1);
+
+ poster.start();
+
+ QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ machine.start();
+ QTRY_COMPARE(finishedSpy.count(), 1);
+}
+
QTEST_MAIN(tst_QStateMachine)
#include "tst_qstatemachine.moc"
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 72c13bf..c8fe4e5 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -3679,15 +3679,21 @@ void tst_QUrl::binaryData()
void tst_QUrl::fromUserInput_data()
{
+ //
+ // most of this test is:
+ // Copyright (C) Research In Motion Limited 2009. All rights reserved.
+ // Distributed under the BSD license.
+ // See qurl.cpp
+ //
+
QTest::addColumn<QString>("string");
- QTest::addColumn<QUrl>("url");
+ QTest::addColumn<QUrl>("guessUrlFromString");
// Null
QTest::newRow("null") << QString() << QUrl();
// File
QDirIterator it(QDir::homePath());
- QString fileString;
int c = 0;
while (it.hasNext()) {
it.next();
@@ -3695,49 +3701,52 @@ void tst_QUrl::fromUserInput_data()
}
// basic latin1
- QTest::newRow("unicode-0") << QString::fromUtf8("\xC3\xA5.com/") << QUrl::fromEncoded(QString::fromUtf8("http://\xC3\xA5.com/").toUtf8(), QUrl::TolerantMode);
+ QTest::newRow("unicode-0") << QString::fromUtf8("\xc3\xa5.com/") << QUrl::fromEncoded(QString::fromUtf8("http://\xc3\xa5.com/").toUtf8(), QUrl::TolerantMode);
+ QTest::newRow("unicode-0b") << QString::fromUtf8("\xc3\xa5.com/") << QUrl::fromEncoded("http://%C3%A5.com/", QUrl::TolerantMode);
+ QTest::newRow("unicode-0c") << QString::fromUtf8("\xc3\xa5.com/") << QUrl::fromEncoded("http://xn--5ca.com/", QUrl::TolerantMode);
// unicode
- QTest::newRow("unicode-1") << QString::fromUtf8("\xCE\xBB.com/") << QUrl::fromEncoded(QString::fromUtf8("http://\xCE\xBB.com/").toUtf8(), QUrl::TolerantMode);
+ QTest::newRow("unicode-1") << QString::fromUtf8("\xce\xbb.com/") << QUrl::fromEncoded(QString::fromUtf8("http://\xce\xbb.com/").toUtf8(), QUrl::TolerantMode);
+ QTest::newRow("unicode-1b") << QString::fromUtf8("\xce\xbb.com/") << QUrl::fromEncoded("http://%CE%BB.com/", QUrl::TolerantMode);
+ QTest::newRow("unicode-1c") << QString::fromUtf8("\xce\xbb.com/") << QUrl::fromEncoded("http://xn--wxa.com/", QUrl::TolerantMode);
// no scheme
- QTest::newRow("add scheme-0") << "webkit.org" << QUrl("http://webkit.org");
- QTest::newRow("add scheme-1") << "www.webkit.org" << QUrl("http://www.webkit.org");
- QTest::newRow("add scheme-2") << "ftp.webkit.org" << QUrl("ftp://ftp.webkit.org");
+ QTest::newRow("add scheme-0") << "example.org" << QUrl("http://example.org");
+ QTest::newRow("add scheme-1") << "www.example.org" << QUrl("http://www.example.org");
+ QTest::newRow("add scheme-2") << "ftp.example.org" << QUrl("ftp://ftp.example.org");
QTest::newRow("add scheme-3") << "webkit" << QUrl("webkit");
// QUrl's tolerant parser should already handle this
- QTest::newRow("not-encoded-0") << "http://webkit.org/test page.html" << QUrl("http://webkit.org/test%20page.html");
+ QTest::newRow("not-encoded-0") << "http://example.org/test page.html" << QUrl::fromEncoded("http://example.org/test%20page.html");
// Make sure the :80, i.e. port doesn't screw anything up
- QUrl portUrl("http://webkit.org");
+ QUrl portUrl("http://example.org");
portUrl.setPort(80);
- QTest::newRow("port-0") << "webkit.org:80" << portUrl;
- QTest::newRow("port-1") << "http://webkit.org:80" << portUrl;
+ QTest::newRow("port-0") << "example.org:80" << portUrl;
+ QTest::newRow("port-1") << "http://example.org:80" << portUrl;
// mailto doesn't have a ://, but is valid
- QUrl mailto("somebody@somewhere.net");
+ QUrl mailto("ben@example.net");
mailto.setScheme("mailto");
- QTest::newRow("mailto") << "mailto:somebody@somewhere.net" << mailto;
+ QTest::newRow("mailto") << "mailto:ben@example.net" << mailto;
// misc
QTest::newRow("localhost-0") << "localhost" << QUrl("http://localhost");
QTest::newRow("localhost-1") << "localhost:80" << QUrl("http://localhost:80");
- QTest::newRow("spaces-0") << " http://webkit.org/test page.html " << QUrl("http://webkit.org/test%20page.html");
- QTest::newRow("trash-0") << "webkit.org/test?someData=42%&someOtherData=abcde#anchor" << QUrl::fromEncoded("http://webkit.org/test?someData=42%25&someOtherData=abcde#anchor");
+ QTest::newRow("spaces-0") << " http://example.org/test page.html " << QUrl("http://example.org/test%20page.html");
+ QTest::newRow("trash-0") << "example.org/test?someData=42%&someOtherData=abcde#anchor" << QUrl::fromEncoded("http://example.org/test?someData=42%25&someOtherData=abcde#anchor");
// FYI: The scheme in the resulting url user
QUrl authUrl("user:pass@domain.com");
QTest::newRow("misc-1") << "user:pass@domain.com" << authUrl;
}
-// public static QUrl guessUrlFromString(QString const& string)
void tst_QUrl::fromUserInput()
{
QFETCH(QString, string);
- QFETCH(QUrl, url);
+ QFETCH(QUrl, guessUrlFromString);
- QUrl guessedUrl = QUrl::fromUserInput(string);
- QCOMPARE(guessedUrl, url);
+ QUrl url = QUrl::fromUserInput(string);
+ QCOMPARE(url, guessUrlFromString);
}
void tst_QUrl::task_199967()
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index c27de1d..3d801cc 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -2983,7 +2983,7 @@ void tst_QWidget::stackUnder()
qApp->processEvents();
#endif
#ifndef Q_WS_MAC
- QEXPECT_FAIL(0, "Task 153869", Continue);
+ QEXPECT_FAIL(0, "See QTBUG-493", Continue);
#endif
QCOMPARE(child->numPaintEvents, 0);
} else {