diff options
author | Shane Kearns <shane.kearns@sosco.com> | 2009-08-18 08:32:04 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@sosco.com> | 2009-08-18 08:32:04 (GMT) |
commit | 06524f769fec76fa7ebcc39ac88ac9e08c720677 (patch) | |
tree | a14448b17d6a8e1104d8471bee0948de4572df84 /tests | |
parent | 1428cc6d71a65c1ac7123c9c4cc3cfaf225cceed (diff) | |
parent | ff96a87389d69a537a91d364b299aae09c2129a6 (diff) | |
download | Qt-06524f769fec76fa7ebcc39ac88ac9e08c720677.zip Qt-06524f769fec76fa7ebcc39ac88ac9e08c720677.tar.gz Qt-06524f769fec76fa7ebcc39ac88ac9e08c720677.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'tests')
63 files changed, 669 insertions, 714 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 8adf1b3..cc9f1b9 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -12,8 +12,6 @@ SUBDIRS += \ compilerwarnings \ exceptionsafety \ linguist \ - macgui \ - macplist \ mediaobject \ # mediaobject_wince_ds9 \ This is Windows CE only (we test the second phonon backend ds9 here) moc \ @@ -75,7 +73,6 @@ SUBDIRS += \ qabstractspinbox \ qabstracttextdocumentlayout \ qaccessibility \ - qaccessibility_mac \ qaction \ qactiongroup \ qalgorithms \ @@ -98,7 +95,6 @@ SUBDIRS += \ qcombobox \ qcompleter \ qcomplextext \ - qcopchannel \ qcoreapplication \ qcryptographichash \ qcssparser \ @@ -114,7 +110,6 @@ SUBDIRS += \ qdialog \ qdialogbuttonbox \ qdir \ - qdirectpainter \ qdirmodel \ qdockwidget \ qdom \ @@ -209,7 +204,6 @@ SUBDIRS += \ qmouseevent \ qmouseevent_modal \ qmovie \ - qmultiscreen \ qmutex \ qmutexlocker \ qnativesocketengine \ @@ -317,6 +311,7 @@ SUBDIRS += \ qstatusbar \ qstl \ qstring \ + qstringbuilder \ qstringmatcher \ qstringlist \ qstringlistmodel \ @@ -349,7 +344,6 @@ SUBDIRS += \ qtextlayout \ qtextlist \ qtextobject \ - qtextpiecetable \ qtextscriptengine \ qtextstream \ qtexttable \ @@ -404,6 +398,19 @@ SUBDIRS += \ utf8 contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter +mac: { + SUBDIRS += macgui \ + macplist \ + qaccessibility_mac +} +embedded: { + SUBDIRS += qcopchannel \ + qdirectpainter \ + qmultiscreen +} +!win32: { + SUBDIRS += qtextpiecetable +} # Enable the tests specific to QtXmlPatterns. If you add a test, remember to # update runQtXmlPatternsTests.sh too. Remember that this file, auto.pro, is @@ -445,6 +452,7 @@ SUBDIRS += checkxmlfiles \ xmlpatternsdiagnosticsts.depends = xmlpatternsxqts xmlpatternsview.depends = xmlpatternsxqts xmlpatternsxslts.depends = xmlpatternsxqts +xmlpatternsschemats.depends = xmlpatternsxqts } unix:!embedded:contains(QT_CONFIG, dbus):SUBDIRS += \ diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp index 51e3a55..f5a11f4 100644 --- a/tests/auto/headers/tst_headers.cpp +++ b/tests/auto/headers/tst_headers.cpp @@ -50,7 +50,7 @@ public: private slots: void initTestCase(); - void licenseCheck_data() { allHeadersData(); } + void licenseCheck_data() { allSourceFilesData(); } void licenseCheck(); void privateSlots_data() { allHeadersData(); } @@ -60,11 +60,19 @@ private slots: void macros(); private: + static QStringList getFiles(const QString &path, + const QStringList dirFilters, + const QRegExp &exclude); + static QStringList getHeaders(const QString &path); + static QStringList getSourceFiles(const QString &path); + + void allSourceFilesData(); void allHeadersData(); QStringList headers; const QRegExp copyrightPattern; const QRegExp licensePattern; const QRegExp moduleTest; + QString qtSrcDir; }; tst_Headers::tst_Headers() : @@ -74,29 +82,41 @@ tst_Headers::tst_Headers() : { } -QStringList getHeaders(const QString &path) +QStringList tst_Headers::getFiles(const QString &path, + const QStringList dirFilters, + const QRegExp &excludeReg) { - QStringList headers; - - QDir dir(path); - QStringList dirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + const QDir dir(path); + const QStringList dirs(dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)); + QStringList result; foreach (QString subdir, dirs) - headers += getHeaders(path + "/" + subdir); + result += getFiles(path + "/" + subdir, dirFilters, excludeReg); - QStringList entries = dir.entryList(QStringList("*.h"), QDir::Files); - QRegExp reg("^(?!ui_)"); - entries = entries.filter(reg); + QStringList entries = dir.entryList(dirFilters, QDir::Files); + entries = entries.filter(excludeReg); foreach (QString entry, entries) - headers += path + "/" + entry; + result += path + "/" + entry; - return headers; + return result; +} + +QStringList tst_Headers::getHeaders(const QString &path) +{ + return getFiles(path, QStringList("*.h"), QRegExp("^(?!ui_)")); +} + +QStringList tst_Headers::getSourceFiles(const QString &path) +{ + return getFiles(path, QStringList("*.cpp"), QRegExp("^(?!(moc_|qrc_))")); } void tst_Headers::initTestCase() { - QString qtSrcDir = QString::fromLocal8Bit(qgetenv("QTSRCDIR").isEmpty() - ? qgetenv("QTDIR") : qgetenv("QTSRCDIR")); + qtSrcDir = QString::fromLocal8Bit(qgetenv("QTSRCDIR").isEmpty() + ? qgetenv("QTDIR") + : qgetenv("QTSRCDIR")); + headers = getHeaders(qtSrcDir + "/src"); #ifndef Q_OS_WINCE @@ -108,6 +128,30 @@ void tst_Headers::initTestCase() QVERIFY(licensePattern.isValid()); } +void tst_Headers::allSourceFilesData() +{ + QTest::addColumn<QString>("sourceFile"); + + const QStringList sourceFiles(getSourceFiles(qtSrcDir)); + + foreach (QString sourceFile, sourceFiles) { + if (sourceFile.contains("/3rdparty/") + || sourceFile.contains("/config.tests/") + || sourceFile.contains("/snippets/") + || sourceFile.contains("linguist/lupdate/testdata") + || sourceFile.contains("/fulltextsearch/")) + continue; + + // This test is crude, but if a file contains this string, we skip it. + QFile file(sourceFile); + QVERIFY(file.open(QIODevice::ReadOnly)); + if (file.readAll().contains("This file was generated by")) + continue; + + QTest::newRow(qPrintable(sourceFile)) << sourceFile; + } +} + void tst_Headers::allHeadersData() { QTest::addColumn<QString>("header"); @@ -125,12 +169,14 @@ void tst_Headers::allHeadersData() void tst_Headers::licenseCheck() { - QFETCH(QString, header); + QFETCH(QString, sourceFile); - if (header.endsWith("/qgifhandler.h") || header.endsWith("/qconfig.h")) + if (sourceFile.endsWith("/qgifhandler.h") + || sourceFile.endsWith("/qconfig.h") + || sourceFile.endsWith("/qconfig.cpp")) return; - QFile f(header); + QFile f(sourceFile); QVERIFY(f.open(QIODevice::ReadOnly)); QByteArray data = f.readAll(); QStringList content = QString::fromLocal8Bit(data.replace('\r',"")).split("\n"); @@ -138,8 +184,8 @@ void tst_Headers::licenseCheck() if (content.first().contains("generated")) content.takeFirst(); - QVERIFY(licensePattern.exactMatch(content.at(7)) || - licensePattern.exactMatch(content.at(4))); + QVERIFY(licensePattern.exactMatch(content.value(7)) || + licensePattern.exactMatch(content.value(4))); QString licenseType = licensePattern.cap(1); int i = 0; diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp index 7958055..7215ebe 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp @@ -1,44 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - #include "finddialog.h" #include "mainwindow.h" #include "tabbedbrowser.h" @@ -51,83 +10,18 @@ #include <QDateTime> #include <QGridLayout> -CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent) - : QStandardItemModel(rows, columns, parent) -{} -QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value, - int hits, Qt::MatchFlags flags) const -{ - if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) - flags |= Qt::MatchCaseSensitive; - - return QStandardItemModel::match(start, role, value, hits, flags); -} - FindDialog::FindDialog(MainWindow *parent) : QDialog(parent) { - contentsWidget = new QWidget(this); - ui.setupUi(contentsWidget); - ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind)); - - QVBoxLayout *l = new QVBoxLayout(this); - l->setMargin(0); - l->setSpacing(0); - l->addWidget(contentsWidget); - - lastBrowser = 0; - onceFound = false; - findExpr.clear(); - sb = new QStatusBar(this); l->addWidget(sb); sb->showMessage(tr("Enter the text you want to find.")); - connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked())); - connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject())); -} - -FindDialog::~FindDialog() -{ -} - -void FindDialog::findButtonClicked() -{ - doFind(ui.radioForward->isChecked()); } void FindDialog::doFind(bool forward) { - QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser()); - sb->clearMessage(); - - if (ui.comboFind->currentText() != findExpr || lastBrowser != browser) - onceFound = false; - findExpr = ui.comboFind->currentText(); - - QTextDocument::FindFlags flags = 0; - - if (ui.checkCase->isChecked()) - flags |= QTextDocument::FindCaseSensitively; - - if (ui.checkWords->isChecked()) - flags |= QTextDocument::FindWholeWords; - - QTextCursor c = browser->textCursor(); - if (!c.hasSelection()) { - if (forward) - c.movePosition(QTextCursor::Start); - else - c.movePosition(QTextCursor::End); - - browser->setTextCursor(c); - } - - QTextDocument::FindFlags options; - if (forward == false) - flags |= QTextDocument::FindBackward; - QTextCursor found = browser->document()->find(findExpr, c, flags); if (found.isNull()) { if (onceFound) { @@ -141,8 +35,6 @@ void FindDialog::doFind(bool forward) } else { browser->setTextCursor(found); } - onceFound |= !found.isNull(); - lastBrowser = browser; } bool FindDialog::hasFindExpression() const diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result index 21d1ca0..de2c45a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result @@ -4,22 +4,22 @@ <context> <name>FindDialog</name> <message> - <location filename="finddialog.cpp" line="57"/> + <location filename="finddialog.cpp" line="19"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="107"/> + <location filename="finddialog.cpp" line="29"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="109"/> + <location filename="finddialog.cpp" line="31"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="111"/> + <location filename="finddialog.cpp" line="33"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp index 045fab1..756c9a3 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp @@ -1,44 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - #include "finddialog.h" #include "mainwindow.h" #include "tabbedbrowser.h" @@ -51,86 +10,17 @@ #include <QDateTime> #include <QGridLayout> -CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent) - : QStandardItemModel(rows, columns, parent) -{} -QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value, - int hits, Qt::MatchFlags flags) const -{ - if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) - flags |= Qt::MatchCaseSensitive; - - return QStandardItemModel::match(start, role, value, hits, flags); -} - FindDialog::FindDialog(MainWindow *parent) : QDialog(parent) { - contentsWidget = new QWidget(this); - ui.setupUi(contentsWidget); - ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind)); - - QVBoxLayout *l = new QVBoxLayout(this); - l->setMargin(0); - l->setSpacing(0); - l->addWidget(contentsWidget); - - lastBrowser = 0; - onceFound = false; - findExpr.clear(); - - sb = new QStatusBar(this); - l->addWidget(sb); - - // Move it to another line and change the text, // then lupdate should add this one as a new one, and mark the old one as obsolete. sb->showMessage(tr("Enter the text you want to find.")); - connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked())); - connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject())); -} - -FindDialog::~FindDialog() -{ -} - -void FindDialog::findButtonClicked() -{ - doFind(ui.radioForward->isChecked()); } void FindDialog::doFind(bool forward) { - QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser()); - sb->clearMessage(); - - if (ui.comboFind->currentText() != findExpr || lastBrowser != browser) - onceFound = false; - findExpr = ui.comboFind->currentText(); - - QTextDocument::FindFlags flags = 0; - - if (ui.checkCase->isChecked()) - flags |= QTextDocument::FindCaseSensitively; - - if (ui.checkWords->isChecked()) - flags |= QTextDocument::FindWholeWords; - - QTextCursor c = browser->textCursor(); - if (!c.hasSelection()) { - if (forward) - c.movePosition(QTextCursor::Start); - else - c.movePosition(QTextCursor::End); - - browser->setTextCursor(c); - } - - QTextDocument::FindFlags options; - if (forward == false) - flags |= QTextDocument::FindBackward; - QTextCursor found = browser->document()->find(findExpr, c, flags); if (found.isNull()) { if (onceFound) { @@ -144,31 +34,4 @@ void FindDialog::doFind(bool forward) } else { browser->setTextCursor(found); } - onceFound |= !found.isNull(); - lastBrowser = browser; -} - -bool FindDialog::hasFindExpression() const -{ - return !findExpr.isEmpty(); -} - -void FindDialog::statusMessage(const QString &message) -{ - if (isVisible()) - sb->showMessage(message); - else - static_cast<MainWindow*>(parent())->statusBar()->showMessage(message, 2000); -} - -MainWindow *FindDialog::mainWindow() const -{ - return static_cast<MainWindow*>(parentWidget()); -} - -void FindDialog::reset() -{ - ui.comboFind->setFocus(); - ui.comboFind->lineEdit()->setSelection( - 0, ui.comboFind->lineEdit()->text().length()); } diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result index b7074fe..4012182 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result @@ -8,22 +8,22 @@ <translation type="obsolete">Skriv inn teksten du soker etter</translation> </message> <message> - <location filename="finddialog.cpp" line="60"/> + <location filename="finddialog.cpp" line="18"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="110"/> + <location filename="finddialog.cpp" line="28"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="112"/> + <location filename="finddialog.cpp" line="30"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="114"/> + <location filename="finddialog.cpp" line="32"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before index 076520a..1ad6ec8 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before @@ -3,18 +3,18 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="27"/> + <location filename="project.ui" line="15"/> <source>Qt Assistant - Find text</source> <!--should be changed to unfinished, since we are changing the sourcetext in the UI file--> <translation>Qt Assistant - Finn tekst</translation> </message> <message> - <location filename="project.ui" line="30"/> + <location filename="project.ui" line="18"/> <source>300px</source> <translation>300px</translation> </message> <message> - <location filename="project.ui" line="33"/> + <location filename="project.ui" line="21"/> <source>400px</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result index b21f583..4c5f74d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result @@ -4,18 +4,18 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="27"/> + <location filename="project.ui" line="15"/> <source>Qt Assistant - Find Text</source> <oldsource>Qt Assistant - Find text</oldsource> <translation type="unfinished">Qt Assistant - Finn tekst</translation> </message> <message> - <location filename="project.ui" line="30"/> + <location filename="project.ui" line="18"/> <source>300px</source> <translation>300px</translation> </message> <message> - <location filename="project.ui" line="33"/> + <location filename="project.ui" line="21"/> <source>401 pixels</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui index 2a0bb70..d332eeb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui @@ -1,45 +1,5 @@ <ui version="4.0" > <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -*********************************************************************</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > 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 97d3bce..8c48245 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -79,27 +79,27 @@ backslashed \ stuff.</source> <context> <name>FindDialog</name> <message> - <location filename="finddialog.cpp" line="57"/> + <location filename="finddialog.cpp" line="85"/> <source>Enter the text you are looking for.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="107"/> + <location filename="finddialog.cpp" line="135"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="109"/> + <location filename="finddialog.cpp" line="137"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="111"/> + <location filename="finddialog.cpp" line="139"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="147"/> + <location filename="finddialog.cpp" line="175"/> <source>null comment</source> <translation type="unfinished"></translation> </message> @@ -107,7 +107,7 @@ backslashed \ stuff.</source> <context> <name>Kåntekst</name> <message utf8="true"> - <location filename="finddialog.cpp" line="152"/> + <location filename="finddialog.cpp" line="180"/> <source>encoding, using QApplication</source> <translation type="unfinished"></translation> </message> @@ -151,28 +151,28 @@ backslashed \ stuff.</source> <context> <name>QCoreApplication</name> <message> - <location filename="finddialog.cpp" line="144"/> + <location filename="finddialog.cpp" line="172"/> <source>with comment</source> <comment>comment</comment> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="145"/> + <location filename="finddialog.cpp" line="173"/> <source>empty comment</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="146"/> + <location filename="finddialog.cpp" line="174"/> <source>null comment</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="149"/> + <location filename="finddialog.cpp" line="177"/> <source>encoding, using QCoreApplication</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="150"/> + <location filename="finddialog.cpp" line="178"/> <source>encoding, using QApplication</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result index ddf58c3..7f665f4 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result @@ -4,12 +4,12 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="27"/> + <location filename="project.ui" line="15"/> <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> <message utf8="true"> - <location filename="project.ui" line="30"/> + <location filename="project.ui" line="18"/> <source>Finn tekst - Der Bjørn möchte auch mal.</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui index 9beb8d5..65a00c7 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui @@ -1,45 +1,5 @@ <ui version="4.0" > <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -*********************************************************************</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result index e132342..f6415bf 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result @@ -4,22 +4,22 @@ <context> <name>FindDialog</name> <message> - <location filename="sub/finddialog.cpp" line="57"/> + <location filename="sub/finddialog.cpp" line="16"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="107"/> + <location filename="sub/finddialog.cpp" line="25"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="109"/> + <location filename="sub/finddialog.cpp" line="27"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="111"/> + <location filename="sub/finddialog.cpp" line="29"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result index 6646014..581e4b6 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result @@ -4,32 +4,32 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="27"/> + <location filename="project.ui" line="15"/> <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> <message> - <location filename="project.ui" line="30"/> + <location filename="project.ui" line="18"/> <source>Finn tekst</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="57"/> + <location filename="sub/finddialog.cpp" line="16"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="107"/> + <location filename="sub/finddialog.cpp" line="25"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="109"/> + <location filename="sub/finddialog.cpp" line="27"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="111"/> + <location filename="sub/finddialog.cpp" line="29"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui index 97553db..8dea10b 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui @@ -1,45 +1,5 @@ <ui version="4.0" > <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -*********************************************************************</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp index 3800ee7..3875473 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp @@ -1,44 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the autotests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - #include "finddialog.h" #include "mainwindow.h" #include "tabbedbrowser.h" @@ -51,83 +10,14 @@ #include <QDateTime> #include <QGridLayout> -CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent) - : QStandardItemModel(rows, columns, parent) -{} -QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value, - int hits, Qt::MatchFlags flags) const -{ - if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) - flags |= Qt::MatchCaseSensitive; - - return QStandardItemModel::match(start, role, value, hits, flags); -} - FindDialog::FindDialog(MainWindow *parent) : QDialog(parent) { - contentsWidget = new QWidget(this); - ui.setupUi(contentsWidget); - ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind)); - - QVBoxLayout *l = new QVBoxLayout(this); - l->setMargin(0); - l->setSpacing(0); - l->addWidget(contentsWidget); - - lastBrowser = 0; - onceFound = false; - findExpr.clear(); - - sb = new QStatusBar(this); - l->addWidget(sb); - sb->showMessage(tr("Enter the text you want to find.")); - - connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked())); - connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject())); -} - -FindDialog::~FindDialog() -{ -} - -void FindDialog::findButtonClicked() -{ - doFind(ui.radioForward->isChecked()); } void FindDialog::doFind(bool forward) { - QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser()); - sb->clearMessage(); - - if (ui.comboFind->currentText() != findExpr || lastBrowser != browser) - onceFound = false; - findExpr = ui.comboFind->currentText(); - - QTextDocument::FindFlags flags = 0; - - if (ui.checkCase->isChecked()) - flags |= QTextDocument::FindCaseSensitively; - - if (ui.checkWords->isChecked()) - flags |= QTextDocument::FindWholeWords; - - QTextCursor c = browser->textCursor(); - if (!c.hasSelection()) { - if (forward) - c.movePosition(QTextCursor::Start); - else - c.movePosition(QTextCursor::End); - - browser->setTextCursor(c); - } - - QTextDocument::FindFlags options; - if (forward == false) - flags |= QTextDocument::FindBackward; - QTextCursor found = browser->document()->find(findExpr, c, flags); if (found.isNull()) { if (onceFound) { @@ -138,34 +28,5 @@ void FindDialog::doFind(bool forward) } else { statusMessage(tr( "Text not found" )); } - } else { - browser->setTextCursor(found); } - onceFound |= !found.isNull(); - lastBrowser = browser; -} - -bool FindDialog::hasFindExpression() const -{ - return !findExpr.isEmpty(); -} - -void FindDialog::statusMessage(const QString &message) -{ - if (isVisible()) - sb->showMessage(message); - else - static_cast<MainWindow*>(parent())->statusBar()->showMessage(message, 2000); -} - -MainWindow *FindDialog::mainWindow() const -{ - return static_cast<MainWindow*>(parentWidget()); -} - -void FindDialog::reset() -{ - ui.comboFind->setFocus(); - ui.comboFind->lineEdit()->setSelection( - 0, ui.comboFind->lineEdit()->text().length()); } diff --git a/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp b/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp index 8f8d6a6..f87500c 100644 --- a/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp +++ b/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp @@ -56,41 +56,61 @@ public: tst_QAudioDeviceId(QObject* parent=0) : QObject(parent) {} private slots: + void initTestCase(); void checkNull(); void checkEquality(); + +private: + bool available; }; -void tst_QAudioDeviceId::checkNull() +void tst_QAudioDeviceId::initTestCase() { - // Default constructed is null. - QAudioDeviceId deviceId0; - QVERIFY(deviceId0.isNull()); + // Only perform tests if audio output device exists! + QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); + if(devices.size() > 0) + available = true; + else { + qWarning()<<"NOTE: no audio output device found, no test will be performed"; + available = false; + } +} - // Null is transferred - QAudioDeviceId deviceId1(deviceId0); - QVERIFY(deviceId1.isNull()); +void tst_QAudioDeviceId::checkNull() +{ + if(available) { + // Default constructed is null. + QAudioDeviceId deviceId0; + QVERIFY(deviceId0.isNull()); + + // Null is transferred + QAudioDeviceId deviceId1(deviceId0); + QVERIFY(deviceId1.isNull()); + } } void tst_QAudioDeviceId::checkEquality() { - QAudioDeviceId deviceId0; - QAudioDeviceId deviceId1; + if(available) { + QAudioDeviceId deviceId0; + QAudioDeviceId deviceId1; - // Null ids are equivalent - QVERIFY(deviceId0 == deviceId1); - QVERIFY(!(deviceId0 != deviceId1)); + // Null ids are equivalent + QVERIFY(deviceId0 == deviceId1); + QVERIFY(!(deviceId0 != deviceId1)); - deviceId1 = QAudioDeviceInfo::defaultOutputDevice(); + deviceId1 = QAudioDeviceInfo::defaultOutputDevice(); - // Different - QVERIFY(deviceId0 != deviceId1); - QVERIFY(!(deviceId0 == deviceId1)); + // Different + QVERIFY(deviceId0 != deviceId1); + QVERIFY(!(deviceId0 == deviceId1)); - // Same - deviceId0 = deviceId1; + // Same + deviceId0 = deviceId1; - QVERIFY(deviceId0 == deviceId1); - QVERIFY(!(deviceId0 != deviceId1)); + QVERIFY(deviceId0 == deviceId1); + QVERIFY(!(deviceId0 != deviceId1)); + } } QTEST_MAIN(tst_QAudioDeviceId) diff --git a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp index 72121a7..47f3d00 100644 --- a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp +++ b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp @@ -55,6 +55,7 @@ public: tst_QAudioDeviceInfo(QObject* parent=0) : QObject(parent) {} private slots: + void initTestCase(); void checkAvailableDefaultInput(); void checkAvailableDefaultOutput(); void outputList(); @@ -69,89 +70,134 @@ private slots: void nearest(); private: + bool available; QAudioDeviceInfo* device; }; +void tst_QAudioDeviceInfo::initTestCase() +{ + // Only perform tests if audio output device exists! + QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); + if(devices.size() > 0) + available = true; + else { + qWarning()<<"NOTE: no audio output device found, no test will be performed"; + available = false; + } +} + void tst_QAudioDeviceInfo::checkAvailableDefaultInput() { - QVERIFY(!QAudioDeviceInfo::defaultInputDevice().isNull()); + // Only perform tests if audio input device exists! + bool storeAvailable = available; + QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); + if(devices.size() > 0) + available = true; + else { + qWarning()<<"NOTE: no audio input device found, no test will be performed"; + available = false; + } + if(available) + QVERIFY(!QAudioDeviceInfo::defaultInputDevice().isNull()); + available = storeAvailable; } void tst_QAudioDeviceInfo::checkAvailableDefaultOutput() { - QVERIFY(!QAudioDeviceInfo::defaultOutputDevice().isNull()); + if(available) + QVERIFY(!QAudioDeviceInfo::defaultOutputDevice().isNull()); } void tst_QAudioDeviceInfo::outputList() { - QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); - QVERIFY(devices.size() > 0); - device = new QAudioDeviceInfo(devices.at(0), this); + if(available) { + QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); + QVERIFY(devices.size() > 0); + device = new QAudioDeviceInfo(devices.at(0), this); + } } void tst_QAudioDeviceInfo::codecs() { - QStringList avail = device->supportedCodecs(); - QVERIFY(avail.size() > 0); + if(available) { + QStringList avail = device->supportedCodecs(); + QVERIFY(avail.size() > 0); + } } void tst_QAudioDeviceInfo::channels() { - QList<int> avail = device->supportedChannels(); - QVERIFY(avail.size() > 0); + if(available) { + QList<int> avail = device->supportedChannels(); + QVERIFY(avail.size() > 0); + } } void tst_QAudioDeviceInfo::sampleSizes() { - QList<int> avail = device->supportedSampleSizes(); - QVERIFY(avail.size() > 0); + if(available) { + QList<int> avail = device->supportedSampleSizes(); + QVERIFY(avail.size() > 0); + } } void tst_QAudioDeviceInfo::byteOrders() { - QList<QAudioFormat::Endian> avail = device->supportedByteOrders(); - QVERIFY(avail.size() > 0); + if(available) { + QList<QAudioFormat::Endian> avail = device->supportedByteOrders(); + QVERIFY(avail.size() > 0); + } } void tst_QAudioDeviceInfo::sampleTypes() { - QList<QAudioFormat::SampleType> avail = device->supportedSampleTypes(); - QVERIFY(avail.size() > 0); + if(available) { + QList<QAudioFormat::SampleType> avail = device->supportedSampleTypes(); + QVERIFY(avail.size() > 0); + } } void tst_QAudioDeviceInfo::frequencies() { - QList<int> avail = device->supportedFrequencies(); - QVERIFY(avail.size() > 0); + if(available) { + QList<int> avail = device->supportedFrequencies(); + QVERIFY(avail.size() > 0); + } } void tst_QAudioDeviceInfo::isformat() { - QAudioFormat format; - format.setFrequency(44100); - format.setChannels(2); - format.setSampleType(QAudioFormat::SignedInt); - format.setByteOrder(QAudioFormat::LittleEndian); - format.setSampleSize(16); - format.setCodec("audio/pcm"); - - // Should always be true for these format - QVERIFY(device->isFormatSupported(format)); + if(available) { + QAudioFormat format; + format.setFrequency(44100); + format.setChannels(2); + format.setSampleType(QAudioFormat::SignedInt); + format.setByteOrder(QAudioFormat::LittleEndian); + format.setSampleSize(16); + format.setCodec("audio/pcm"); + + // Should always be true for these format + QVERIFY(device->isFormatSupported(format)); + } } void tst_QAudioDeviceInfo::preferred() { - QAudioFormat format = device->preferredFormat(); - QVERIFY(format.frequency() == 44100); - QVERIFY(format.channels() == 2); + if(available) { + QAudioFormat format = device->preferredFormat(); + QVERIFY(format.frequency() == 44100); + QVERIFY(format.channels() == 2); + } } void tst_QAudioDeviceInfo::nearest() { - QAudioFormat format1, format2; - format1.setFrequency(8000); - format2 = device->nearestFormat(format1); - QVERIFY(format2.frequency() == 44100); + if(available) { + QAudioFormat format1, format2; + format1.setFrequency(8000); + format2 = device->nearestFormat(format1); + QVERIFY(format2.frequency() == 44100); + } } QTEST_MAIN(tst_QAudioDeviceInfo) diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp index 891d1c4..6f1d568 100644 --- a/tests/auto/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp @@ -60,6 +60,7 @@ private slots: void pullFile(); private: + bool available; QAudioFormat format; QAudioInput* audio; }; @@ -73,46 +74,62 @@ void tst_QAudioInput::initTestCase() format.setByteOrder(QAudioFormat::LittleEndian); format.setSampleType(QAudioFormat::UnSignedInt); - audio = new QAudioInput(format, this); + // Only perform tests if audio input device exists! + QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); + if(devices.size() > 0) + available = true; + else { + qWarning()<<"NOTE: no audio input device found, no test will be performed"; + available = false; + } + + if(available) + audio = new QAudioInput(format, this); } void tst_QAudioInput::settings() { - QAudioFormat f = audio->format(); - - QVERIFY(format.channels() == f.channels()); - QVERIFY(format.frequency() == f.frequency()); - QVERIFY(format.sampleSize() == f.sampleSize()); - QVERIFY(format.codec() == f.codec()); - QVERIFY(format.byteOrder() == f.byteOrder()); - QVERIFY(format.sampleType() == f.sampleType()); + if(available) { + QAudioFormat f = audio->format(); + + QVERIFY(format.channels() == f.channels()); + QVERIFY(format.frequency() == f.frequency()); + QVERIFY(format.sampleSize() == f.sampleSize()); + QVERIFY(format.codec() == f.codec()); + QVERIFY(format.byteOrder() == f.byteOrder()); + QVERIFY(format.sampleType() == f.sampleType()); + } } void tst_QAudioInput::notifyInterval() { - QVERIFY(audio->notifyInterval() == 1000); // Default + if(available) { + QVERIFY(audio->notifyInterval() == 1000); // Default - audio->setNotifyInterval(500); - QVERIFY(audio->notifyInterval() == 500); // Custom + audio->setNotifyInterval(500); + QVERIFY(audio->notifyInterval() == 500); // Custom - audio->setNotifyInterval(1000); // reset + audio->setNotifyInterval(1000); // reset + } } void tst_QAudioInput::pullFile() { - QFile filename(SRCDIR "test.raw"); - filename.open( QIODevice::WriteOnly | QIODevice::Truncate ); + if(available) { + QFile filename(SRCDIR "test.raw"); + filename.open( QIODevice::WriteOnly | QIODevice::Truncate ); - QSignalSpy readSignal(audio, SIGNAL(notify())); - audio->start(&filename); + QSignalSpy readSignal(audio, SIGNAL(notify())); + audio->start(&filename); - QTest::qWait(5000); + QTest::qWait(5000); - QVERIFY(readSignal.count() > 0); - QVERIFY(audio->totalTime() > 0); + QVERIFY(readSignal.count() > 0); + QVERIFY(audio->totalTime() > 0); - audio->stop(); - filename.close(); + audio->stop(); + filename.close(); + } } QTEST_MAIN(tst_QAudioInput) diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp index 2c3f662..0552aa4 100644 --- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp @@ -63,6 +63,7 @@ private slots: void pushFile(); private: + bool available; QAudioFormat format; QAudioOutput* audio; }; @@ -76,79 +77,95 @@ void tst_QAudioOutput::initTestCase() format.setByteOrder(QAudioFormat::LittleEndian); format.setSampleType(QAudioFormat::UnSignedInt); + // Only perform tests if audio output device exists! + QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); + if(devices.size() > 0) + available = true; + else { + qWarning()<<"NOTE: no audio output device found, no test will be performed"; + available = false; + } audio = new QAudioOutput(format, this); } void tst_QAudioOutput::settings() { - QAudioFormat f = audio->format(); - - QVERIFY(format.channels() == f.channels()); - QVERIFY(format.frequency() == f.frequency()); - QVERIFY(format.sampleSize() == f.sampleSize()); - QVERIFY(format.codec() == f.codec()); - QVERIFY(format.byteOrder() == f.byteOrder()); - QVERIFY(format.sampleType() == f.sampleType()); + if(available) { + QAudioFormat f = audio->format(); + + QVERIFY(format.channels() == f.channels()); + QVERIFY(format.frequency() == f.frequency()); + QVERIFY(format.sampleSize() == f.sampleSize()); + QVERIFY(format.codec() == f.codec()); + QVERIFY(format.byteOrder() == f.byteOrder()); + QVERIFY(format.sampleType() == f.sampleType()); + } } void tst_QAudioOutput::notifyInterval() { - QVERIFY(audio->notifyInterval() == 1000); // Default + if(available) { + QVERIFY(audio->notifyInterval() == 1000); // Default - audio->setNotifyInterval(500); - QVERIFY(audio->notifyInterval() == 500); // Custom + audio->setNotifyInterval(500); + QVERIFY(audio->notifyInterval() == 500); // Custom - audio->setNotifyInterval(1000); // reset + audio->setNotifyInterval(1000); // reset + } } void tst_QAudioOutput::pullFile() { - QFile filename(SRCDIR "4.wav"); - QVERIFY(filename.exists()); - filename.open(QIODevice::ReadOnly); - - QSignalSpy readSignal(audio, SIGNAL(notify())); - audio->setNotifyInterval(100); - audio->start(&filename); - - QTestEventLoop::instance().enterLoop(1); - // 4.wav is a little less than 700ms, so notify should fire 6 times! - QVERIFY(readSignal.count() >= 6); - QVERIFY(audio->totalTime() == 692250); - - audio->stop(); - filename.close(); + if(available) { + QFile filename(SRCDIR "4.wav"); + QVERIFY(filename.exists()); + filename.open(QIODevice::ReadOnly); + + QSignalSpy readSignal(audio, SIGNAL(notify())); + audio->setNotifyInterval(100); + audio->start(&filename); + + QTestEventLoop::instance().enterLoop(1); + // 4.wav is a little less than 700ms, so notify should fire 6 times! + QVERIFY(readSignal.count() >= 6); + QVERIFY(audio->totalTime() == 692250); + + audio->stop(); + filename.close(); + } } void tst_QAudioOutput::pushFile() { - QFile filename(SRCDIR "4.wav"); - QVERIFY(filename.exists()); - filename.open(QIODevice::ReadOnly); - - const qint64 fileSize = filename.size(); - - QIODevice* feed = audio->start(0); - - char* buffer = new char[fileSize]; - filename.read(buffer, fileSize); - - qint64 counter=0; - qint64 written=0; - while(written < fileSize) { - written+=feed->write(buffer+written,fileSize-written); - QTest::qWait(20); - counter++; + if(available) { + QFile filename(SRCDIR "4.wav"); + QVERIFY(filename.exists()); + filename.open(QIODevice::ReadOnly); + + const qint64 fileSize = filename.size(); + + QIODevice* feed = audio->start(0); + + char* buffer = new char[fileSize]; + filename.read(buffer, fileSize); + + qint64 counter=0; + qint64 written=0; + while(written < fileSize) { + written+=feed->write(buffer+written,fileSize-written); + QTest::qWait(20); + counter++; + } + QTestEventLoop::instance().enterLoop(1); + + QVERIFY(written == fileSize); + QVERIFY(audio->totalTime() == 692250); + + audio->stop(); + filename.close(); + delete [] buffer; + delete audio; } - QTestEventLoop::instance().enterLoop(1); - - QVERIFY(written == fileSize); - QVERIFY(audio->totalTime() == 692250); - - audio->stop(); - filename.close(); - delete [] buffer; - delete audio; } QTEST_MAIN(tst_QAudioOutput) diff --git a/tests/auto/qcolumnview/qcolumnview.pro b/tests/auto/qcolumnview/qcolumnview.pro index 00e3880..754f06f 100644 --- a/tests/auto/qcolumnview/qcolumnview.pro +++ b/tests/auto/qcolumnview/qcolumnview.pro @@ -1,8 +1,4 @@ CONFIG += qttest_p4 -include(../src/qcolumnview.pri) - SOURCES += tst_qcolumnview.cpp TARGET = tst_qcolumnview - - diff --git a/tests/auto/qdesktopservices/qdesktopservices.pro b/tests/auto/qdesktopservices/qdesktopservices.pro index 7c1bdb9..9ef557d 100644 --- a/tests/auto/qdesktopservices/qdesktopservices.pro +++ b/tests/auto/qdesktopservices/qdesktopservices.pro @@ -2,9 +2,6 @@ CONFIG += qttest_p4 SOURCES += tst_qdesktopservices.cpp TARGET = tst_qdesktopservices - -include(../src/qdesktopservices.pri) - symbian: { dummy.sources = text\testfile.txt dummy.path = . @@ -30,4 +27,3 @@ symbian: { #DEPLOYMENT += dummy text } - diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp index e0548a7..686f62f 100644 --- a/tests/auto/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp @@ -598,7 +598,7 @@ void tst_QDockWidget::visibilityChanged() QCOMPARE(spy.count(), 0); mw.addDockWidget(Qt::RightDockWidgetArea, &dw2); - qApp->processEvents(); + QTest::qWait(200); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); } diff --git a/tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp b/tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp index 4cdeb5c..97e57f1 100644 --- a/tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp +++ b/tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp @@ -61,6 +61,7 @@ private Q_SLOTS: void clone() const; void data() const; void reset() const; + void swap() const; }; class MyClass : public QSharedData @@ -233,6 +234,25 @@ void tst_QExplicitlySharedDataPointer::reset() const } } +void tst_QExplicitlySharedDataPointer::swap() const +{ + QExplicitlySharedDataPointer<MyClass> p1(0), p2(new MyClass()); + QVERIFY(!p1.data()); + QVERIFY(p2.data()); + + p1.swap(p2); + QVERIFY(p1.data()); + QVERIFY(!p2.data()); + + p1.swap(p2); + QVERIFY(!p1.data()); + QVERIFY(p2.data()); + + qSwap(p1, p2); + QVERIFY(p1.data()); + QVERIFY(!p2.data()); +} + QTEST_MAIN(tst_QExplicitlySharedDataPointer) #include "tst_qexplicitlyshareddatapointer.moc" diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro index d421e44..eac16ee 100644 --- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro @@ -1,8 +1,5 @@ CONFIG += qttest_p4 -include(../../src/qfiledialog.pri) -include(../../../../modeltest/modeltest.pri) - QT = core gui SOURCES += tst_qfilesystemmodel.cpp diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index f827bfc..9ffbc05 100644 --- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp @@ -71,7 +71,7 @@ private slots: void elidedText(); void veryNarrowElidedText(); void averageCharWidth(); - void elidedMultiLenght(); + void elidedMultiLength(); }; tst_QFontMetrics::tst_QFontMetrics() @@ -203,7 +203,7 @@ void tst_QFontMetrics::averageCharWidth() QVERIFY(fmf.averageCharWidth() != 0); } -void tst_QFontMetrics::elidedMultiLenght() +void tst_QFontMetrics::elidedMultiLength() { QString text1 = "Long Text 1\x9cShorter\x9csmall"; QString text1_long = "Long Text 1"; @@ -218,8 +218,9 @@ void tst_QFontMetrics::elidedMultiLenght() QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short), text1_short); QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short - 1), text1_small); + // Not even wide enough for "small" - should use ellipsis QChar ellipsisChar(0x2026); - QString text1_el = QString::fromLatin1("sm") + ellipsisChar; + QString text1_el = QString::fromLatin1("s") + ellipsisChar; int width_small = fm.width(text1_el); QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_small + 1), text1_el); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index d49109d..7ff54f2 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -281,6 +281,8 @@ private slots: void autoDetectFocusProxy(); void subFocus(); void reverseCreateAutoFocusProxy(); + void focusProxyDeletion(); + void negativeZStacksBehindParent(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -7540,5 +7542,71 @@ void tst_QGraphicsItem::explicitDeleteAutoFocusProxy() QCOMPARE(text->focusProxy(), (QGraphicsItem *)0); } +void tst_QGraphicsItem::focusProxyDeletion() +{ + QGraphicsRectItem *rect = new QGraphicsRectItem; + QGraphicsRectItem *rect2 = new QGraphicsRectItem; + rect->setFocusProxy(rect2); + QCOMPARE(rect->focusProxy(), (QGraphicsItem *)rect2); + + delete rect2; + QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0); + + rect2 = new QGraphicsRectItem; + rect->setFocusProxy(rect2); + delete rect; // don't crash + + rect = new QGraphicsRectItem; + rect->setFocusProxy(rect2); + QGraphicsScene *scene = new QGraphicsScene; + scene->addItem(rect); + scene->addItem(rect2); + delete rect2; + QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0); + + rect2 = new QGraphicsRectItem; + QTest::ignoreMessage(QtWarningMsg, "QGraphicsItem::setFocusProxy: focus proxy must be in same scene"); + rect->setFocusProxy(rect2); + QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0); + scene->addItem(rect2); + rect->setFocusProxy(rect2); + QCOMPARE(rect->focusProxy(), (QGraphicsItem *)rect2); + delete rect; // don't crash + + rect = new QGraphicsRectItem; + rect2 = new QGraphicsRectItem; + rect->setFocusProxy(rect2); + QCOMPARE(rect->focusProxy(), (QGraphicsItem *)rect2); + scene->addItem(rect); + scene->addItem(rect2); + rect->setFocusProxy(rect2); + delete scene; // don't crash +} + +void tst_QGraphicsItem::negativeZStacksBehindParent() +{ + QGraphicsRectItem rect; + QCOMPARE(rect.zValue(), qreal(0.0)); + QVERIFY(!(rect.flags() & QGraphicsItem::ItemNegativeZStacksBehindParent)); + QVERIFY(!(rect.flags() & QGraphicsItem::ItemStacksBehindParent)); + rect.setZValue(-1); + QCOMPARE(rect.zValue(), qreal(-1.0)); + QVERIFY(!(rect.flags() & QGraphicsItem::ItemStacksBehindParent)); + rect.setZValue(0); + rect.setFlag(QGraphicsItem::ItemNegativeZStacksBehindParent); + QVERIFY(rect.flags() & QGraphicsItem::ItemNegativeZStacksBehindParent); + QVERIFY(!(rect.flags() & QGraphicsItem::ItemStacksBehindParent)); + rect.setZValue(-1); + QVERIFY(rect.flags() & QGraphicsItem::ItemStacksBehindParent); + rect.setZValue(0); + QVERIFY(!(rect.flags() & QGraphicsItem::ItemStacksBehindParent)); + rect.setFlag(QGraphicsItem::ItemNegativeZStacksBehindParent, false); + rect.setZValue(-1); + rect.setFlag(QGraphicsItem::ItemNegativeZStacksBehindParent, true); + QVERIFY(rect.flags() & QGraphicsItem::ItemStacksBehindParent); + rect.setFlag(QGraphicsItem::ItemNegativeZStacksBehindParent, false); + QVERIFY(rect.flags() & QGraphicsItem::ItemStacksBehindParent); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 803898a..364def4 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -216,6 +216,7 @@ private slots: void task239047_fitInViewSmallViewport(); void task245469_itemsAtPointWithClip(); void task253415_reconnectUpdateSceneOnSceneChanged(); + void task255529_transformationAnchorMouseAndViewportMargins(); }; void tst_QGraphicsView::initTestCase() @@ -3627,5 +3628,41 @@ void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() QVERIFY(wasConnected2); } +void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins() +{ + QGraphicsScene scene(-100, -100, 200, 200); + scene.addRect(QRectF(-50, -50, 100, 100), QPen(Qt::black), QBrush(Qt::blue)); + + class VpGraphicsView: public QGraphicsView + { + public: + VpGraphicsView(QGraphicsScene *scene) + : QGraphicsView(scene) + { + setViewportMargins(8, 16, 12, 20); + setTransformationAnchor(QGraphicsView::AnchorUnderMouse); + setMouseTracking(true); + } + }; + + VpGraphicsView view(&scene); + view.show(); + QPoint mouseViewPos(20, 20); + sendMouseMove(view.viewport(), mouseViewPos); + QTest::qWait(125); + + QPointF mouseScenePos = view.mapToScene(mouseViewPos); + view.setTransform(QTransform().scale(5, 5)); + QTest::qWait(125); + view.setTransform(QTransform().rotate(5, Qt::ZAxis), true); + QTest::qWait(125); + + QPointF newMouseScenePos = view.mapToScene(mouseViewPos); + qreal slack = 3; + QVERIFY(qAbs(newMouseScenePos.x() - mouseScenePos.x()) < slack); + QVERIFY(qAbs(newMouseScenePos.y() - mouseScenePos.y()) < slack); +} + + QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" diff --git a/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro b/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro index 7cd8d51..889aac9 100644 --- a/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro +++ b/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro @@ -3,6 +3,20 @@ SOURCES += tst_qhelpcontentmodel.cpp CONFIG += help -DEFINES += SRCDIR=\\\"$$PWD\\\" DEFINES += QT_USE_USING_NAMESPACE !contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS + +wince*: { + DEFINES += SRCDIR=\\\"./\\\" + QT += network + addFiles.sources = $$PWD/data/*.* + addFiles.path = data + clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll + + DEPLOYMENT += addFiles + DEPLOYMENT += clucene + + DEPLOYMENT_PLUGIN += qsqlite +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +}
\ No newline at end of file diff --git a/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp b/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp index 499c367..d765c25 100644 --- a/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp +++ b/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp @@ -98,6 +98,8 @@ void tst_QHelpEngineCore::init() // defined in profile m_path = QLatin1String(SRCDIR); + m_path = QFileInfo(m_path).absoluteFilePath(); + m_colFile = m_path + QLatin1String("/data/col.qhc"); if (QFile::exists(m_colFile)) QDir::current().remove(m_colFile); diff --git a/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro b/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro index 11fca8e..27ebd0f 100644 --- a/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro +++ b/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro @@ -3,6 +3,21 @@ SOURCES += tst_qhelpenginecore.cpp CONFIG += help QT += sql -DEFINES += SRCDIR=\\\"$$PWD\\\" + DEFINES += QT_USE_USING_NAMESPACE !contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS + +wince*: { + DEFINES += SRCDIR=\\\"./\\\" + QT += network + addFiles.sources = $$PWD/data/*.* + addFiles.path = data + clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll + + DEPLOYMENT += addFiles + DEPLOYMENT += clucene + + DEPLOYMENT_PLUGIN += qsqlite +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff Binary files differnew file mode 100644 index 0000000..3fcb8a9 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff Binary files differnew file mode 100644 index 0000000..6f3e9d5 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff Binary files differnew file mode 100644 index 0000000..aab9cf2 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff Binary files differnew file mode 100644 index 0000000..aad96ff --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff Binary files differnew file mode 100644 index 0000000..05d23dc --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff Binary files differnew file mode 100644 index 0000000..9ffe7fc --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff Binary files differnew file mode 100644 index 0000000..eeeb019 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff Binary files differnew file mode 100644 index 0000000..87cf2fd --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_1.tiff b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_1.tiff Binary files differnew file mode 100644 index 0000000..3b589b2 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_1.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_2.tiff b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_2.tiff Binary files differnew file mode 100644 index 0000000..9a66223 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_2.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_3.tiff b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_3.tiff Binary files differnew file mode 100644 index 0000000..eed2423 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_3.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_4.tiff b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_4.tiff Binary files differnew file mode 100644 index 0000000..055480e --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_4.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_5.tiff b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_5.tiff Binary files differnew file mode 100644 index 0000000..b4d0974 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_5.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_6.tiff b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_6.tiff Binary files differnew file mode 100644 index 0000000..3b1e02a --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_6.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_7.tiff b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_7.tiff Binary files differnew file mode 100644 index 0000000..b752c74 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_7.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_8.tiff b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_8.tiff Binary files differnew file mode 100644 index 0000000..e228d05 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_8.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/original_indexed.tiff b/tests/auto/qimagereader/images/tiff_oriented/original_indexed.tiff Binary files differnew file mode 100644 index 0000000..7507e52 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/original_indexed.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/original_mono.tiff b/tests/auto/qimagereader/images/tiff_oriented/original_mono.tiff Binary files differnew file mode 100644 index 0000000..8ff9db8 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/original_mono.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/original_rgb.tiff b/tests/auto/qimagereader/images/tiff_oriented/original_rgb.tiff Binary files differnew file mode 100644 index 0000000..321ea3e --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/original_rgb.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff Binary files differnew file mode 100644 index 0000000..2756a82 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff Binary files differnew file mode 100644 index 0000000..ae9af09 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff Binary files differnew file mode 100644 index 0000000..a2f4325 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff Binary files differnew file mode 100644 index 0000000..f35bfc4 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff Binary files differnew file mode 100644 index 0000000..70e5478 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff Binary files differnew file mode 100644 index 0000000..b2635fe --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff Binary files differnew file mode 100644 index 0000000..1fb0cd9 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff Binary files differnew file mode 100644 index 0000000..666b1b4 --- /dev/null +++ b/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 30a934c..1d19baa 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -153,6 +153,9 @@ private slots: void tiffCompression_data(); void tiffCompression(); void tiffEndianness(); + + void tiffOrientation_data(); + void tiffOrientation(); #endif void autoDetectImageFormat(); @@ -1314,6 +1317,48 @@ void tst_QImageReader::tiffEndianness() QCOMPARE(littleEndian, bigEndian); } +void tst_QImageReader::tiffOrientation_data() +{ + QTest::addColumn<QString>("expected"); + QTest::addColumn<QString>("oriented"); + QTest::newRow("Indexed TIFF, orientation1") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_1.tiff"; + QTest::newRow("Indexed TIFF, orientation2") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_2.tiff"; + QTest::newRow("Indexed TIFF, orientation3") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_3.tiff"; + QTest::newRow("Indexed TIFF, orientation4") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_4.tiff"; + QTest::newRow("Indexed TIFF, orientation5") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_5.tiff"; + QTest::newRow("Indexed TIFF, orientation6") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_6.tiff"; + QTest::newRow("Indexed TIFF, orientation7") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_7.tiff"; + QTest::newRow("Indexed TIFF, orientation8") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_8.tiff"; + + QTest::newRow("Mono TIFF, orientation1") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_1.tiff"; + QTest::newRow("Mono TIFF, orientation2") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_2.tiff"; + QTest::newRow("Mono TIFF, orientation3") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_3.tiff"; + QTest::newRow("Mono TIFF, orientation4") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_4.tiff"; + QTest::newRow("Mono TIFF, orientation5") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_5.tiff"; + QTest::newRow("Mono TIFF, orientation6") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_6.tiff"; + QTest::newRow("Mono TIFF, orientation7") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_7.tiff"; + QTest::newRow("Mono TIFF, orientation8") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_8.tiff"; + + QTest::newRow("RGB TIFF, orientation1") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_1.tiff"; + QTest::newRow("RGB TIFF, orientation2") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_2.tiff"; + QTest::newRow("RGB TIFF, orientation3") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_3.tiff"; + QTest::newRow("RGB TIFF, orientation4") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_4.tiff"; + QTest::newRow("RGB TIFF, orientation5") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_5.tiff"; + QTest::newRow("RGB TIFF, orientation6") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_6.tiff"; + QTest::newRow("RGB TIFF, orientation7") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_7.tiff"; + QTest::newRow("RGB TIFF, orientation8") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_8.tiff"; +} + +void tst_QImageReader::tiffOrientation() +{ + QFETCH(QString, expected); + QFETCH(QString, oriented); + + QImage expectedImage(prefix + expected); + QImage orientedImage(prefix + oriented); + QCOMPARE(expectedImage, orientedImage); +} + #endif void tst_QImageReader::dotsPerMeter_data() diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 5af6f39..3ff177a 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -113,6 +113,7 @@ private slots: void oneKeyValue(); void updateOnSetKeyValues(); void restart(); + void valueChanged(); }; tst_QPropertyAnimation::tst_QPropertyAnimation() @@ -1052,6 +1053,33 @@ void tst_QPropertyAnimation::restart() anim.start(); } +void tst_QPropertyAnimation::valueChanged() +{ + qRegisterMetaType<QVariant>("QVariant"); + + //we check that we receive the valueChanged signal + MyErrorObject o; + o.setOle(0); + QCOMPARE(o.property("ole").toInt(), 0); + QPropertyAnimation anim(&o, "ole"); + anim.setEndValue(5); + anim.setDuration(1000); + QSignalSpy spy(&anim, SIGNAL(valueChanged(QVariant))); + anim.start(); + + QTest::qWait(anim.duration() + 50); + + QCOMPARE(anim.state(), QAbstractAnimation::Stopped); + QCOMPARE(anim.currentTime(), anim.duration()); + + //let's check that the values go forward + QCOMPARE(spy.count(), 6); //we should have got everything from 0 to 5 + for (int i = 0; i < spy.count(); ++i) { + QCOMPARE(qvariant_cast<QVariant>(spy.at(i).first()).toInt(), i); + } +} + + QTEST_MAIN(tst_QPropertyAnimation) #include "tst_qpropertyanimation.moc" diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 69511e6..c33121c 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -66,6 +66,7 @@ class tst_QSharedPointer: public QObject private slots: void basics_data(); void basics(); + void swap(); void forwardDeclaration1(); void forwardDeclaration2(); void memoryManagement(); @@ -267,6 +268,37 @@ void tst_QSharedPointer::basics() // aData is deleted here } +void tst_QSharedPointer::swap() +{ + QSharedPointer<int> p1, p2(new int(42)), control = p2; + QVERIFY(p1 != control); + QVERIFY(p1.isNull()); + QVERIFY(p2 == control); + QVERIFY(!p2.isNull()); + QVERIFY(*p2 == 42); + + p1.swap(p2); + QVERIFY(p1 == control); + QVERIFY(!p1.isNull()); + QVERIFY(p2 != control); + QVERIFY(p2.isNull()); + QVERIFY(*p1 == 42); + + p1.swap(p2); + QVERIFY(p1 != control); + QVERIFY(p1.isNull()); + QVERIFY(p2 == control); + QVERIFY(!p2.isNull()); + QVERIFY(*p2 == 42); + + qSwap(p1, p2); + QVERIFY(p1 == control); + QVERIFY(!p1.isNull()); + QVERIFY(p2 != control); + QVERIFY(p2.isNull()); + QVERIFY(*p1 == 42); +} + class ForwardDeclared; ForwardDeclared *forwardPointer(); void externalForwardDeclaration(); diff --git a/tests/auto/qtextcodec/test/test.pro b/tests/auto/qtextcodec/test/test.pro index 36cac7c..afd7f5e 100644 --- a/tests/auto/qtextcodec/test/test.pro +++ b/tests/auto/qtextcodec/test/test.pro @@ -1,6 +1,21 @@ load(qttest_p4) -TARGET = ../tst_qtextcodec + SOURCES += ../tst_qtextcodec.cpp + +!wince*: { +TARGET = ../tst_qtextcodec + +win32: { + CONFIG(debug, debug|release) { + TARGET = ../../debug/tst_qtextcodec +} else { + TARGET = ../../release/tst_qtextcodec + } +} +} else { + TARGET = tst_qtextcodec +} + wince*|symbian { addFiles.sources = ../*.txt addFiles.path = . diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 72f3ea8..4643df0 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -55,8 +55,13 @@ #include <qtextlist.h> #include <qtextcodec.h> #include <qurl.h> +#include <qpainter.h> +#include <qfontmetrics.h> +#include <qimage.h> +#include <qtextlayout.h> #include "common.h" + QT_FORWARD_DECLARE_CLASS(QTextDocument) //TESTED_CLASS= @@ -93,6 +98,8 @@ private slots: void noundo_isModified3(); void mightBeRichText(); + void task240325(); + void toHtml_data(); void toHtml(); void toHtml2(); @@ -532,6 +539,38 @@ void tst_QTextDocument::noundo_basicIsModifiedChecks() QCOMPARE(spy.count(), 0); } +void tst_QTextDocument::task240325() +{ + doc->setHtml("<html><img width=\"100\" height=\"100\" align=\"right\"/>Foobar Foobar Foobar Foobar</html>"); + + QImage img(1000, 7000, QImage::Format_ARGB32_Premultiplied); + QPainter p(&img); + QFontMetrics fm(p.font()); + + // Set page size to contain image and one "Foobar" + doc->setPageSize(QSize(100 + fm.width("Foobar")*2, 1000)); + + // Force layout + doc->drawContents(&p); + + QCOMPARE(doc->blockCount(), 1); + for (QTextBlock block = doc->begin() ; block!=doc->end() ; block = block.next()) { + QTextLayout *layout = block.layout(); + QCOMPARE(layout->lineCount(), 4); + for (int lineIdx=0;lineIdx<layout->lineCount();++lineIdx) { + QTextLine line = layout->lineAt(lineIdx); + + QString text = block.text().mid(line.textStart(), line.textLength()).trimmed(); + + // Remove start token + if (lineIdx == 0) + text = text.mid(1); + + QCOMPARE(text, QString::fromLatin1("Foobar")); + } + } +} + void tst_QTextDocument::noundo_moreIsModified() { doc->setUndoRedoEnabled(false); |