summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-08-25 07:26:54 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-08-25 07:26:54 (GMT)
commit141c5ea5b14b1499bcfb5e2c39c917e94aa4e23f (patch)
tree6b080f34609bebf1cc049eeb1751d3b5141d5881 /tests
parent57e6192785db1617e233fc4a321da82e5e06ec81 (diff)
parent185fabb154e387dce7e331558008f7ecaeb1ed50 (diff)
downloadQt-141c5ea5b14b1499bcfb5e2c39c917e94aa4e23f.zip
Qt-141c5ea5b14b1499bcfb5e2c39c917e94aa4e23f.tar.gz
Qt-141c5ea5b14b1499bcfb5e2c39c917e94aa4e23f.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp14
-rw-r--r--tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.html1
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.qml5
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp38
5 files changed, 41 insertions, 21 deletions
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index 0f1050e..8cfb487 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -272,8 +272,8 @@ void tst_qdeclarativeimage::svg()
QVERIFY(obj != 0);
QCOMPARE(obj->pixmap().width(), 300);
QCOMPARE(obj->pixmap().height(), 300);
- QCOMPARE(obj->width(), 550.0);
- QCOMPARE(obj->height(), 500.0);
+ QCOMPARE(obj->width(), 300.0);
+ QCOMPARE(obj->height(), 300.0);
#if defined(Q_OS_LINUX)
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png"));
#elif defined(Q_OS_WIN32)
@@ -284,8 +284,8 @@ void tst_qdeclarativeimage::svg()
QCOMPARE(obj->pixmap().width(), 200);
QCOMPARE(obj->pixmap().height(), 200);
- QCOMPARE(obj->width(), 550.0);
- QCOMPARE(obj->height(), 500.0);
+ QCOMPARE(obj->width(), 200.0);
+ QCOMPARE(obj->height(), 200.0);
#if defined(Q_OS_LINUX)
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png"));
#elif defined(Q_OS_WIN32)
@@ -300,7 +300,7 @@ void tst_qdeclarativeimage::big()
// have to build a 400 MB image. That would be a bug in the JPEG loader.
QString src = QUrl::fromLocalFile(SRCDIR "/data/big.jpeg").toString();
- QString componentStr = "import Qt 4.7\nImage { source: \"" + src + "\"; sourceSize.width: 256; sourceSize.height: 256 }";
+ QString componentStr = "import Qt 4.7\nImage { source: \"" + src + "\"; width: 100; sourceSize.height: 256 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
@@ -308,8 +308,8 @@ void tst_qdeclarativeimage::big()
QVERIFY(obj != 0);
QCOMPARE(obj->pixmap().width(), 256);
QCOMPARE(obj->pixmap().height(), 256);
- QCOMPARE(obj->width(), 10240.0);
- QCOMPARE(obj->height(), 10240.0);
+ QCOMPARE(obj->width(), 100.0);
+ QCOMPARE(obj->height(), 256.0);
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/big256.png"));
delete obj;
diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
index 4a9224e..6d5a357 100644
--- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
+++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
@@ -221,8 +221,8 @@ void tst_qdeclarativeimageprovider::runTest(bool async, QDeclarativeImageProvide
TRY_WAIT(obj->status() == QDeclarativeImage::Ready);
else
QVERIFY(obj->status() == QDeclarativeImage::Ready);
- QCOMPARE(obj->width(), 100.0);
- QCOMPARE(obj->height(), 100.0);
+ QCOMPARE(obj->width(), qreal(size.width()));
+ QCOMPARE(obj->height(), qreal(size.height()));
QCOMPARE(obj->pixmap().width(), size.width());
QCOMPARE(obj->pixmap().height(), size.height());
QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch);
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.html b/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.html
new file mode 100644
index 0000000..b640733
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.html
@@ -0,0 +1 @@
+უ Σ
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.qml
index a54ef4a..85bff29 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.qml
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.qml
@@ -3,13 +3,14 @@ import Qt 4.7
QtObject {
property bool dataOK: false
+ property string fileName
property string responseText
property string responseXmlRootNodeValue
- Component.onCompleted: {
+ function startRequest() {
var x = new XMLHttpRequest;
- x.open("GET", "utf16.xml");
+ x.open("GET", fileName);
// Test to the end
x.onreadystatechange = function() {
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
index 8141fcb..ecce349 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
@@ -104,6 +104,7 @@ private slots:
void invalidMethodUsage();
void redirects();
void nonUtf8();
+ void nonUtf8_data();
// Attributes
void document();
@@ -919,26 +920,43 @@ void tst_qdeclarativexmlhttprequest::responseText_data()
void tst_qdeclarativexmlhttprequest::nonUtf8()
{
+ QFETCH(QString, fileName);
+ QFETCH(QString, responseText);
+ QFETCH(QString, xmlRootNodeValue);
+
QDeclarativeComponent component(&engine, TEST_FILE("utf16.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
+ object->setProperty("fileName", fileName);
+ QMetaObject::invokeMethod(object, "startRequest");
+
+ TRY_WAIT(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("responseText").toString(), responseText);
+
+ if (!xmlRootNodeValue.isEmpty()) {
+ QString rootNodeValue = object->property("responseXmlRootNodeValue").toString();
+ QCOMPARE(rootNodeValue, xmlRootNodeValue);
+ }
+
+ delete object;
+}
+
+void tst_qdeclarativexmlhttprequest::nonUtf8_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QString>("responseText");
+ QTest::addColumn<QString>("xmlRootNodeValue");
+
QString uc;
uc.resize(3);
uc[0] = QChar(0x10e3);
uc[1] = QChar(' ');
uc[2] = QChar(0x03a3);
- QString xml = "<?xml version=\"1.0\" encoding=\"UTF-16\" standalone='yes'?>\n<root>\n" + uc + "\n</root>\n";
- TRY_WAIT(object->property("dataOK").toBool() == true);
-
- QString responseText = object->property("responseText").toString();
- QCOMPARE(responseText, xml);
-
- QString responseXmlText = object->property("responseXmlRootNodeValue").toString();
- QCOMPARE(responseXmlText, '\n' + uc + '\n');
-
- delete object;
+ QTest::newRow("responseText") << "utf16.html" << uc + '\n' << "";
+ QTest::newRow("responseXML") << "utf16.xml" << "<?xml version=\"1.0\" encoding=\"UTF-16\" standalone='yes'?>\n<root>\n" + uc + "\n</root>\n" << QString('\n' + uc + '\n');
}
// Test that calling hte XMLHttpRequest methods on a non-XMLHttpRequest object