summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-10 12:06:56 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-10 12:06:56 (GMT)
commitef0a51654783f942499cfa9fca60d18c2fa6a702 (patch)
tree1fd8158f883562a3ef000b0a4d26df5b1f064dae /tests
parent53632d45ca64ad4c20d4302e0826c0234877dd69 (diff)
parent62725a02652cee576efe055d1371765945045026 (diff)
downloadQt-ef0a51654783f942499cfa9fca60d18c2fa6a702.zip
Qt-ef0a51654783f942499cfa9fca60d18c2fa6a702.tar.gz
Qt-ef0a51654783f942499cfa9fca60d18c2fa6a702.tar.bz2
Merge commit 'qt-mainline/master' into master-recursivepaint
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/bic/bic.pro6
-rw-r--r--tests/auto/bic/tst_bic.cpp33
-rw-r--r--tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp2
-rw-r--r--tests/auto/math3d/qquaternion/tst_qquaternion.cpp2
-rw-r--r--tests/auto/math3d/qvectornd/tst_qvectornd.cpp2
-rw-r--r--tests/auto/math3d/shared/math3dincludes.h2
-rw-r--r--tests/auto/qcssparser/tst_cssparser.cpp45
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc2
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp26
-rw-r--r--tests/auto/qimagewriter/tst_qimagewriter.cpp26
10 files changed, 123 insertions, 23 deletions
diff --git a/tests/auto/bic/bic.pro b/tests/auto/bic/bic.pro
index a168d77..82711c9 100644
--- a/tests/auto/bic/bic.pro
+++ b/tests/auto/bic/bic.pro
@@ -2,3 +2,9 @@ load(qttest_p4)
SOURCES += tst_bic.cpp qbic.cpp
QT = core
+wince*:{
+ DEFINES += SRCDIR=\\\"\\\"
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
+
diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp
index 181c275..8bc8d4f 100644
--- a/tests/auto/bic/tst_bic.cpp
+++ b/tests/auto/bic/tst_bic.cpp
@@ -165,30 +165,30 @@ void tst_Bic::sizesAndVTables_data()
#if defined Q_OS_LINUX && defined Q_WS_X11
# if defined(__powerpc__) && !defined(__powerpc64__)
- archFileName400 = "data/%1.4.0.0.linux-gcc-ppc32.txt";
- archFileName410 = "data/%1.4.1.0.linux-gcc-ppc32.txt";
- archFileName420 = "data/%1.4.2.0.linux-gcc-ppc32.txt";
+ archFileName400 = SRCDIR "data/%1.4.0.0.linux-gcc-ppc32.txt";
+ archFileName410 = SRCDIR "data/%1.4.1.0.linux-gcc-ppc32.txt";
+ archFileName420 = SRCDIR "data/%1.4.2.0.linux-gcc-ppc32.txt";
# elif defined(__amd64__)
- archFileName400 = "data/%1.4.0.0.linux-gcc-amd64.txt";
+ archFileName400 = SRCDIR "data/%1.4.0.0.linux-gcc-amd64.txt";
# elif defined(__i386__)
- archFileName400 = "data/%1.4.0.0.linux-gcc-ia32.txt";
- archFileName410 = "data/%1.4.1.0.linux-gcc-ia32.txt";
- archFileName420 = "data/%1.4.2.0.linux-gcc-ia32.txt";
- archFileName430 = "data/%1.4.3.0.linux-gcc-ia32.txt";
+ archFileName400 = SRCDIR "data/%1.4.0.0.linux-gcc-ia32.txt";
+ archFileName410 = SRCDIR "data/%1.4.1.0.linux-gcc-ia32.txt";
+ archFileName420 = SRCDIR "data/%1.4.2.0.linux-gcc-ia32.txt";
+ archFileName430 = SRCDIR "data/%1.4.3.0.linux-gcc-ia32.txt";
# endif
#elif defined Q_OS_AIX
if (sizeof(void*) == 4)
- archFileName400 = "data/%1.4.0.0.aix-gcc-power32.txt";
+ archFileName400 = SRCDIR "data/%1.4.0.0.aix-gcc-power32.txt";
#elif defined Q_OS_MAC && defined(__powerpc__)
- archFileName400 = "data/%1.4.0.0.macx-gcc-ppc32.txt";
- archFileName410 = "data/%1.4.1.0.macx-gcc-ppc32.txt";
- archFileName420 = "data/%1.4.2.0.macx-gcc-ppc32.txt";
+ archFileName400 = SRCDIR "data/%1.4.0.0.macx-gcc-ppc32.txt";
+ archFileName410 = SRCDIR "data/%1.4.1.0.macx-gcc-ppc32.txt";
+ archFileName420 = SRCDIR "data/%1.4.2.0.macx-gcc-ppc32.txt";
#elif defined Q_OS_MAC && defined(__i386__)
- archFileName410 = "data/%1.4.1.0.macx-gcc-ia32.txt";
- archFileName420 = "data/%1.4.2.0.macx-gcc-ia32.txt";
+ archFileName410 = SRCDIR "data/%1.4.1.0.macx-gcc-ia32.txt";
+ archFileName420 = SRCDIR "data/%1.4.2.0.macx-gcc-ia32.txt";
#elif defined Q_OS_WIN && defined Q_CC_GNU
- archFileName410 = "data/%1.4.1.0.win32-gcc-ia32.txt";
- archFileName420 = "data/%1.4.2.0.win32-gcc-ia32.txt";
+ archFileName410 = SRCDIR "data/%1.4.1.0.win32-gcc-ia32.txt";
+ archFileName420 = SRCDIR "data/%1.4.2.0.win32-gcc-ia32.txt";
#endif
if (archFileName400.isEmpty() && archFileName410.isEmpty()
@@ -293,6 +293,7 @@ void tst_Bic::sizesAndVTables()
bool isFailed = false;
+ qDebug() << oldLib.arg(libName);
if (oldLib.isEmpty() || !QFile::exists(oldLib.arg(libName)))
QSKIP("No platform spec found for this platform/version.", SkipSingle);
diff --git a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
index 4d51e89..dd3e396 100644
--- a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
diff --git a/tests/auto/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
index f25f858..5d70e4d 100644
--- a/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
+++ b/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
diff --git a/tests/auto/math3d/qvectornd/tst_qvectornd.cpp b/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
index a092fb0..f7d2411 100644
--- a/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
+++ b/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
diff --git a/tests/auto/math3d/shared/math3dincludes.h b/tests/auto/math3d/shared/math3dincludes.h
index 1ac0c08..a77090b 100644
--- a/tests/auto/math3d/shared/math3dincludes.h
+++ b/tests/auto/math3d/shared/math3dincludes.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
diff --git a/tests/auto/qcssparser/tst_cssparser.cpp b/tests/auto/qcssparser/tst_cssparser.cpp
index b41a745..27258b7 100644
--- a/tests/auto/qcssparser/tst_cssparser.cpp
+++ b/tests/auto/qcssparser/tst_cssparser.cpp
@@ -114,11 +114,52 @@ void tst_CssParser::scanner_data()
}
}
+
+static char *tokenName(QCss::TokenType t)
+{
+ switch (t) {
+ case QCss::NONE: return "NONE";
+ case QCss::S: return "S";
+ case QCss::CDO: return "CDO";
+ case QCss::CDC: return "CDC";
+ case QCss::INCLUDES: return "INCLUDES";
+ case QCss::DASHMATCH: return "DASHMATCH";
+ case QCss::LBRACE: return "LBRACE";
+ case QCss::PLUS: return "PLUS";
+ case QCss::GREATER: return "GREATER";
+ case QCss::COMMA: return "COMMA";
+ case QCss::STRING: return "STRING";
+ case QCss::INVALID: return "INVALID";
+ case QCss::IDENT: return "IDENT";
+ case QCss::HASH: return "HASH";
+ case QCss::ATKEYWORD_SYM: return "ATKEYWORD_SYM";
+ case QCss::EXCLAMATION_SYM: return "EXCLAMATION_SYM";
+ case QCss::LENGTH: return "LENGTH";
+ case QCss::PERCENTAGE: return "PERCENTAGE";
+ case QCss::NUMBER: return "NUMBER";
+ case QCss::FUNCTION: return "FUNCTION";
+ case QCss::COLON: return "COLON";
+ case QCss::SEMICOLON: return "SEMICOLON";
+ case QCss::RBRACE: return "RBRACE";
+ case QCss::SLASH: return "SLASH";
+ case QCss::MINUS: return "MINUS";
+ case QCss::DOT: return "DOT";
+ case QCss::STAR: return "STAR";
+ case QCss::LBRACKET: return "LBRACKET";
+ case QCss::RBRACKET: return "RBRACKET";
+ case QCss::EQUAL: return "EQUAL";
+ case QCss::LPAREN: return "LPAREN";
+ case QCss::RPAREN: return "RPAREN";
+ case QCss::OR: return "OR";
+ }
+ return "";
+}
+
static void debug(const QVector<QCss::Symbol> &symbols, int index = -1)
{
qDebug() << "all symbols:";
for (int i = 0; i < symbols.count(); ++i)
- qDebug() << "(" << i << "); Token:" << QCss::Scanner::tokenName(symbols.at(i).token) << "; Lexem:" << symbols.at(i).lexem();
+ qDebug() << "(" << i << "); Token:" << tokenName(symbols.at(i).token) << "; Lexem:" << symbols.at(i).lexem();
if (index != -1)
qDebug() << "failure at index" << index;
}
@@ -160,7 +201,7 @@ void tst_CssParser::scanner()
QCOMPARE(l.count(), 2);
const QString expectedToken = l.at(0);
const QString expectedLexem = l.at(1);
- QString actualToken = QString::fromLatin1(QCss::Scanner::tokenName(symbols.at(i).token));
+ QString actualToken = QString::fromLatin1(tokenName(symbols.at(i).token));
if (actualToken != expectedToken) {
debug(symbols, i);
QCOMPARE(actualToken, expectedToken);
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index 3c674ad..c6b963b 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -30,7 +30,7 @@
<file>images/image.pgm</file>
<file>images/image.png</file>
<file>images/image.ppm</file>
- <file>images/image.tif</file>
+ <file>images/image_100dpi.tif</file>
<file>images/kollada.png</file>
<file>images/marble.xpm</file>
<file>images/namedcolors.xpm</file>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index f5313eb..0b32f0a 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -156,6 +156,9 @@ private slots:
void pixelCompareWithBaseline_data();
void pixelCompareWithBaseline();
+
+ void task255627_setNullScaledSize_data();
+ void task255627_setNullScaledSize();
};
static const QLatin1String prefix(SRCDIR "/images/");
@@ -333,6 +336,29 @@ void tst_QImageReader::setScaledSize()
QCOMPARE(image.size(), newSize);
}
+void tst_QImageReader::task255627_setNullScaledSize_data()
+{
+ setScaledSize_data();
+}
+
+void tst_QImageReader::task255627_setNullScaledSize()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QByteArray, format);
+
+ if (!format.isEmpty() && !QImageReader::supportedImageFormats().contains(format))
+ QSKIP("Qt does not support reading the \"" + format + "\" format", SkipSingle);
+
+ QImageReader reader(prefix + fileName);
+
+ // set a null size
+ reader.setScaledSize(QSize(0, 0));
+ reader.setQuality(0);
+ QImage image = reader.read();
+ QVERIFY(image.isNull());
+ QCOMPARE(image.size(), QSize(0, 0));
+}
+
void tst_QImageReader::setClipRect_data()
{
QTest::addColumn<QString>("fileName");
diff --git a/tests/auto/qimagewriter/tst_qimagewriter.cpp b/tests/auto/qimagewriter/tst_qimagewriter.cpp
index 349afa5..3ceb2c2 100644
--- a/tests/auto/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/qimagewriter/tst_qimagewriter.cpp
@@ -59,6 +59,7 @@ Q_DECLARE_METATYPE(QStringMap)
Q_DECLARE_METATYPE(QIntList)
Q_DECLARE_METATYPE(QImageWriter::ImageWriterError)
Q_DECLARE_METATYPE(QIODevice *)
+Q_DECLARE_METATYPE(QImage::Format)
//TESTED_FILES=
@@ -82,6 +83,9 @@ private slots:
void writeImage2();
void supportedFormats();
+ void readWriteNonDestructive_data();
+ void readWriteNonDestructive();
+
#if defined QTEST_HAVE_TIFF
void largeTiff();
#endif
@@ -376,6 +380,28 @@ void tst_QImageWriter::supportedFormats()
QCOMPARE(formatSet.size(), formats.size());
}
+void tst_QImageWriter::readWriteNonDestructive_data()
+{
+ QTest::addColumn<QImage::Format>("format");
+ QTest::addColumn<QImage::Format>("expectedFormat");
+ QTest::newRow("tiff mono") << QImage::Format_Mono << QImage::Format_Mono;
+ QTest::newRow("tiff indexed") << QImage::Format_Indexed8 << QImage::Format_Indexed8;
+ QTest::newRow("tiff rgb32") << QImage::Format_ARGB32 << QImage::Format_ARGB32;
+}
+
+void tst_QImageWriter::readWriteNonDestructive()
+{
+ QFETCH(QImage::Format, format);
+ QFETCH(QImage::Format, expectedFormat);
+ QImage image = QImage(prefix + "colorful.bmp").convertToFormat(format);
+ QVERIFY(image.save(prefix + "gen-readWriteNonDestructive.tiff"));
+
+ QImage image2 = QImage(prefix + "gen-readWriteNonDestructive.tiff");
+ QImage::Format readFormat = image2.format();
+ QCOMPARE(readFormat, expectedFormat);
+ QCOMPARE(image, image2);
+}
+
void tst_QImageWriter::setDescription_data()
{
QTest::addColumn<QString>("fileName");