diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-05 18:52:38 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-05 18:52:38 +0100 |
commit | f6dbdd9c16166f345fd5743886229192c97c2c4f (patch) | |
tree | 05e5e7b806dd627be4e3ba6fc9a32f115847acb0 /tests | |
parent | b8084618545570a8832d344a2e9586e1226cc697 (diff) | |
parent | 47efa9213d92a4366e03bd6d056837cd5bbadb1e (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/sql/drivers/sqlite/qsql_sqlite.cpp
Change-Id: Ia7cffd2c99ae3d5eea6b5740683c06e921336dcd
Diffstat (limited to 'tests')
3 files changed, 75 insertions, 14 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index e4804e6079..a7edbc1665 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -153,6 +153,7 @@ private slots: void connectBase(); void qmlConnect(); void exceptions(); + void noDeclarativeParentChangedOnDestruction(); }; struct QObjectCreatedOnShutdown @@ -6282,6 +6283,43 @@ void tst_QObject::exceptions() #endif } +#ifdef QT_BUILD_INTERNAL +static bool parentChangeCalled = false; + +static void testParentChanged(QAbstractDeclarativeData *, QObject *, QObject *) +{ + parentChangeCalled = true; +} +#endif + +void tst_QObject::noDeclarativeParentChangedOnDestruction() +{ +#ifdef QT_BUILD_INTERNAL + typedef void (*ParentChangedCallback)(QAbstractDeclarativeData *, QObject *, QObject *); + QScopedValueRollback<ParentChangedCallback> rollback(QAbstractDeclarativeData::parentChanged); + QAbstractDeclarativeData::parentChanged = testParentChanged; + + QObject *parent = new QObject; + QObject *child = new QObject; + + QAbstractDeclarativeData dummy; + QObjectPrivate::get(child)->declarativeData = &dummy; + + parentChangeCalled = false; + child->setParent(parent); + + QVERIFY(parentChangeCalled); + parentChangeCalled = false; + + delete child; + QVERIFY(!parentChangeCalled); + + delete parent; +#else + QSKIP("Needs QT_BUILD_INTERNAL"); +#endif +} + // Test for QtPrivate::HasQ_OBJECT_Macro Q_STATIC_ASSERT(QtPrivate::HasQ_OBJECT_Macro<tst_QObject>::Value); Q_STATIC_ASSERT(!QtPrivate::HasQ_OBJECT_Macro<SiblingDeleter>::Value); diff --git a/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp index 2d122125e0..3c5ba884f7 100644 --- a/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp +++ b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp @@ -74,6 +74,7 @@ private slots: void inlineImage(); void clippedTableCell(); void floatingTablePageBreak(); + void imageAtRightAlignedTab(); private: QTextDocument *doc; @@ -283,6 +284,41 @@ void tst_QTextDocumentLayout::floatingTablePageBreak() QCOMPARE(doc->pageCount(), 2); } +void tst_QTextDocumentLayout::imageAtRightAlignedTab() +{ + doc->clear(); + + QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); + fmt.setMargin(0); + doc->rootFrame()->setFrameFormat(fmt); + + QTextCursor cursor(doc); + QTextBlockFormat blockFormat; + QList<QTextOption::Tab> tabs; + QTextOption::Tab tab; + tab.position = 300; + tab.type = QTextOption::RightTab; + tabs.append(tab); + blockFormat.setTabPositions(tabs); + + // First block: text, some of it right-aligned + cursor.insertBlock(blockFormat); + cursor.insertText("first line\t"); + cursor.insertText("right-aligned text"); + + // Second block: text, then right-aligned image + cursor.insertBlock(blockFormat); + cursor.insertText("second line\t"); + QImage img(48, 48, QImage::Format_RGB32); + const QString name = QString::fromLatin1("image"); + doc->addResource(QTextDocument::ImageResource, QUrl(name), img); + QTextImageFormat imgFormat; + imgFormat.setName(name); + cursor.insertImage(imgFormat); + + // Everything should fit into the 300 pixels + QCOMPARE(doc->idealWidth(), 300.0); +} QTEST_MAIN(tst_QTextDocumentLayout) #include "tst_qtextdocumentlayout.moc" diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index 644cd33e5c..b8b4c00549 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -207,9 +207,6 @@ void tst_QPrinter::getSetCheck() QCOMPARE(obj1.printerSelectionOption(), QString::fromLatin1("--option")); #endif - obj1.setPrinterName(QString::fromLatin1("myPrinter")); - QCOMPARE(obj1.printerName(), QString::fromLatin1("myPrinter")); - // bool QPrinter::fontEmbeddingEnabled() // void QPrinter::setFontEmbeddingEnabled(bool) obj1.setFontEmbeddingEnabled(false); @@ -461,7 +458,7 @@ void tst_QPrinter::testNonExistentPrinter() QPainter painter; // Make sure it doesn't crash on setting or getting properties - printer.setPrinterName("some non existing printer"); + printer.printEngine()->setProperty(QPrintEngine::PPK_PrinterName, "some non existing printer"); printer.setPageSize(QPrinter::A4); printer.setOrientation(QPrinter::Portrait); printer.setFullPage(true); @@ -709,9 +706,6 @@ void tst_QPrinter::valuePreservation() printer.setCollateCopies(!status); printer.setOutputFormat(newFormat); -#ifdef Q_OS_MAC - QEXPECT_FAIL("","QTBUG-26430", Abort); -#endif QCOMPARE(printer.collateCopies(), !status); printer.setOutputFormat(oldFormat); QCOMPARE(printer.collateCopies(), !status); @@ -909,13 +903,6 @@ void tst_QPrinter::valuePreservation() printer.setOutputFormat(newFormat); printer.setOutputFormat(oldFormat); QCOMPARE(printer.printerName(), status); - - status = QString::fromLatin1("SuperDuperPrinter"); - printer.setPrinterName(status); - printer.setOutputFormat(newFormat); - QCOMPARE(printer.printerName(), status); - printer.setOutputFormat(oldFormat); - QCOMPARE(printer.printerName(), status); } // QPrinter::printerSelectionOption is explicitly documented not to be available on Windows. #ifndef Q_OS_WIN |