diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-10-11 16:12:21 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-10-11 16:12:35 +0200 |
commit | d0eb444a49f6064ecb896f62276e060cd8a4b1e8 (patch) | |
tree | 34d8dd637baf665225ada73e76604531cd2c75e5 /tests/auto | |
parent | da0cb32b8ee7cc4a991a59420a411898e63a660e (diff) | |
parent | 894f86709080fe8d20875b402adce679963c49c2 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Ib8cfeee7d9ca15e8ad520e428b72c200827a8628
Diffstat (limited to 'tests/auto')
6 files changed, 72 insertions, 28 deletions
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index b5115972d7..b681cec802 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -654,7 +654,7 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved() for (int i = 0; i < 10; i++) { QFile f(testDir.filePath(QString("test%1.txt").arg(i))); QVERIFY(f.open(QIODevice::WriteOnly)); - f.write(QByteArray("i am " + i)); + f.write(QByteArray("i am ") + QByteArray::number(i)); f.close(); } diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp index 7ddb221402..df93262d93 100644 --- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp +++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp @@ -69,6 +69,7 @@ QByteArray qMyMessageFormatString(QtMsgType type, const QMessageLogContext &cont case QtWarningMsg: message.append(".warning"); break; case QtCriticalMsg:message.append(".critical"); break; case QtFatalMsg: message.append(".fatal"); break; + case QtTraceMsg: message.append(".trace"); break; } message.append(": "); message.append(qPrintable(str)); @@ -255,27 +256,27 @@ private slots: { logMessage.clear(); - QCOMPARE(QLoggingCategory::defaultCategory().isEnabled<QtDebugMsg>(), true); + QCOMPARE(QLoggingCategory::defaultCategory().isDebugEnabled(), true); QCOMPARE(QLoggingCategory::defaultCategory().isEnabled(QtDebugMsg), true); - QCOMPARE(QLoggingCategory::defaultCategory().isEnabled<QtWarningMsg>(), true); + QCOMPARE(QLoggingCategory::defaultCategory().isWarningEnabled(), true); QCOMPARE(QLoggingCategory::defaultCategory().isEnabled(QtWarningMsg), true); - QCOMPARE(QLoggingCategory::defaultCategory().isEnabled<QtCriticalMsg>(), true); + QCOMPARE(QLoggingCategory::defaultCategory().isCriticalEnabled(), true); QCOMPARE(QLoggingCategory::defaultCategory().isEnabled(QtCriticalMsg), true); QLoggingCategory defaultCategory("default"); - QCOMPARE(defaultCategory.isEnabled<QtDebugMsg>(), true); + QCOMPARE(defaultCategory.isDebugEnabled(), true); QCOMPARE(defaultCategory.isEnabled(QtDebugMsg), true); - QCOMPARE(defaultCategory.isEnabled<QtWarningMsg>(), true); + QCOMPARE(defaultCategory.isWarningEnabled(), true); QCOMPARE(defaultCategory.isEnabled(QtWarningMsg), true); - QCOMPARE(defaultCategory.isEnabled<QtCriticalMsg>(), true); + QCOMPARE(defaultCategory.isCriticalEnabled(), true); QCOMPARE(defaultCategory.isEnabled(QtCriticalMsg), true); QLoggingCategory customCategory("custom"); - QCOMPARE(customCategory.isEnabled<QtDebugMsg>(), false); + QCOMPARE(customCategory.isDebugEnabled(), false); QCOMPARE(customCategory.isEnabled(QtDebugMsg), false); - QCOMPARE(customCategory.isEnabled<QtWarningMsg>(), true); + QCOMPARE(customCategory.isWarningEnabled(), true); QCOMPARE(customCategory.isEnabled(QtWarningMsg), true); - QCOMPARE(customCategory.isEnabled<QtCriticalMsg>(), true); + QCOMPARE(customCategory.isCriticalEnabled(), true); QCOMPARE(customCategory.isEnabled(QtCriticalMsg), true); // make sure nothing has printed warnings @@ -286,10 +287,10 @@ private slots: { logMessage.clear(); - QCOMPARE(QLoggingCategory::defaultCategory().isEnabled<QtDebugMsg>(), true); + QCOMPARE(QLoggingCategory::defaultCategory().isDebugEnabled(), true); QLoggingCategory::defaultCategory().setEnabled(QtDebugMsg, false); - QCOMPARE(QLoggingCategory::defaultCategory().isEnabled<QtDebugMsg>(), false); + QCOMPARE(QLoggingCategory::defaultCategory().isDebugEnabled(), false); QLoggingCategory::defaultCategory().setEnabled(QtDebugMsg, true); // make sure nothing has printed warnings @@ -299,17 +300,17 @@ private slots: void QLoggingCategory_installFilter() { - QVERIFY(QLoggingCategory::defaultCategory().isEnabled<QtDebugMsg>()); + QVERIFY(QLoggingCategory::defaultCategory().isDebugEnabled()); QLoggingCategory::CategoryFilter defaultFilter = QLoggingCategory::installFilter(customCategoryFilter); QVERIFY(defaultFilter); customCategoryFilterArgs.clear(); - QVERIFY(!QLoggingCategory::defaultCategory().isEnabled<QtDebugMsg>()); + QVERIFY(!QLoggingCategory::defaultCategory().isDebugEnabled()); QLoggingCategory cat("custom"); QCOMPARE(customCategoryFilterArgs, QStringList() << "custom"); - QVERIFY(cat.isEnabled<QtDebugMsg>()); + QVERIFY(cat.isDebugEnabled()); customCategoryFilterArgs.clear(); // install default filter @@ -318,8 +319,8 @@ private slots: QCOMPARE((void*)currentFilter, (void*)customCategoryFilter); QCOMPARE(customCategoryFilterArgs.size(), 0); - QVERIFY(QLoggingCategory::defaultCategory().isEnabled<QtDebugMsg>()); - QVERIFY(!cat.isEnabled<QtDebugMsg>()); + QVERIFY(QLoggingCategory::defaultCategory().isDebugEnabled()); + QVERIFY(!cat.isDebugEnabled()); // install default filter currentFilter = @@ -327,8 +328,8 @@ private slots: QCOMPARE((void*)defaultFilter, (void*)currentFilter); QCOMPARE(customCategoryFilterArgs.size(), 0); - QVERIFY(QLoggingCategory::defaultCategory().isEnabled<QtDebugMsg>()); - QVERIFY(!cat.isEnabled<QtDebugMsg>()); + QVERIFY(QLoggingCategory::defaultCategory().isDebugEnabled()); + QVERIFY(!cat.isDebugEnabled()); } void qDebugMacros() @@ -732,6 +733,7 @@ private slots: qCCritical(mycategoryobject) << "My Category Object"; QCOMPARE(cleanLogLine(logMessage), cleanLogLine(buf)); } + Q_UNUSED(pcategorybject); } void checkEmptyCategoryName() diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 186e7b1a3f..d9a0f51f3e 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -106,6 +106,7 @@ private slots: void testThreadSafety(); void testEmptyData(); void testResourceFiles(); + void testRegistryShortRootNames(); #ifdef Q_OS_MAC void fileName(); #endif @@ -1949,6 +1950,18 @@ void tst_QSettings::testResourceFiles() QCOMPARE(settings.value("Field 1/Bottom").toInt(), 90); } +void tst_QSettings::testRegistryShortRootNames() +{ +#ifndef Q_OS_WIN + QSKIP("This test is specific to the Windows registry only."); +#else + QVERIFY(QSettings("HKEY_CURRENT_USER", QSettings::NativeFormat).childGroups() == QSettings("HKCU", QSettings::NativeFormat).childGroups()); + QVERIFY(QSettings("HKEY_LOCAL_MACHINE", QSettings::NativeFormat).childGroups() == QSettings("HKLM", QSettings::NativeFormat).childGroups()); + QVERIFY(QSettings("HKEY_CLASSES_ROOT", QSettings::NativeFormat).childGroups() == QSettings("HKCR", QSettings::NativeFormat).childGroups()); + QVERIFY(QSettings("HKEY_USERS", QSettings::NativeFormat).childGroups() == QSettings("HKU", QSettings::NativeFormat).childGroups()); +#endif +} + void tst_QSettings::fromFile_data() { populateWithFormats(); diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 85d4ef7635..10e79065ee 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -185,7 +185,7 @@ private slots: void htmlExportImportBlockCount(); void QTBUG27354_spaceAndSoftSpace(); - + void cssInheritance(); private: void backgroundImage_checkExpectedHtml(const QTextDocument &doc); @@ -2925,5 +2925,34 @@ void tst_QTextDocument::QTBUG27354_spaceAndSoftSpace() } } +void tst_QTextDocument::cssInheritance() +{ + { + QTextDocument td; + td.setHtml("<html><head><style type=\"text/css\">body { line-height: 200% }</style></head><body>" + "<p>Foo</p><p>Bar</p><p>Baz</p></body></html>"); + QTextBlock block = td.begin(); + while (block.isValid()) { + QTextBlockFormat fmt = block.blockFormat(); + QVERIFY(fmt.lineHeightType() == QTextBlockFormat::ProportionalHeight); + QVERIFY(fmt.lineHeight() == 200); + block = block.next(); + } + } + { + QTextDocument td; + td.setHtml("<html><head><style type=\"text/css\">body { line-height: 200% } p { line-height: 300% }</style></head><body>" + "<p style=\"line-height: 40px\">Foo</p><p>Bar</p><p>Baz</p></body></html>"); + QTextBlock block = td.begin(); + QTextBlockFormat fmt = block.blockFormat(); + QVERIFY(fmt.lineHeightType() == QTextBlockFormat::FixedHeight); + QVERIFY(fmt.lineHeight() == 40); + block = block.next(); + fmt = block.blockFormat(); + QVERIFY(fmt.lineHeightType() == QTextBlockFormat::ProportionalHeight); + QVERIFY(fmt.lineHeight() == 300); + } +} + QTEST_MAIN(tst_QTextDocument) #include "tst_qtextdocument.moc" diff --git a/tests/auto/sql/kernel/qsql/qsql.pro b/tests/auto/sql/kernel/qsql/qsql.pro index 0735986438..20cee413b2 100644 --- a/tests/auto/sql/kernel/qsql/qsql.pro +++ b/tests/auto/sql/kernel/qsql/qsql.pro @@ -3,7 +3,7 @@ CONFIG += parallel_test TARGET = tst_qsql SOURCES += tst_qsql.cpp -QT += sql sql-private gui testlib core-private +QT = core-private sql-private testlib wince*: { DEPLOYMENT_PLUGIN += qsqlite diff --git a/tests/auto/sql/kernel/qsql/tst_qsql.cpp b/tests/auto/sql/kernel/qsql/tst_qsql.cpp index 5747683e4e..24f418af26 100644 --- a/tests/auto/sql/kernel/qsql/tst_qsql.cpp +++ b/tests/auto/sql/kernel/qsql/tst_qsql.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> -#include <qguiapplication.h> +#include <qcoreapplication.h> #include <qsqldatabase.h> #include <qsqlerror.h> #include <qsqlquery.h> @@ -115,7 +115,7 @@ void tst_QSql::basicDriverTest() { int argc = 1; char *argv[] = { const_cast<char*>(QTest::currentAppName()) }; - QGuiApplication app(argc, argv, false); + QCoreApplication app(argc, argv, false); tst_Databases dbs; dbs.open(); @@ -150,7 +150,7 @@ void tst_QSql::basicDriverTest() } // make sure that the static stuff will be deleted -// when using multiple QGuiApplication objects +// when using multiple QCoreApplication objects void tst_QSql::open() { int i; @@ -158,7 +158,7 @@ void tst_QSql::open() char *argv[] = { const_cast<char*>(QTest::currentAppName()) }; int count = -1; for (i = 0; i < 10; ++i) { - QGuiApplication app(argc, argv, false); + QCoreApplication app(argc, argv, false); tst_Databases dbs; dbs.open(); @@ -185,7 +185,7 @@ void tst_QSql::concurrentAccess() { int argc = 1; char *argv[] = { const_cast<char*>(QTest::currentAppName()) }; - QGuiApplication app(argc, argv, false); + QCoreApplication app(argc, argv, false); tst_Databases dbs; dbs.open(); @@ -214,7 +214,7 @@ void tst_QSql::openErrorRecovery() { int argc = 1; char *argv[] = { const_cast<char*>(QTest::currentAppName()) }; - QGuiApplication app(argc, argv, false); + QCoreApplication app(argc, argv, false); tst_Databases dbs; dbs.addDbs(); @@ -262,7 +262,7 @@ void tst_QSql::registerSqlDriver() { int argc = 1; char *argv[] = { const_cast<char*>(QTest::currentAppName()) }; - QGuiApplication app(argc, argv, false); + QCoreApplication app(argc, argv, false); QSqlDatabase::registerSqlDriver("QSQLTESTDRIVER", new QSqlDriverCreator<QSqlNullDriver>); QVERIFY(QSqlDatabase::drivers().contains("QSQLTESTDRIVER")); |