diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-11-23 06:16:17 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-11-23 06:16:17 (GMT) |
commit | 5e2ecb4bb92daef8eb37622484a9fdf603f8536d (patch) | |
tree | 83381978a4746ef1cb25f6a16fa34f27f1c68cd1 | |
parent | da3a7ff361104e57b032b56c49e5cc231304a086 (diff) | |
download | Qt-5e2ecb4bb92daef8eb37622484a9fdf603f8536d.zip Qt-5e2ecb4bb92daef8eb37622484a9fdf603f8536d.tar.gz Qt-5e2ecb4bb92daef8eb37622484a9fdf603f8536d.tar.bz2 |
check warnings
-rw-r--r-- | tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp index f23c7d7..bcdfa2e 100644 --- a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp +++ b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp @@ -112,12 +112,27 @@ void tst_qmlgraphicsborderimage::noSource() delete obj; } +void tst_qmlgraphicsborderimage::imageSource_data() +{ + QTest::addColumn<QString>("source"); + QTest::addColumn<bool>("remote"); + QTest::addColumn<QString>("error"); + + QTest::newRow("local") << SRCDIR "/data/colors.png" << false << ""; + QTest::newRow("local not found") << SRCDIR "/data/no-such-file.png" << false + << "Cannot open QUrl( \"file://" SRCDIR "/data/no-such-file.png\" ) "; + QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << ""; + QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true + << "Network error loading QUrl( \"" SERVER_ADDR "/no-such-file.png\" ) " + "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" "; +} + void tst_qmlgraphicsborderimage::imageSource() { QFETCH(QString, source); - QFETCH(bool, valid); + QFETCH(bool, remote); + QFETCH(QString, error); - bool remote = source.startsWith("http"); TestHTTPServer *server = 0; if (remote) { server = new TestHTTPServer(SERVER_PORT); @@ -125,6 +140,9 @@ void tst_qmlgraphicsborderimage::imageSource() server->serveDirectory(SRCDIR "/data"); } + if (!error.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); + QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); @@ -135,7 +153,7 @@ void tst_qmlgraphicsborderimage::imageSource() QCOMPARE(obj->source(), remote ? source : QUrl::fromLocalFile(source)); - if (valid) { + if (error.isEmpty()) { TRY_WAIT(obj->status() == QmlGraphicsBorderImage::Ready); QCOMPARE(obj->width(), 120.); QCOMPARE(obj->height(), 120.); @@ -168,17 +186,6 @@ void tst_qmlgraphicsborderimage::clearSource() QCOMPARE(obj->height(), 0.); } -void tst_qmlgraphicsborderimage::imageSource_data() -{ - QTest::addColumn<QString>("source"); - QTest::addColumn<bool>("valid"); - - QTest::newRow("local") << SRCDIR "/data/colors.png" << true; - QTest::newRow("local not found") << SRCDIR "/data/no-such-file.png" << false; - QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true; - QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << false; -} - void tst_qmlgraphicsborderimage::resized() { QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; @@ -290,6 +297,9 @@ void tst_qmlgraphicsborderimage::sciSource_data() void tst_qmlgraphicsborderimage::invalidSciFile() { + QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Roun" + QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Repea" + QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/invalid.sci\"; width: 300; height: 300 }"; QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); |