diff options
author | Sami Lempinen <sami.lempinen@nokia.com> | 2011-08-31 06:42:09 (GMT) |
---|---|---|
committer | Sami Lempinen <sami.lempinen@nokia.com> | 2011-08-31 06:42:09 (GMT) |
commit | 10be762a98bf5d5947128e334405d532a42b3be0 (patch) | |
tree | 2359dbf112a07a005f913aa46765bbf52b8bff95 /tests | |
parent | c95b2b1fe0e5d02145e3cbdba1d88c7bb58a873f (diff) | |
parent | 1e48d40597bbe12321a5a3e42b3595dc17a7f8e7 (diff) | |
download | Qt-10be762a98bf5d5947128e334405d532a42b3be0.zip Qt-10be762a98bf5d5947128e334405d532a42b3be0.tar.gz Qt-10be762a98bf5d5947128e334405d532a42b3be0.tar.bz2 |
Merge remote-tracking branch 'qt/4.8'
Diffstat (limited to 'tests')
28 files changed, 675 insertions, 241 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 362a8ff..2fdeb71 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -90,6 +90,7 @@ private slots: void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); void qtbug_16871(); + void qtbug_21045(); private: QDeclarativeEngine engine; }; @@ -1238,6 +1239,18 @@ void tst_QDeclarativeItem::qtbug_16871() delete o; } +void tst_QDeclarativeItem::qtbug_21045() +{ + QDeclarativeComponent component(&engine); + QGraphicsScene scene; + component.setData("import QtQuick 1.1\nItem{visible: false; focus: true}", QUrl::fromLocalFile("file:")); + QObject *o = component.create(); + QDeclarativeItem* i = qobject_cast<QDeclarativeItem*>(o); + QVERIFY(i); + scene.addItem(i); + QVERIFY(!i->hasActiveFocus()); +} + QTEST_MAIN(tst_QDeclarativeItem) #include "tst_qdeclarativeitem.moc" diff --git a/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml b/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml index 43ea8d8..6e739bf 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml @@ -18,6 +18,7 @@ Rectangle { objectName: "text" anchors.fill: parent text: top.text + focus: true } } } diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml index 22a9871..f8d2e4e 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml @@ -1,7 +1,8 @@ -import QtQuick 1.0 +import QtQuick 1.1 TextEdit { focus: true - text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + text: "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" selectByMouse: false + mouseSelectionMode: TextEdit.SelectWords } diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml index d61da46..f58fd45 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml @@ -1,7 +1,8 @@ -import QtQuick 1.0 +import QtQuick 1.1 TextEdit { focus: true - text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + text: "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" selectByMouse: true + mouseSelectionMode: TextEdit.SelectWords } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 5d6f2a2..fde0588 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -454,6 +454,8 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QVERIFY(textEdit != 0); canvas->show(); + const QString rtlText = textEdit->text(); + // implicit alignment should follow the reading direction of text QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); @@ -530,6 +532,16 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas)); + + textEdit->setText(QString()); + { QInputMethodEvent ev(rtlText, QList<QInputMethodEvent::Attribute>()); QApplication::sendEvent(canvas, &ev); } + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); + { QInputMethodEvent ev("Hello world!", QList<QInputMethodEvent::Attribute>()); QApplication::sendEvent(canvas, &ev); } + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); + #ifndef Q_OS_MAC // QTBUG-18040 // empty text with implicit alignment follows the system locale-based // keyboard input direction from QApplication::keyboardInputDirection @@ -1315,20 +1327,32 @@ void tst_qdeclarativetextedit::moveCursorSelectionSequence() void tst_qdeclarativetextedit::mouseSelection_data() { QTest::addColumn<QString>("qmlfile"); - QTest::addColumn<bool>("expectSelection"); + QTest::addColumn<int>("from"); + QTest::addColumn<int>("to"); + QTest::addColumn<QString>("selectedText"); // import installed - QTest::newRow("on") << SRCDIR "/data/mouseselection_true.qml" << true; - QTest::newRow("off") << SRCDIR "/data/mouseselection_false.qml" << false; - QTest::newRow("default") << SRCDIR "/data/mouseselection_default.qml" << false; - QTest::newRow("on word selection") << SRCDIR "/data/mouseselection_true_words.qml" << true; - QTest::newRow("off word selection") << SRCDIR "/data/mouseselection_false_words.qml" << false; + QTest::newRow("on") << SRCDIR "/data/mouseselection_true.qml" << 4 << 9 << "45678"; + QTest::newRow("off") << SRCDIR "/data/mouseselection_false.qml" << 4 << 9 << QString(); + QTest::newRow("default") << SRCDIR "/data/mouseselection_default.qml" << 4 << 9 << QString(); + QTest::newRow("off word selection") << SRCDIR "/data/mouseselection_false_words.qml" << 4 << 9 << QString(); + QTest::newRow("on word selection (4,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 4 << 9 << "0123456789"; + QTest::newRow("on word selection (2,13)") << SRCDIR "/data/mouseselection_true_words.qml" << 2 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (2,30)") << SRCDIR "/data/mouseselection_true_words.qml" << 2 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (9,13)") << SRCDIR "/data/mouseselection_true_words.qml" << 9 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (9,30)") << SRCDIR "/data/mouseselection_true_words.qml" << 9 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (13,2)") << SRCDIR "/data/mouseselection_true_words.qml" << 13 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (20,2)") << SRCDIR "/data/mouseselection_true_words.qml" << 20 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (12,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 12 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (30,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 30 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } void tst_qdeclarativetextedit::mouseSelection() { QFETCH(QString, qmlfile); - QFETCH(bool, expectSelection); + QFETCH(int, from); + QFETCH(int, to); + QFETCH(QString, selectedText); QDeclarativeView *canvas = createView(qmlfile); @@ -1342,25 +1366,20 @@ void tst_qdeclarativetextedit::mouseSelection() QVERIFY(textEditObject != 0); // press-and-drag-and-release from x1 to x2 - int x1 = 10; - int x2 = 70; - int y = textEditObject->height()/2; - QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y))); + QPoint p1 = canvas->mapFromScene(textEditObject->positionToRectangle(from).center()); + QPoint p2 = canvas->mapFromScene(textEditObject->positionToRectangle(to).center()); + QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, p1); //QTest::mouseMove(canvas->viewport(), canvas->mapFromScene(QPoint(x2,y))); // doesn't work - QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(p2), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QApplication::sendEvent(canvas->viewport(), &mv); - QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y))); - QString str = textEditObject->selectedText(); - if (expectSelection) - QVERIFY(str.length() > 3); // don't reallly care *what* was selected (and it's too sensitive to platform) - else - QVERIFY(str.isEmpty()); + QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, p2); + QCOMPARE(textEditObject->selectedText(), selectedText); // Clicking and shift to clicking between the same points should select the same text. textEditObject->setCursorPosition(0); - QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::NoModifier, canvas->mapFromScene(QPoint(x1,y))); - QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::ShiftModifier, canvas->mapFromScene(QPoint(x2,y))); - QCOMPARE(textEditObject->selectedText(), str); + QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::NoModifier, p1); + QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::ShiftModifier, p2); + QCOMPARE(textEditObject->selectedText(), selectedText); delete canvas; } diff --git a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml index b11535e..7f27bbe 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml @@ -18,6 +18,7 @@ Rectangle { objectName: "text" anchors.fill: parent text: top.text + focus: true } } } diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 280f952..bb895bf 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1198,6 +1198,8 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QVERIFY(textInput != 0); canvas->show(); + const QString rtlText = textInput->text(); + QDeclarativeTextInputPrivate *textInputPrivate = QDeclarativeTextInputPrivate::get(textInput); QVERIFY(textInputPrivate != 0); QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); @@ -1262,6 +1264,17 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas)); + + // If there is no committed text, the preedit text should determine the alignment. + textInput->setText(QString()); + { QInputMethodEvent ev(rtlText, QList<QInputMethodEvent::Attribute>()); QApplication::sendEvent(canvas, &ev); } + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + { QInputMethodEvent ev("Hello world!", QList<QInputMethodEvent::Attribute>()); QApplication::sendEvent(canvas, &ev); } + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); + #ifndef Q_OS_MAC // QTBUG-18040 // empty text with implicit alignment follows the system locale-based // keyboard input direction from QApplication::keyboardInputDirection diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index 39c3a94..ec22768 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "../../../shared/util.h" #include <qtest.h> #include <QtTest/QSignalSpy> #include <QStandardItemModel> @@ -87,6 +88,13 @@ public: list << "one" << "two" << "three" << "four"; } + void emitMove(int sourceFirst, int sourceLast, int destinationChild) { + emit beginMoveRows(QModelIndex(), sourceFirst, sourceLast, QModelIndex(), destinationChild); + emit endMoveRows(); + } + + QStringList list; + public slots: void set(int idx, QString string) { list[idx] = string; @@ -102,9 +110,6 @@ protected: return list.at(index.row()); return QVariant(); } - -private: - QStringList list; }; @@ -122,6 +127,8 @@ private slots: void singleRole(); void modelProperties(); void noDelegate(); + void qaimRowsMoved(); + void qaimRowsMoved_data(); private: QDeclarativeEngine engine; @@ -501,6 +508,72 @@ void tst_qdeclarativevisualdatamodel::noDelegate() } +void tst_qdeclarativevisualdatamodel::qaimRowsMoved() +{ + // Test parameters passed in QAIM::rowsMoved() signal are converted correctly + // when translated and emitted as the QListModelInterface::itemsMoved() signal + QFETCH(int, sourceFirst); + QFETCH(int, sourceLast); + QFETCH(int, destinationChild); + QFETCH(int, expectFrom); + QFETCH(int, expectTo); + QFETCH(int, expectCount); + + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/visualdatamodel.qml")); + + SingleRoleModel model; + model.list.clear(); + for (int i=0; i<30; i++) + model.list << ("item " + i); + engine.rootContext()->setContextProperty("myModel", &model); + + QDeclarativeVisualDataModel *obj = qobject_cast<QDeclarativeVisualDataModel*>(c.create()); + QVERIFY(obj != 0); + + QSignalSpy spy(obj, SIGNAL(itemsMoved(int,int,int))); + model.emitMove(sourceFirst, sourceLast, destinationChild); + QTRY_COMPARE(spy.count(), 1); + + QCOMPARE(spy[0].count(), 3); + QCOMPARE(spy[0][0].toInt(), expectFrom); + QCOMPARE(spy[0][1].toInt(), expectTo); + QCOMPARE(spy[0][2].toInt(), expectCount); + + delete obj; +} + +void tst_qdeclarativevisualdatamodel::qaimRowsMoved_data() +{ + QTest::addColumn<int>("sourceFirst"); + QTest::addColumn<int>("sourceLast"); + QTest::addColumn<int>("destinationChild"); + QTest::addColumn<int>("expectFrom"); + QTest::addColumn<int>("expectTo"); + QTest::addColumn<int>("expectCount"); + + QTest::newRow("move 1 forward") + << 1 << 1 << 6 + << 1 << 5 << 1; + + QTest::newRow("move 1 backwards") + << 4 << 4 << 1 + << 4 << 1 << 1; + + QTest::newRow("move multiple forwards") + << 0 << 2 << 13 + << 0 << 10 << 3; + + QTest::newRow("move multiple forwards, with same to") + << 0 << 1 << 3 + << 0 << 1 << 2; + + QTest::newRow("move multiple backwards") + << 10 << 14 << 1 + << 10 << 1 << 5; +} + + template<typename T> T *tst_qdeclarativevisualdatamodel::findItem(QGraphicsObject *parent, const QString &objectName, int index) { diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index 0a42a97..419eaae 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -444,9 +444,15 @@ void tst_QDir::QDir_default() void tst_QDir::compare() { // operator== + + // Not using QCOMPARE to test result of QDir::operator== + QDir dir; dir.makeAbsolute(); QVERIFY(dir == QDir::currentPath()); + + QVERIFY(QDir() == QDir(QDir::currentPath())); + QVERIFY(QDir("../") == QDir(QDir::currentPath() + "/..")); } static QStringList filterLinks(const QStringList &list) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 3665b10..9b834d5 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -475,6 +475,7 @@ private slots: void QTBUG_12112_focusItem(); void QTBUG_13473_sceneposchange(); void QTBUG_16374_crashInDestructor(); + void QTBUG_20699_focusScopeCrash(); private: QList<QGraphicsItem *> paintedItems; @@ -11265,5 +11266,36 @@ void tst_QGraphicsItem::QTBUG_16374_crashInDestructor() QTest::qWaitForWindowShown(&view); } +void tst_QGraphicsItem::QTBUG_20699_focusScopeCrash() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + QGraphicsPixmapItem fs; + fs.setFlags(QGraphicsItem::ItemIsFocusScope | QGraphicsItem::ItemIsFocusable); + scene.addItem(&fs); + QGraphicsPixmapItem* fs2 = new QGraphicsPixmapItem(&fs); + fs2->setFlags(QGraphicsItem::ItemIsFocusScope | QGraphicsItem::ItemIsFocusable); + QGraphicsPixmapItem* fi2 = new QGraphicsPixmapItem(&fs); + fi2->setFlags(QGraphicsItem::ItemIsFocusable); + QGraphicsPixmapItem* fi = new QGraphicsPixmapItem(fs2); + fi->setFlags(QGraphicsItem::ItemIsFocusable); + fs.setFocus(); + fi->setFocus(); + + view.show(); + QTest::qWaitForWindowShown(&view); + + fi->setParentItem(fi2); + fi->setFocus(); + fs.setFocus(); + fi->setParentItem(fs2); + fi->setFocus(); + fs2->setFocus(); + fs.setFocus(); + fi->setParentItem(fi2); + fi->setFocus(); + fs.setFocus(); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 2c88561..6abbdcd 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -1770,13 +1770,6 @@ void tst_QLineEdit::passwordEchoDelay() QApplication::sendEvent(testWidget, &ev); QCOMPARE(testWidget->displayText(), QString(7, fillChar) + QLatin1Char('7')); - testWidget->setCursorPosition(3); - QCOMPARE(testWidget->displayText(), QString(7, fillChar) + QLatin1Char('7')); - QTest::keyPress(testWidget, 'a'); - QCOMPARE(testWidget->displayText(), QString(3, fillChar) + QLatin1Char('a') + QString(5, fillChar)); - QTest::keyPress(testWidget, Qt::Key_Backspace); - QCOMPARE(testWidget->displayText(), QString(8, fillChar)); - // restore clean state testWidget->setEchoMode(QLineEdit::Normal); } diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp index 839612e..4ffb00b 100644 --- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp +++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp @@ -116,7 +116,7 @@ void tst_QNetworkProxyFactory::systemProxyForQuery() const QNetworkProxy proxy; QList<QNetworkProxy> nativeProxyList; - nativeProxyList << QNetworkProxy(QNetworkProxy::HttpProxy, QString("http://test.proxy.com"), 8080) << QNetworkProxy::NoProxy; + nativeProxyList << QNetworkProxy(QNetworkProxy::HttpProxy, QString("test.proxy.com"), 8080) << QNetworkProxy::NoProxy; foreach (proxy, systemProxyList) { if (!nativeProxyList.contains(proxy)) { diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp index e0680c4..eb78057 100644 --- a/tests/auto/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/qrawfont/tst_qrawfont.cpp @@ -47,7 +47,6 @@ class tst_QRawFont: public QObject { Q_OBJECT - #if !defined(QT_NO_RAWFONT) private slots: void invalidRawFont(); @@ -94,6 +93,11 @@ private slots: void rawFontSetPixelSize_data(); void rawFontSetPixelSize(); + +#if defined(Q_WS_X11) || defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) + void multipleRawFontsFromData(); +#endif + #endif // QT_NO_RAWFONT }; @@ -843,6 +847,25 @@ void tst_QRawFont::rawFontSetPixelSize() QCOMPARE(rawFont.pixelSize(), 24.0); } +#if defined(Q_WS_X11) || defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) +void tst_QRawFont::multipleRawFontsFromData() +{ + QFile file(QString::fromLatin1(SRCDIR "testfont.ttf")); + QRawFont testFont; + if (file.open(QIODevice::ReadOnly)) { + testFont.loadFromData(file.readAll(), 11, QFont::PreferDefaultHinting); + file.close(); + } + file.setFileName(QLatin1String(SRCDIR "testfont_bold_italic.ttf")); + QRawFont testFontBoldItalic; + if (file.open(QIODevice::ReadOnly)) + testFontBoldItalic.loadFromData(file.readAll(), 11, QFont::PreferDefaultHinting); + + QVERIFY(testFont.familyName() != (testFontBoldItalic.familyName()) + || testFont.styleName() != (testFontBoldItalic.styleName())); +} +#endif + #endif // QT_NO_RAWFONT QTEST_MAIN(tst_QRawFont) diff --git a/tests/auto/qshortcut/tst_qshortcut.cpp b/tests/auto/qshortcut/tst_qshortcut.cpp index a78e8cf..d761b19 100644 --- a/tests/auto/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/qshortcut/tst_qshortcut.cpp @@ -1124,7 +1124,8 @@ void tst_QShortcut::context() // ------------------------------------------------------------------ void tst_QShortcut::clearAllShortcuts() { - qDeleteAll(shortcuts); + QList<QShortcut *> shortcutsCpy = shortcuts; + qDeleteAll(shortcutsCpy); shortcuts.clear(); } diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted-google.com-diginotar.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted-google.com-diginotar.pem new file mode 100644 index 0000000..12bbcae --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted-google.com-diginotar.pem @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFKDCCBBCgAwIBAgIQBeLmpM0J6lTWZbB1/iKiVjANBgkqhkiG9w0BAQUFADBm +MQ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uZGlnaW5vdGFyLm5sKSwgYXJlIGFwcGxpY2FibGUg +dG8gYWxsIG91ciBwcm9kdWN0cyBhbmQgc2VydmljZXMuMEkGA1UdHwRCMEAwPqA8 +oDqGOGh0dHA6Ly9zZXJ2aWNlLmRpZ2lub3Rhci5ubC9jcmwvcHVibGljMjAyNS9s +YXRlc3RDUkwuY3JsMA4GA1UdDwEB/wQEAwIEsDAbBgNVHREEFDASgRBhZG1pbkBn +b29nbGUuY29tMB0GA1UdDgQWBBQHSn0WJzIo0eMBMQUNsMqN6eF/7TANBgkqhkiG +9w0BAQUFAAOCAQEAAs5dL7N9wzRJkI4Aq4lC5t8j5ZadqnqUcgYLADzSv4ExytNH +UY2nH6iVTihC0UPSsILWraoeApdT7Rphz/8DLQEBRGdeKWAptNM3EbiXtQaZT2uB +pidL8UoafX0kch3f71Y1scpBEjvu5ZZLnjg0A8AL0tnsereOVdDpU98bKqdbbrnM +FRmBlSf7xdaNca6JJHeEpga4E9Ty683CmccrSGXdU2tTCuHEJww+iOAUtPIZcsum +U7/eYeY1pMyGLyIjbNgRY7nDzRwvM/BsbL9eh4/mSQj/4nncqJd22sVQpCggQiVK +baB2sVGcVNBkK55bT8gPqnx8JypubyUvayzZGg== +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem index 3945aea..7fc0a05 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem @@ -2,18 +2,18 @@ MIIDDzCCAnigAwIBAgIQBH7L6fylX3vQnq424QyuHjANBgkqhkiG9w0BAQUFADBf MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb20w -HhcNMTEwMzI0MTMwNjI1WhcNMTEw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li5Sj2 -+iEdJ5xMP8R6FtgqAYknqXD8+tyEyXxJXdN186qdAWuTD9N22AUqi61BPWxUkufW -xH8FYMEHdFCkitvYE0321+GT5pJz6ON/d5Co+wusumt7T5oSjzj8Ax9V+nmo3Nkb -dSANM4/Lnc6moijcpJZq+GC1ng== +rh4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQAldVSTJ4lNG9Qxx2GG +/y/ccH/BBYkpPXBklKP/U528Zk48jypWsbnZ07rQrPIlSXYQHffdNH3JsEiF/el9 +bIu+6tGJzmjqvtl5fD5S+yBvI3ySx3Fz6lWmUlqT6UY1X8Oob2PsR6u6mfT8Q1da +d02x97EUSiAzYvzxndqD6g8R1w== -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem index 4b8d059..3c8489f 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem @@ -2,18 +2,18 @@ MIIDDjCCAnegAwIBAgIRAPXIavNhYvE6ZPVPbclYfAYwDQYJKoZIhvcNAQEFBQAw XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMOd3d3Lmdvb2dsZS5jb20w -HhcNMTEwMzI0MTMwNzExWhcNMTEwNDIzMTMwNzExWjBeMQswCQYDVQQGEwJBVTET +HhcNMTEwODMwMTAxOTUxWhcNMjEwODI3MTAxOTUxWjBeMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRcwFQYDVQQDEw53d3cuZ29vZ2xlLmNvbTCBnzANBgkqhkiG9w0BAQEF -AAOBjQAwgYkCgYEAy1fNDFl65Njfcd1EUJeaxvyi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NpPJkSKuBPppkr9nk6WDfpt +TG+oN3Yb1rFmJv6eZw8ud9btoquc8jAtaQnihbjFPEP9cCLBw3Gz1C/JBjDw1tgK +zXKNU+jMZYk7c5Z64DocggBH -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem index e47ece6..fa458cc 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem @@ -2,18 +2,18 @@ MIIDETCCAnqgAwIBAgIRANdVj9r18RBbshMoK3B3KaMwDQYJKoZIhvcNAQEFBQAw XzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29t -MB4XDTExMDMyNDEzMDg0MloXDTExMDQyMzEzMDg0MlowXzELMAkGA1UEBhMCQVUx +MB4XDTExMDgzMDEwMjAzNloXDTIxMDgyNzEwMjAzNlowXzELMAkGA1UEBhMCQVUx EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29tMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQCosFLKRvGtxjvdAjWdEAHYycFTa4VtdpXmCNhNHf2xbeLn -xzde10KjEe44pQxNI+UUD1rJkyuH6wUfloyefn0D2Mu+MvusmvOEzFosa4EDbK9s -BAAlsSiyJgrp/GgbEPq/XOl4XJRBIVP1WC6LllduNbskFCipDqS+HQwifXmmwQID -AQABo4HMMIHJMB0GA1UdDgQWBBSEgWnsoYtd5GEx/MGJvKxuIuROJzCBmQYDVR0j -BIGRMIGOgBSEgWnsoYtd5GEx/MGJvKxuIuROJ6FjpGEwXzELMAkGA1UEBhMCQVUx +AQUAA4GNADCBiQKBgQC3TVwiPfNClgadKYuX50szBlIaVWDd+UFHsakbGk0bgqlu +YKgC/cmbjgOyrmsEC2HbJISceTz9CK6mCewEgGFWuq6gjYi4UnSFk1o6h6WJV86A +tLpeVti7lN9/04IW7XHyxuhvS71V+JWlqfu3zboyaVoMIlHDrPFtRiAh7vTTjQID +AQABo4HMMIHJMB0GA1UdDgQWBBQrVExlI4rixsrub6IMDDsLPNB4ezCBmQYDVR0j +BIGRMIGOgBQrVExlI4rixsrub6IMDDsLPNB4e6FjpGEwXzELMAkGA1UEBhMCQVUx EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29tghEA11WP2vXxEFuyEygr -cHcpozAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAKNpIrzTOxIykKZt -EE6HU2nW1lrWUkIMjwjL8ntw7QI4JLMDN1ADVIxWaGTeQ+U/eXFou6dDNAYVAijK -ONDXgOItxW2YvSw0wOZsZj6INX2x88/0yRH+19TqaL/r+Y1D1h/0zefkHgfXufnY -Ex7BHju/rGBTp6R1mr+Tlh1tewva +cHcpozAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAFB5SF2ujZzH9KMj +m4ZDTsyy94/YQZdwgLncKUYTxmZe4BdX+42j799pCG+UeQGwqz9hU/soPgibAvGT +1KCEGQ6qtWSqKJYmC8VKenYvvEFIySj5cbSFmId5aNwhjl8AYoLuM0E+2FRVJQ6a +pWyzYUIOqhsCkt9hEPsDVP4hIhP+ -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem index 64c7d41..53761bb 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem @@ -2,18 +2,18 @@ MIIDDzCCA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fMQswCQYDVQQGEwJBVTET MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb22CEDkqQ08OB98fiqMF3jTg -wikwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQAZyo0Q3leeM1+lxeCd -Wp0ZYHMSW11ANc6nuMWOmJC+nIQGlyGiP3IqeUvIfekwboV638bahVPwcl2HYWsS -/l01Bgyd25Zn6VTQBfMK01dILyxscjVwdHuojzYBN05sl+qkVoqQr5EroQQbgDc9 -6I88p6Kjajv3IusCwfK6wlqISw== +wikwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQA3eZG/dOXrL7YBPCA8 +joDGfhra98T1iCpul4/L/L4dt/9+QVAu+agbZmHWLYzuAvuB1zj8go0BLIE7b4ap +HPLFYXV3iAWjIRhNEix4FWohlds1B+IwpvWdsl3Op1pZfHQ0yq8wFGawdQTAKUII +lLu1cd6E8B6pCfWwSr+9h6gnTg== -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem index c7ddbf2..81211ee 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem @@ -2,18 +2,18 @@ MIIDDzCCAnigAwIBAgIQPnXO1GtpMCEhiDCuhqgqcTANBgkqhkiG9w0BAQUFADBf MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20w -HhcNMTEwMzI0MTMwOTQ4WhcNMTEwNDIzMTMwOTQ4WjBfMQswCQYDVQQGEwJBVTET +HhcNMTEwODMwMTAyMTQ4WhcNMjEwODI3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ROhU2u8wHub+hGGds18Fx6F4yZjdh8pNUoOUR9A0Ym+VDJr2p50oUNTTy0RbH8 -9ns/gbemx84cjF9DD2G5stQhYg== +KnEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCOeih7N7fmkqECWZD/ +bYsFLtbKOwD4YMPIV2wayvaLg2dFwqhBkGml+5ulOh5KTiUh0/nnGmGAU/3K9nt5 +TCMjwMGHm/C5pp7THQriiY8Qw0QVtnFiJGnjblhAbJVIvBJJ42/Qq7T4IzEwqShW +hO2g1M0MUGiOw4vyXJRGc4dg2w== -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem index bc2be2a..4264a67 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem @@ -2,18 +2,18 @@ MIIDETCCAnqgAwIBAgIRAOkCi5V45BXcGnEKK4gVREcwDQYJKoZIhvcNAQEFBQAw XzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29t -MB4XDTExMDMyNDEzMTAxNloXDTExMDQyMzEzMTAxNlowXzELMAkGA1UEBhMCQVUx +MB4XDTExMDgzMDEwMjIxOFoXDTIxMDgyNzEwMjIxOFowXzELMAkGA1UEBhMCQVUx EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29tMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQDFq06qqRl86pP7GRX3m7FMMSaSU6zlNGAo+WPoRfYAzB6x -5KpvlfxMCo3T/nWtInX3Bw9TBWCZSweQ2GEjggO0irjw5UX3MiToLxK+r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pA8o3p462ON4S+GXTfOLfoN -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem index 19d4353..03ab7d4 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem @@ -2,18 +2,18 @@ MIIDGjCCAoOgAwIBAgIRAJI51TSPQNFpWnRUcOHyP0MwDQYJKoZIhvcNAQEFBQAw YjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEu -b3JnMB4XDTExMDMyNDEzMTA0NFoXDTExMDQyMzEzMTA0NFowYjELMAkGA1UEBhMC +b3JnMB4XDTExMDgzMDEwMjIzOVoXDTIxMDgyNzEwMjIzOVowYjELMAkGA1UEBhMC QVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdp dHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEub3JnMIGfMA0GCSqG -SIb3DQEBAQUAA4GNADCBiQKBgQC1lsoAcZTwF8Pf0E9do5avLdobB/O7EhhrCMs2 -/EMO07aIlrLwl3UP/Fmu/cAkKuX8Mx+Eif9x+XT3ZqGKGYKiqPTJcNfeZvgwbn0j -wXDtEo4DuURrwtBU9okS+v4dF6F4RtHQKAGcsXoOjhR7ah71kve+PG2GG0sJ167V -klK1xwIDAQABo4HPMIHMMB0GA1UdDgQWBBRgGDJ4Qp0WFyLIzm4Nz5wgqDSSxjCB -nAYDVR0jBIGUMIGRgBRgGDJ4Qp0WFyLIzm4Nz5wgqDSSxqFmpGQwYjELMAkGA1UE +SIb3DQEBAQUAA4GNADCBiQKBgQC9Yo3DJvs+vewelK5qoK+0Xn4zeRIQ/wJCrQBg +5tNXja+NZsHb0/enlwAZ3dAwCfI0G12mTowgSuZyDX7oN2+G+k6Q5LPnGhj1E5s5 +OJ+ZYsAjTdU0SCAPquva55+jyhqo5w/B5Il7w84mppUrAZgqEGhYkhXeDOULe1Vm +4iLMQwIDAQABo4HPMIHMMB0GA1UdDgQWBBSb8lAIgOnUitVOuZIx3s+5MN1sBzCB +nAYDVR0jBIGUMIGRgBSb8lAIgOnUitVOuZIx3s+5MN1sB6FmpGQwYjELMAkGA1UE BhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdp ZGdpdHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEub3JnghEAkjnV -NI9A0WladFRw4fI/QzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACeE -DHMQ+LWEuoa/6z2EgrgM1k9rvBbUtCR+rjTuyzVW4OLXdpiVwZPOAiKphpq7q8Sb -TQ3zwsCoPLLJk5VolwcPfcD8Y2/tYK3NCYl+HzGxxnzPDFVaZM5Jh8RI861Hc00D -hVoQaptPK/V/lr0KEevqjhusAdFZbwlWA923zASa +NI9A0WladFRw4fI/QzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAFpg +tcp6ynOZ/hwr2axTYK+4rtXmTUJdsg7NUHhXSwGANAuYuc7PYwqtmz3B2W90t3TA +D3pNMRBEXrBXufC0p9vu/hQgb+mdQ7DG6j1Gkkpq4Sq/Puv1bO96KpAufmevnWWB +48kzCgAdfk/N04k7kdPHCp5MjjgmY3kGdsg+jroj -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem index aedf3f7..acef06f 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem @@ -2,18 +2,18 @@ MIIDDjCCAnegAwIBAgIRALC3Ez7Ql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kFVMRMw EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 eSBMdGQxFzAVBgNVBAMTDmxvZ2luLmxpdmUuY29tghEAsLcTPtCW+bVvrpHIdL06 -wDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAMNzIStXDNSNQ8ayxrcj -4RrUMsHWUG/6XPrgfYqCP5TfPGAa5qBfNb9LfUbiS4b0flJVN1RlHVwwRo0yf9v4 -LGg0dSuPQAOWlLeUR1GminO1jHZw7E4dYfR7QEmiiOgaQU+CbxLsf5vCaKInN9Gu -jv/5xytVCbMoLoZ4EBVb0tka +wDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACQqnu1KywflnNiqIU01 +95z/qjmZTvSWafM/HLOFUg8ls7g32l5gCCrsc8ypiCff+S3+9teYQOII7oW3hzw4 +BH10m0LTRxGig5U9XVkH4076SALkPoky1z+onMmLk7AE96kSJ+rq30VvcSSl9BaW +DwcQGIhCZANgZrNW9AJ+cweQ -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem index d179b29..cc99b08 100644 --- a/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem @@ -2,18 +2,18 @@ MIIDDjCCAnegAwIBAgIRANjzX063hystqwaS4xU4L7AwDQYJKoZIhvcNAQEFBQAw XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMOZ2xvYmFsIHRydXN0ZWUw -HhcNMTEwMzI0MTMxMTM3WhcNMTEwNDIzMTMxMTM3WjBeMQswCQYDVQQGEwJBVTET +HhcNMTEwODMwMTAyMzI1WhcNMjEwODI3MTAyMzI1WjBeMQswCQYDV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u6ygiyI1ImRKq2/MvJx/kaKh6IiXanB5nW1U+fhDV6kMOEfpwV -i6FBibpHboPQoqzPPRe7qHSL +sDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALvmmUx47DcUAIsPkI0Y +DTvcXV6k2JHwdrdlPsrn9A5TLppfxPNrDMiweitr8cMkKEtkm6LRTt2yvDFcMIwy +/+F5+XO0k9sKde6xHfWvOvndIycj3Lt4tIRW8jUauJENyMa4M57qpqkgkJEmflkI +/pb9fQZbfg70o9wvbNK0RONo -----END CERTIFICATE----- diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index 2edb93a..c9d4ba4 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -69,13 +69,7 @@ class tst_QTemporaryFile : public QObject { Q_OBJECT -public: - tst_QTemporaryFile(); - virtual ~tst_QTemporaryFile(); public slots: - void init(); - void cleanup(); - void initTestCase(); void cleanupTestCase(); @@ -100,22 +94,17 @@ private slots: void resetTemplateAfterError(); void setTemplateAfterOpen(); void autoRemoveAfterFailedRename(); - - void QTBUG_4796_data(); - void QTBUG_4796(); - -public: }; void tst_QTemporaryFile::initTestCase() { - // For QTBUG_4796 + // For fileTemplate tests QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); } void tst_QTemporaryFile::cleanupTestCase() { - // From QTBUG_4796 + // From fileTemplate tests QVERIFY(QDir().rmdir("test-XXXXXX")); } @@ -139,76 +128,6 @@ void tst_QTemporaryFile::getSetCheck() QCOMPARE(true, obj1.autoRemove()); } -tst_QTemporaryFile::tst_QTemporaryFile() -{ -} - -tst_QTemporaryFile::~tst_QTemporaryFile() -{ - -} - -void tst_QTemporaryFile::init() -{ -// TODO: Add initialization code here. -// This will be executed immediately before each test is run. -} - -void tst_QTemporaryFile::cleanup() -{ -// TODO: Add cleanup code here. -// This will be executed immediately after each test is run. -} - -void tst_QTemporaryFile::fileTemplate_data() -{ - QTest::addColumn<QString>("constructorTemplate"); - QTest::addColumn<QString>("prefix"); - QTest::addColumn<QString>("suffix"); - QTest::addColumn<QString>("fileTemplate"); - - QTest::newRow("constructor default") << "" << "." << "" << ""; - QTest::newRow("constructor with xxx sufix") << "qt_XXXXXXxxx" << "qt_" << "xxx" << ""; - QTest::newRow("constructor with xXx sufix") << "qt_XXXXXXxXx" << "qt_" << "xXx" << ""; - QTest::newRow("constructor with no sufix") << "qt_XXXXXX" << "qt_" << "" << ""; - QTest::newRow("constructor with >6 X's and xxx suffix") << "qt_XXXXXXXXXXxxx" << "qt_" << "xxx" << ""; - QTest::newRow("constructor with >6 X's, no suffix") << "qt_XXXXXXXXXX" << "qt_" << "" << ""; - - QTest::newRow("constructor with XXXX suffix") << "qt_XXXXXX_XXXX" << "qt_" << "_XXXX" << ""; - QTest::newRow("constructor with XXXXX suffix") << "qt_XXXXXX_XXXXX" << "qt_" << "_XXXXX" << ""; - QTest::newRow("constructor with XXXX prefix") << "qt_XXXX" << "qt_XXXX." << "" << ""; - QTest::newRow("constructor with XXXXX prefix") << "qt_XXXXX" << "qt_XXXXX." << "" << ""; - QTest::newRow("constructor with XXXX prefix and suffix") << "qt_XXXX_XXXXXX_XXXX" << "qt_XXXX_" << "_XXXX" << ""; - QTest::newRow("constructor with XXXXX prefix and suffix") << "qt_XXXXX_XXXXXX_XXXXX" << "qt_XXXXX_" << "_XXXXX" << ""; - - QTest::newRow("set template, no suffix") << "" << "foo" << "" << "foo"; - QTest::newRow("set template, with lowercase XXXXXX") << "" << "qt_" << "xxxxxx" << "qt_XXXXXXxxxxxx"; - QTest::newRow("set template, with xxx") << "" << "qt_" << ".xxx" << "qt_XXXXXX.xxx"; - QTest::newRow("set template, with >6 X's") << "" << "qt_" << ".xxx" << "qt_XXXXXXXXXXXXXX.xxx"; - QTest::newRow("set template, with >6 X's, no suffix") << "" << "qt_" << "" << "qt_XXXXXXXXXXXXXX"; -} - -void tst_QTemporaryFile::fileTemplate() -{ - QFETCH(QString, constructorTemplate); - QFETCH(QString, prefix); - QFETCH(QString, suffix); - QFETCH(QString, fileTemplate); - - QTemporaryFile file(constructorTemplate); - if (!fileTemplate.isEmpty()) - file.setFileTemplate(fileTemplate); - - QCOMPARE(file.open(), true); - - if (prefix.length()) - QCOMPARE(file.fileName().left(prefix.length()), prefix); - - if (suffix.length()) - QCOMPARE(file.fileName().right(suffix.length()), suffix); -} - - /* This tests whether the temporary file really gets placed in QDir::tempPath */ @@ -411,11 +330,11 @@ void tst_QTemporaryFile::rename() { QTemporaryFile file(dir.filePath("temporary-file.XXXXXX")); - QVERIFY(file.open()); + QVERIFY2(file.open(), qPrintable(file.errorString())); tempname = file.fileName(); QVERIFY(dir.exists(tempname)); - QVERIFY(file.rename("temporary-file.txt")); + QVERIFY2(file.rename("temporary-file.txt"), qPrintable(file.errorString())); QVERIFY(!dir.exists(tempname)); QVERIFY(dir.exists("temporary-file.txt")); QCOMPARE(file.fileName(), QString("temporary-file.txt")); @@ -622,7 +541,7 @@ void tst_QTemporaryFile::autoRemoveAfterFailedRename() cleaner.reset(); } -void tst_QTemporaryFile::QTBUG_4796_data() +void tst_QTemporaryFile::fileTemplate_data() { QTest::addColumn<QString>("prefix"); QTest::addColumn<QString>("suffix"); @@ -631,15 +550,33 @@ void tst_QTemporaryFile::QTBUG_4796_data() QString unicode = QString::fromUtf8("\xc3\xa5\xc3\xa6\xc3\xb8"); QTest::newRow("<empty>") << QString() << QString() << true; + + QTest::newRow(".") << QString(".") << QString() << true; + QTest::newRow("..") << QString("..") << QString() << true; + + QTest::newRow("foo") << QString("foo") << QString() << true; + QTest::newRow("qt_ ... xxxxxx") << QString("qt_") << QString("xxxxxx") << true; + QTest::newRow("qt_ ... xxx") << QString("qt_") << QString("xxx") << true; + QTest::newRow("qt_ ... xXx") << QString("qt_") << QString("xXx") << true; + QTest::newRow("qt_ ...") << QString("qt_") << QString() << true; + QTest::newRow("qt_ ... _XXXX") << QString("qt_") << QString("_XXXX") << true; + QTest::newRow("qt_ ... _XXXXX") << QString("qt_") << QString("_XXXXX") << true; + QTest::newRow("qt_XXXX_ ...") << QString("qt_XXXX_") << QString() << true; + QTest::newRow("qt_XXXXX_ ...") << QString("qt_XXXXX_") << QString() << true; + QTest::newRow("qt_XXXX_ ... _XXXX") << QString("qt_XXXX_") << QString("_XXXX") << true; + QTest::newRow("qt_XXXXX_ ... _XXXXX") << QString("qt_XXXXX_") << QString("_XXXXX") << true; + QTest::newRow("blaXXXXXX") << QString("bla") << QString() << true; QTest::newRow("XXXXXXbla") << QString() << QString("bla") << true; + QTest::newRow("does-not-exist/qt_temp.XXXXXX") << QString("does-not-exist/qt_temp") << QString() << false; + QTest::newRow("XXXXXX<unicode>") << QString() << unicode << true; QTest::newRow("<unicode>XXXXXX") << unicode << QString() << true; QTest::newRow("<unicode>XXXXXX<unicode>") << unicode << unicode << true; } -void tst_QTemporaryFile::QTBUG_4796() +void tst_QTemporaryFile::fileTemplate() { QVERIFY(QDir("test-XXXXXX").exists()); @@ -665,25 +602,56 @@ void tst_QTemporaryFile::QTBUG_4796() QFETCH(QString, suffix); QFETCH(bool, openResult); + enum IterationType { + UseConstructor, + UseSetFileTemplate, + Done + }; + + for (IterationType setFileTemplate = UseConstructor; setFileTemplate != Done; + setFileTemplate = IterationType(int(setFileTemplate) + 1)) { + Q_FOREACH(QString const &tempName, cleaner.tempNames) + QVERIFY( !QFile::exists(tempName) ); + + cleaner.reset(); + QString fileTemplate1 = prefix + QString("XX") + suffix; QString fileTemplate2 = prefix + QString("XXXX") + suffix; QString fileTemplate3 = prefix + QString("XXXXXX") + suffix; QString fileTemplate4 = prefix + QString("XXXXXXXX") + suffix; - QTemporaryFile file1(fileTemplate1); - QTemporaryFile file2(fileTemplate2); - QTemporaryFile file3(fileTemplate3); - QTemporaryFile file4(fileTemplate4); - QTemporaryFile file5("test-XXXXXX/" + fileTemplate1); - QTemporaryFile file6("test-XXXXXX/" + fileTemplate3); + QTemporaryFile file1(setFileTemplate ? QString() : fileTemplate1); + QTemporaryFile file2(setFileTemplate ? QString() : fileTemplate2); + QTemporaryFile file3(setFileTemplate ? QString() : fileTemplate3); + QTemporaryFile file4(setFileTemplate ? QString() : fileTemplate4); + QTemporaryFile file5(setFileTemplate ? QString() : "test-XXXXXX/" + fileTemplate1); + QTemporaryFile file6(setFileTemplate ? QString() : "test-XXXXXX/" + fileTemplate3); + + if (setFileTemplate) { + file1.setFileTemplate(fileTemplate1); + file2.setFileTemplate(fileTemplate2); + file3.setFileTemplate(fileTemplate3); + file4.setFileTemplate(fileTemplate4); + file5.setFileTemplate("test-XXXXXX/" + fileTemplate1); + file6.setFileTemplate("test-XXXXXX/" + fileTemplate3); + } - QCOMPARE(file1.open(), openResult); - QCOMPARE(file2.open(), openResult); - QCOMPARE(file3.open(), openResult); - QCOMPARE(file4.open(), openResult); - QCOMPARE(file5.open(), openResult); - QCOMPARE(file6.open(), openResult); + if (openResult) { + QVERIFY2(file1.open(), qPrintable(file1.errorString())); + QVERIFY2(file2.open(), qPrintable(file2.errorString())); + QVERIFY2(file3.open(), qPrintable(file3.errorString())); + QVERIFY2(file4.open(), qPrintable(file4.errorString())); + QVERIFY2(file5.open(), qPrintable(file5.errorString())); + QVERIFY2(file6.open(), qPrintable(file6.errorString())); + } else { + QVERIFY(!file1.open()); + QVERIFY(!file2.open()); + QVERIFY(!file3.open()); + QVERIFY(!file4.open()); + QVERIFY(!file5.open()); + QVERIFY(!file6.open()); + } QCOMPARE(file1.exists(), openResult); QCOMPARE(file2.exists(), openResult); @@ -701,28 +669,31 @@ void tst_QTemporaryFile::QTBUG_4796() << file5.fileName() << file6.fileName(); - QVERIFY(file1.fileName().startsWith(fileTemplate1 + QLatin1Char('.'))); - QVERIFY(file2.fileName().startsWith(fileTemplate2 + QLatin1Char('.'))); - QVERIFY(file5.fileName().startsWith("test-XXXXXX/" + fileTemplate1 + QLatin1Char('.'))); - QVERIFY(file6.fileName().startsWith("test-XXXXXX/" + prefix)); + QDir currentDir; + QString fileName1 = currentDir.relativeFilePath(file1.fileName()); + QString fileName2 = currentDir.relativeFilePath(file2.fileName()); + QString fileName3 = currentDir.relativeFilePath(file3.fileName()); + QString fileName4 = currentDir.relativeFilePath(file4.fileName()); + QString fileName5 = currentDir.relativeFilePath(file5.fileName()); + QString fileName6 = currentDir.relativeFilePath(file6.fileName()); + + QVERIFY2(fileName1.startsWith(fileTemplate1 + QLatin1Char('.')), qPrintable(file1.fileName())); + QVERIFY2(fileName2.startsWith(fileTemplate2 + QLatin1Char('.')), qPrintable(file2.fileName())); + QVERIFY2(fileName5.startsWith("test-XXXXXX/" + fileTemplate1 + QLatin1Char('.')), qPrintable(file5.fileName())); + QVERIFY2(fileName6.startsWith("test-XXXXXX/" + prefix), qPrintable(file6.fileName())); if (!prefix.isEmpty()) { - QVERIFY(file3.fileName().startsWith(prefix)); - QVERIFY(file4.fileName().startsWith(prefix)); + QVERIFY2(fileName3.startsWith(prefix), qPrintable(file3.fileName())); + QVERIFY2(fileName4.startsWith(prefix), qPrintable(file4.fileName())); } if (!suffix.isEmpty()) { - QVERIFY(file3.fileName().endsWith(suffix)); - QVERIFY(file4.fileName().endsWith(suffix)); - QVERIFY(file6.fileName().endsWith(suffix)); + QVERIFY2(fileName3.endsWith(suffix), qPrintable(file3.fileName())); + QVERIFY2(fileName4.endsWith(suffix), qPrintable(file4.fileName())); + QVERIFY2(fileName6.endsWith(suffix), qPrintable(file6.fileName())); } } } - - Q_FOREACH(QString const &tempName, cleaner.tempNames) - QVERIFY( !QFile::exists(tempName) ); - - cleaner.reset(); } QTEST_MAIN(tst_QTemporaryFile) diff --git a/tests/benchmarks/corelib/tools/qlist/main.cpp b/tests/benchmarks/corelib/tools/qlist/main.cpp new file mode 100644 index 0000000..22aaf49 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qlist/main.cpp @@ -0,0 +1,250 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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.1, 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QList> +#include <QTest> + +static const int N = 1000; + +struct MyBase +{ + MyBase(int i_) + : isCopy(false) + { + ++liveCount; + + i = i_; + } + + MyBase(const MyBase &other) + : isCopy(true) + { + if (isCopy) + ++copyCount; + ++liveCount; + + i = other.i; + } + + MyBase &operator=(const MyBase &other) + { + if (!isCopy) { + isCopy = true; + ++copyCount; + } else { + ++errorCount; + } + + i = other.i; + return *this; + } + + ~MyBase() + { + if (isCopy) { + if (!copyCount) + ++errorCount; + else + --copyCount; + } + if (!liveCount) + ++errorCount; + else + --liveCount; + } + + bool operator==(const MyBase &other) const + { return i == other.i; } + +protected: + ushort i; + bool isCopy; + +public: + static int errorCount; + static int liveCount; + static int copyCount; +}; + +int MyBase::errorCount = 0; +int MyBase::liveCount = 0; +int MyBase::copyCount = 0; + +struct MyPrimitive : public MyBase +{ + MyPrimitive(int i = -1) : MyBase(i) + { ++errorCount; } + MyPrimitive(const MyPrimitive &other) : MyBase(other) + { ++errorCount; } + ~MyPrimitive() + { ++errorCount; } +}; + +struct MyMovable : public MyBase +{ + MyMovable(int i = -1) : MyBase(i) {} +}; + +struct MyComplex : public MyBase +{ + MyComplex(int i = -1) : MyBase(i) {} +}; + +QT_BEGIN_NAMESPACE + +Q_DECLARE_TYPEINFO(MyPrimitive, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(MyMovable, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(MyComplex, Q_COMPLEX_TYPE); + +QT_END_NAMESPACE + + +class tst_QList: public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void removeAll_primitive_data(); + void removeAll_primitive(); + void removeAll_movable_data(); + void removeAll_movable(); + void removeAll_complex_data(); + void removeAll_complex(); +}; + +template <class T> +void removeAll_test(const QList<int> &i10, ushort valueToRemove, int itemsToRemove) +{ + bool isComplex = QTypeInfo<T>::isComplex; + + MyBase::errorCount = 0; + MyBase::liveCount = 0; + MyBase::copyCount = 0; + { + QList<T> list; + QCOMPARE(MyBase::liveCount, 0); + QCOMPARE(MyBase::copyCount, 0); + + for (int i = 0; i < 10 * N; ++i) { + T t(i10.at(i % 10)); + list.append(t); + } + QCOMPARE(MyBase::liveCount, isComplex ? list.size() : 0); + QCOMPARE(MyBase::copyCount, isComplex ? list.size() : 0); + + T t(valueToRemove); + QCOMPARE(MyBase::liveCount, isComplex ? list.size() + 1 : 1); + QCOMPARE(MyBase::copyCount, isComplex ? list.size() : 0); + + int removedCount; + QList<T> l; + + QBENCHMARK { + l = list; + removedCount = l.removeAll(t); + } + QCOMPARE(removedCount, itemsToRemove * N); + QCOMPARE(l.size() + removedCount, list.size()); + QVERIFY(!l.contains(valueToRemove)); + + QCOMPARE(MyBase::liveCount, isComplex ? l.isDetached() ? list.size() + l.size() + 1 : list.size() + 1 : 1); + QCOMPARE(MyBase::copyCount, isComplex ? l.isDetached() ? list.size() + l.size() : list.size() : 0); + } + if (isComplex) + QCOMPARE(MyBase::errorCount, 0); +} + +Q_DECLARE_METATYPE(QList<int>); + +void tst_QList::removeAll_primitive_data() +{ + qRegisterMetaType<QList<int> >(); + + QTest::addColumn<QList<int> >("i10"); + QTest::addColumn<int>("valueToRemove"); + QTest::addColumn<int>("itemsToRemove"); + + QTest::newRow("0%") << (QList<int>() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0) << 5 << 0; + QTest::newRow("10%") << (QList<int>() << 0 << 0 << 0 << 0 << 5 << 0 << 0 << 0 << 0 << 0) << 5 << 1; + QTest::newRow("90%") << (QList<int>() << 5 << 5 << 5 << 5 << 0 << 5 << 5 << 5 << 5 << 5) << 5 << 9; + QTest::newRow("100%") << (QList<int>() << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5) << 5 << 10; +} + +void tst_QList::removeAll_primitive() +{ + QFETCH(QList<int>, i10); + QFETCH(int, valueToRemove); + QFETCH(int, itemsToRemove); + + removeAll_test<MyPrimitive>(i10, valueToRemove, itemsToRemove); +} + +void tst_QList::removeAll_movable_data() +{ + removeAll_primitive_data(); +} + +void tst_QList::removeAll_movable() +{ + QFETCH(QList<int>, i10); + QFETCH(int, valueToRemove); + QFETCH(int, itemsToRemove); + + removeAll_test<MyMovable>(i10, valueToRemove, itemsToRemove); +} + +void tst_QList::removeAll_complex_data() +{ + removeAll_primitive_data(); +} + +void tst_QList::removeAll_complex() +{ + QFETCH(QList<int>, i10); + QFETCH(int, valueToRemove); + QFETCH(int, itemsToRemove); + + removeAll_test<MyComplex>(i10, valueToRemove, itemsToRemove); +} + +QTEST_APPLESS_MAIN(tst_QList) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qlist/qlist.pro b/tests/benchmarks/corelib/tools/qlist/qlist.pro new file mode 100644 index 0000000..902e72e --- /dev/null +++ b/tests/benchmarks/corelib/tools/qlist/qlist.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +TARGET = tst_qlist +QT = core + +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/tools.pro b/tests/benchmarks/corelib/tools/tools.pro index 681a6c6..44e8973 100644 --- a/tests/benchmarks/corelib/tools/tools.pro +++ b/tests/benchmarks/corelib/tools/tools.pro @@ -3,6 +3,7 @@ SUBDIRS = \ containers-associative \ containers-sequential \ qbytearray \ + qlist \ qrect \ qregexp \ qstring \ |