summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWater-Team <water@pad.test.qt.nokia.com>2011-11-24 00:00:14 (GMT)
committerWater-Team <water@pad.test.qt.nokia.com>2011-11-24 00:00:14 (GMT)
commit366a6b941eecb9d5381d9513d591bdfcf5847425 (patch)
tree0349c42faa6158c969c4dab3838014004dbd4ce1 /tests
parent3a9b8ff032b56b61b0e91213ca898793f0f31795 (diff)
parent67b3edc50ad6e574f777d9accebe0750fbe3ddf7 (diff)
downloadQt-366a6b941eecb9d5381d9513d591bdfcf5847425.zip
Qt-366a6b941eecb9d5381d9513d591bdfcf5847425.tar.gz
Qt-366a6b941eecb9d5381d9513d591bdfcf5847425.tar.bz2
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qimagereader/images/test-flag-rle.tgabin0 -> 7971 bytes
-rw-r--r--tests/auto/qimagereader/images/test-flag.tgabin0 -> 480044 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.pro1
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc2
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp51
-rw-r--r--tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.pri166
6 files changed, 131 insertions, 89 deletions
diff --git a/tests/auto/qimagereader/images/test-flag-rle.tga b/tests/auto/qimagereader/images/test-flag-rle.tga
new file mode 100644
index 0000000..c14c712
--- /dev/null
+++ b/tests/auto/qimagereader/images/test-flag-rle.tga
Binary files differ
diff --git a/tests/auto/qimagereader/images/test-flag.tga b/tests/auto/qimagereader/images/test-flag.tga
new file mode 100644
index 0000000..c6d0c89
--- /dev/null
+++ b/tests/auto/qimagereader/images/test-flag.tga
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro
index 827819d..a9bfa1d 100644
--- a/tests/auto/qimagereader/qimagereader.pro
+++ b/tests/auto/qimagereader/qimagereader.pro
@@ -10,6 +10,7 @@ RESOURCES += qimagereader.qrc
!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
+!contains(QT_CONFIG, no-tga):DEFINES += QTEST_HAVE_TGA
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 2c70652..03c03d6 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -67,5 +67,7 @@
<file>images/corrupt.svgz</file>
<file>images/qtbug13653-no_eoi.jpg</file>
<file>images/txts.png</file>
+ <file>images/test-flag.tga</file>
+ <file>images/test-flag-rle.tga</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 5d958d7..2b867c3 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -168,6 +168,10 @@ private slots:
void tiffGrayscale();
#endif
+#if defined QTEST_HAVE_TGA
+ void tgaTestImages();
+#endif
+
void autoDetectImageFormat();
void fileNameProbing();
@@ -569,6 +573,10 @@ void tst_QImageReader::imageFormat_data()
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;
+#if defined QTEST_HAVE_TGA
+ QTest::newRow("tga") << QString("test-flag.tga") << QByteArray("tga") << QImage::Format_ARGB32;
+ QTest::newRow("tga-rle") << QString("test-flag-rle.tga") << QByteArray("tga") << QImage::Format_ARGB32;
+#endif
}
void tst_QImageReader::imageFormat()
@@ -578,22 +586,31 @@ void tst_QImageReader::imageFormat()
QFETCH(QImage::Format, imageFormat);
if (QImageReader::imageFormat(prefix + fileName).isEmpty()) {
- if (QByteArray("jpeg") == format)
+ if (QByteArray("jpeg") == format) {
#ifndef QTEST_HAVE_JPEG
return;
#endif // !QTEST_HAVE_JPEG
- if (QByteArray("gif") == format)
+ }
+ if (QByteArray("gif") == format) {
#ifndef QTEST_HAVE_GIF
return;
#endif // !QTEST_HAVE_GIF
- if (QByteArray("mng") == format)
+ }
+ if (QByteArray("mng") == format) {
#ifndef QTEST_HAVE_MNG
return;
#endif // !QTEST_HAVE_MNG
- if (QByteArray("svg") == format || QByteArray("svgz") == format)
+ }
+ if (QByteArray("svg") == format || QByteArray("svgz") == format) {
#ifndef QTEST_HAVE_SVG
return;
#endif // !QTEST_HAVE_SVG
+ }
+ if (QByteArray("tga") == format) {
+#ifndef QTEST_HAVE_TGA
+ return;
+#endif // !QTEST_HAVE_TGA
+ }
QSKIP(("Qt does not support the " + format + " format.").constData(), SkipSingle);
} else {
QCOMPARE(QImageReader::imageFormat(prefix + fileName), format);
@@ -734,6 +751,11 @@ void tst_QImageReader::sizeBeforeRead()
{
QFETCH(QString, fileName);
QFETCH(QByteArray, format);
+
+ if (fileName == QLatin1String("test-flag-rle.tga")) {
+ QSKIP("Qt does not support reading RLE compressed TGA files", SkipSingle);
+ }
+
QImageReader reader(prefix + fileName);
QVERIFY(reader.canRead());
if (format == "mng") {
@@ -1711,6 +1733,27 @@ void tst_QImageReader::tiffGrayscale()
}
#endif
+#if defined QTEST_HAVE_TGA
+void tst_QImageReader::tgaTestImages()
+{
+ QImage tgaTest(prefix + "test-flag.tga");
+
+ // Test image is 400x400 of a "flag" with a blue circle in the middle
+ // and a green square top left, and red rectangle on the bottom so
+ // so we test for pixels in those areas to ensure the image is not
+ // inverted or the palette is not messed up.
+ QVERIFY(!tgaTest.isNull());
+ QCOMPARE(tgaTest.size().width(), 400);
+ QCOMPARE(tgaTest.size().height(), 400);
+ QRgb pixel = tgaTest.pixel(200,200);
+ QCOMPARE(qRgb(0, 0, 255), pixel);
+ pixel = tgaTest.pixel(0, 0);
+ QCOMPARE(qRgb(0, 255, 0), pixel);
+ pixel = tgaTest.pixel(0, 399);
+ QCOMPARE(qRgb(255, 0, 0), pixel);
+}
+#endif
+
void tst_QImageReader::dotsPerMeter_data()
{
QTest::addColumn<QString>("fileName");
diff --git a/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.pri b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.pri
index 79e6a9f..524d7c3 100644
--- a/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.pri
+++ b/tests/manual/declarative/qmlshadersplugin/qmlapplicationviewer/qmlapplicationviewer.pri
@@ -1,6 +1,9 @@
-# checksum 0xc123 version 0x10008
-# This file should not be edited.
-# Future versions of Qt Creator might offer updated versions of this file.
+# checksum 0x5b42 version 0x70012
+# This file was generated by the Qt Quick Application wizard of Qt Creator.
+# The code below adds the QmlApplicationViewer to the project and handles the
+# activation of QML debugging.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
QT += declarative
@@ -8,58 +11,21 @@ SOURCES += $$PWD/qmlapplicationviewer.cpp
HEADERS += $$PWD/qmlapplicationviewer.h
INCLUDEPATH += $$PWD
-contains(DEFINES, QMLOBSERVER) {
- DEFINES *= QMLJSDEBUGGER
+# Include JS debugger library if QMLJSDEBUGGER_PATH is set
+!isEmpty(QMLJSDEBUGGER_PATH) {
+ include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
+} else {
+ DEFINES -= QMLJSDEBUGGER
}
-defineTest(minQtVersion) {
- maj = $$1
- min = $$2
- patch = $$3
- isEqual(QT_MAJOR_VERSION, $$maj) {
- isEqual(QT_MINOR_VERSION, $$min) {
- isEqual(QT_PATCH_VERSION, $$patch) {
- return(true)
- }
- greaterThan(QT_PATCH_VERSION, $$patch) {
- return(true)
- }
- }
- greaterThan(QT_MINOR_VERSION, $$min) {
- return(true)
- }
- }
- return(false)
-}
-
-contains(DEFINES, QMLJSDEBUGGER) {
- CONFIG(debug, debug|release) {
- !minQtVersion(4, 7, 1) {
- warning()
- warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.")
- warning("This library requires Qt 4.7.1 or newer.")
- warning()
-
- error("Qt version $$QT_VERSION too old for QmlJS Debugging. Aborting.")
- }
- isEmpty(QMLJSDEBUGGER_PATH) {
- warning()
- warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.")
- warning("Please specify its location on the qmake command line, eg")
- warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger")
- warning()
-
- error("QMLJSDEBUGGER defined, but no QMLJSDEBUGGER_PATH set on command line. Aborting.")
- DEFINES -= QMLJSDEBUGGER
- } else {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
- }
- } else {
- DEFINES -= QMLJSDEBUGGER
- }
+contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) {
+ DEFINES += HARMATTAN_BOOSTER
}
-# This file should not be edited.
-# Future versions of Qt Creator might offer updated versions of this file.
+# This file was generated by an application wizard of Qt Creator.
+# The code below handles deployment to Symbian and Maemo, aswell as copying
+# of the application data to shadow build directories on desktop.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
defineTest(qtcAddDeployment) {
for(deploymentfolder, DEPLOYMENTFOLDERS) {
@@ -76,19 +42,31 @@ for(deploymentfolder, DEPLOYMENTFOLDERS) {
MAINPROFILEPWD = $$PWD
symbian {
- ICON = $${TARGET}.svg
- TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
- contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -leiksrv -lcone
- contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices
+ isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg
+ isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
} else:win32 {
- !isEqual(PWD,$$OUT_PWD) {
- copyCommand = @echo Copying application data...
- for(deploymentfolder, DEPLOYMENTFOLDERS) {
- source = $$eval($${deploymentfolder}.source)
- pathSegments = $$split(source, /)
- sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments)
- copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\)
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, /, \\)
+ sourcePathSegments = $$split(source, \\)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
+ target = $$replace(target, /, \\)
+ target ~= s,\\\\\\.?\\\\,\\,
+ !isEqual(source,$$target) {
+ !isEmpty(copyCommand):copyCommand += &&
+ isEqual(QMAKE_DIR_SEP, \\) {
+ copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
+ } else {
+ source = $$replace(source, \\\\, /)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ target = $$replace(target, \\\\, /)
+ copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
+ }
}
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
copydeploymentfolders.commands = $$copyCommand
first.depends = $(first) copydeploymentfolders
export(first.depends)
@@ -97,22 +75,37 @@ symbian {
}
} else:unix {
maemo5 {
- installPrefix = /opt/usr
+ desktopfile.files = $${TARGET}.desktop
desktopfile.path = /usr/share/applications/hildon
- } else {
- installPrefix = /usr/local
+ icon.files = $${TARGET}64.png
+ icon.path = /usr/share/icons/hicolor/64x64/apps
+ } else:!isEmpty(MEEGO_VERSION_MAJOR) {
+ desktopfile.files = $${TARGET}_harmattan.desktop
desktopfile.path = /usr/share/applications
- !isEqual(PWD,$$OUT_PWD) {
- copyCommand = @echo Copying application data...
- for(deploymentfolder, DEPLOYMENTFOLDERS) {
- macx {
- target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
- } else {
- target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
- }
- copyCommand += && $(MKDIR) $$target
- copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target
+ icon.files = $${TARGET}80.png
+ icon.path = /usr/share/icons/hicolor/80x80/apps
+ } else { # Assumed to be a Desktop Unix
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, \\\\, /)
+ macx {
+ target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
+ } else {
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
}
+ target = $$replace(target, \\\\, /)
+ sourcePathSegments = $$split(source, /)
+ targetFullPath = $$target/$$last(sourcePathSegments)
+ targetFullPath ~= s,/\\.?/,/,
+ !isEqual(source,$$targetFullPath) {
+ !isEmpty(copyCommand):copyCommand += &&
+ copyCommand += $(MKDIR) \"$$target\"
+ copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
copydeploymentfolders.commands = $$copyCommand
first.depends = $(first) copydeploymentfolders
export(first.depends)
@@ -120,26 +113,29 @@ symbian {
QMAKE_EXTRA_TARGETS += first copydeploymentfolders
}
}
+ installPrefix = /opt/$${TARGET}
for(deploymentfolder, DEPLOYMENTFOLDERS) {
item = item$${deploymentfolder}
itemfiles = $${item}.files
$$itemfiles = $$eval($${deploymentfolder}.source)
itempath = $${item}.path
- $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target)
+ $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
export($$itemfiles)
export($$itempath)
INSTALLS += $$item
}
- icon.files = $${TARGET}.png
- icon.path = /usr/share/icons/hicolor/64x64/apps
- desktopfile.files = $${TARGET}.desktop
+
+ !isEmpty(desktopfile.path) {
+ export(icon.files)
+ export(icon.path)
+ export(desktopfile.files)
+ export(desktopfile.path)
+ INSTALLS += icon desktopfile
+ }
+
target.path = $${installPrefix}/bin
- export(icon.files)
- export(icon.path)
- export(desktopfile.files)
- export(desktopfile.path)
export(target.path)
- INSTALLS += desktopfile icon target
+ INSTALLS += target
}
export (ICON)