diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-11-12 07:22:39 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-11-12 07:22:39 (GMT) |
commit | c785d92153d23b836451b0643424b9871bcc4be9 (patch) | |
tree | fce8119445f239a755bc9be654e6e8d086541285 /tests/auto | |
parent | fe0f807e1f4e7510c6d8cddd848bcbc25e358651 (diff) | |
parent | 118412e46f5b5af58eaa3012f9fb086894f9b5f2 (diff) | |
download | Qt-c785d92153d23b836451b0643424b9871bcc4be9.zip Qt-c785d92153d23b836451b0643424b9871bcc4be9.tar.gz Qt-c785d92153d23b836451b0643424b9871bcc4be9.tar.bz2 |
Merge commit 'upstream/4.6' into 4.6
Diffstat (limited to 'tests/auto')
22 files changed, 172 insertions, 74 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 1ec4c16..46f26f8 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -135,6 +135,7 @@ SUBDIRS += \ qfocusevent \ qfocusframe \ qfont \ + qfontcombobox \ qfontdatabase \ qfontdialog \ qfontmetrics \ diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp index 53eba32..5bd7a0a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp @@ -63,5 +63,20 @@ void FindDialog::reset() { tr("%n item(s)", "merge from singular to plural form", 4); tr("%n item(s)", "merge from a finished singular form to an unfinished plural form", 4); -} + + + //% "Hello" + qtTrId("xx_hello"); + + //% "New world" + qtTrId("xx_world"); + + + //= new_id + tr("this is just some text"); + + + //: A message without source string + qtTrId("qtn_virtual"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before index d06252c..379cce4 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before @@ -1,6 +1,23 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS><TS version="1.1" language="zh_CN"> <context> + <name></name> + <message id="xx_hello"> + <location filename="finddialog.cpp" line="70"/> + <source>Hello</source> + <translation>Hallo</translation> + </message> + <message id="xx_world"> + <location filename="finddialog.cpp" line="73"/> + <source>World</source> + <translation>Welt</translation> + </message> + <message id="qtn_virtual"> + <location filename="finddialog.cpp" line="79"/> + <extracomment>A message without source string</extracomment> + </message> +</context> +<context> <name>FindDialog</name> <message> <source></source> @@ -44,5 +61,10 @@ <numerusform></numerusform> </translation> </message> + <message> + <location filename="finddialog.cpp" line="59"/> + <source>this is just some text</source> + <translation type="unfinished">Unfertige Uebersetzung</translation> + </message> </context> </TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result index be4e02e..de43266 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result @@ -2,6 +2,26 @@ <!DOCTYPE TS> <TS version="2.0" language="zh_CN"> <context> + <name></name> + <message id="xx_hello"> + <location filename="finddialog.cpp" line="70"/> + <source>Hello</source> + <translation>Hallo</translation> + </message> + <message id="xx_world"> + <location filename="finddialog.cpp" line="73"/> + <source>New world</source> + <oldsource>World</oldsource> + <translation type="unfinished">Welt</translation> + </message> + <message id="qtn_virtual"> + <location filename="finddialog.cpp" line="81"/> + <source></source> + <extracomment>A message without source string</extracomment> + <translation></translation> + </message> +</context> +<context> <name>FindDialog</name> <message> <source></source> @@ -45,5 +65,10 @@ <numerusform></numerusform> </translation> </message> + <message id="new_id"> + <location filename="finddialog.cpp" line="77"/> + <source>this is just some text</source> + <translation type="unfinished">Unfertige Uebersetzung</translation> + </message> </context> </TS> 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 e1464a2..9abb367 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp @@ -148,4 +148,7 @@ void FindDialog::doFind(bool forward) bool FindDialog::hasFindExpression() const { // statusMessage(tr( "Should be obsolete" )); + + //% "This is some random text" + qtTrId("keep_id") } diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before index 834f512..feab169 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before @@ -1,6 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS><TS version="1.1"> <context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="153"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> + <message id="obsolete_id"> + <location filename="finddialog.cpp" line="155"/> + <source>Should be obsolete, too</source> + <translation type="unfinished">SHOULD BE OBSOLETE AS WELL</translation> + </message> +</context> +<context> <name>FindDialog</name> <message> <location filename="finddialog.cpp" line="85"/> 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 b328e90..ee3d0f6 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 @@ -2,6 +2,14 @@ <!DOCTYPE TS> <TS version="2.0"> <context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="153"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>FindDialog</name> <message> <location filename="finddialog.cpp" line="85"/> 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 7b28c75..cc3af48 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp @@ -150,6 +150,9 @@ void FindDialog::doFind(bool forward) bool FindDialog::hasFindExpression() const { + //% "This is some random text" + qtTrId("keep_id") + return !findExpr.isEmpty(); } diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before index 1fa0fd3..2bc6049 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before @@ -1,6 +1,19 @@ <?xml version="1.0"?> <!DOCTYPE TS><TS version="1.1"> <context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="154"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> + <message id="obsolete_id"> + <location filename="finddialog.cpp" line="155"/> + <source>Should be obsolete, too</source> + <translation type="unfinished">SHOULD BE OBSOLETE AS WELL</translation> + </message> +</context> +<context> <name>FindDialog</name> <message> <location filename="finddialog.cpp" line="85"/> 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 cfd11b1..f442cbc 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 @@ -2,6 +2,18 @@ <!DOCTYPE TS> <TS version="2.0"> <context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="154"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> + <message id="obsolete_id"> + <source>Should be obsolete, too</source> + <translation type="obsolete">SHOULD BE OBSOLETE AS WELL</translation> + </message> +</context> +<context> <name>FindDialog</name> <message> <source>Enter the text you are looking for.</source> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index e243e66..386d9b7 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -247,3 +247,8 @@ class YetAnotherTest : QObject { tr("nothing"); } }; + + + +//: This is a message without a source string +QString test = qtTrId("yet_another_id"); 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 26e5a65..6d50c21 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -18,6 +18,12 @@ backslashed \ stuff.</source> </translation> <extra-some>thing</extra-some> </message> + <message id="yet_another_id"> + <location filename="main.cpp" line="254"/> + <source></source> + <extracomment>This is a message without a source string</extracomment> + <translation type="unfinished"></translation> + </message> </context> <context> <name>Dialog2</name> diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 18ebddc..cc59b62 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2517,8 +2517,8 @@ void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated() cb.addItem("1"); cb.addItem("2"); QLineEdit edit; - layout.add(&cb); - layout.add(&edit); + layout.addWidget(&cb); + layout.addWidget(&edit); w.show(); QTest::qWaitForWindowShown(&w); diff --git a/tests/auto/qdatastream/qdatastream.pro b/tests/auto/qdatastream/qdatastream.pro index 5b90357..c132073 100644 --- a/tests/auto/qdatastream/qdatastream.pro +++ b/tests/auto/qdatastream/qdatastream.pro @@ -12,7 +12,7 @@ QT += svg wince*: { - addFiles.sources = datastream.q42 gearflowers.svg + addFiles.sources = datastream.q42 tests2.svg addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index 7535645..24447ea 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -320,8 +320,7 @@ void tst_QDataStream::getSetCheck() tst_QDataStream::tst_QDataStream() { - svgFile = QLatin1String(SRCDIR) + QLatin1String("/") + - QLatin1String(SVGFILE); + svgFile = QLatin1String(SRCDIR SVGFILE); } tst_QDataStream::~tst_QDataStream() diff --git a/tests/auto/qfile/largefile/largefile.pro b/tests/auto/qfile/largefile/largefile.pro index 0f96865..d67cb46 100644 --- a/tests/auto/qfile/largefile/largefile.pro +++ b/tests/auto/qfile/largefile/largefile.pro @@ -2,3 +2,5 @@ load(qttest_p4) QT = core SOURCES += tst_largefile.cpp + +wince*: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp index 9105063..980f4ba 100644 --- a/tests/auto/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -54,7 +54,10 @@ #ifdef Q_OS_WIN #include <windows.h> + +#ifndef Q_OS_WINCE #include <io.h> +#endif #ifndef FSCTL_SET_SPARSE // MinGW doesn't define this. @@ -295,7 +298,7 @@ void tst_LargeFile::sparseFileData() void tst_LargeFile::createSparseFile() { -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN32) // On Windows platforms, we must explicitly set the file to be sparse, // so disk space is not allocated for the full file when writing to it. HANDLE handle = ::CreateFileA("qt_largefile.tmp", @@ -313,7 +316,7 @@ void tst_LargeFile::createSparseFile() int fd = ::_open_osfhandle((intptr_t)handle, 0); QVERIFY( -1 != fd ); QVERIFY( largeFile.open(fd, QIODevice::WriteOnly | QIODevice::Unbuffered) ); -#else // !Q_OS_WIN +#else // !Q_OS_WIN32 largeFile.setFileName("qt_largefile.tmp"); QVERIFY( largeFile.open(QIODevice::WriteOnly | QIODevice::Unbuffered) ); #endif @@ -321,13 +324,13 @@ void tst_LargeFile::createSparseFile() void tst_LargeFile::closeSparseFile() { -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN32) int fd = largeFile.handle(); #endif largeFile.close(); -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN32) if (-1 != fd) ::_close(fd); #endif diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro index 46f63b3..faaa927 100644 --- a/tests/auto/qfile/test/test.pro +++ b/tests/auto/qfile/test/test.pro @@ -14,6 +14,7 @@ wince*|symbian { } wince* { + SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp # needed for QT_OPEN DEFINES += SRCDIR=\\\"\\\" } else:symbian { # do not define SRCDIR at all diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index b40cf43..d216924 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -49,6 +49,7 @@ #include <QtGui/qstyleoption.h> #include "../../shared/util.h" +#include <private/qgraphicseffect_p.h> //TESTED_CLASS= //TESTED_FILES= @@ -131,16 +132,16 @@ public: int margin() const { return m_margin; } - void draw(QPainter *painter, QGraphicsEffectSource *source) + void draw(QPainter *painter) { ++numRepaints; if (doNothingInDraw) return; - m_source = source; + m_source = source(); m_painter = painter; - m_styleOption = source->styleOption(); + m_styleOption = source()->styleOption(); m_opacity = painter->opacity(); - source->draw(painter); + drawSource(painter); } void sourceChanged(QGraphicsEffect::ChangeFlags flags) diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index 55294d5..9991ab4 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -46,6 +46,8 @@ #include <QtGui/qgraphicsitem.h> #include <QtGui/qstyleoption.h> +#include <private/qgraphicseffect_p.h> + //TESTED_CLASS= //TESTED_FILES= @@ -54,13 +56,12 @@ class CustomItem : public QGraphicsRectItem public: CustomItem(qreal x, qreal y, qreal width, qreal height) : QGraphicsRectItem(x, y, width, height), numRepaints(0), - m_painter(0), m_styleOption(0) + m_painter(0) {} void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { m_painter = painter; - m_styleOption = option; ++numRepaints; QGraphicsRectItem::paint(painter, option, widget); } @@ -69,12 +70,10 @@ public: { numRepaints = 0; m_painter = 0; - m_styleOption = 0; } int numRepaints; QPainter *m_painter; - const QStyleOption *m_styleOption; }; class CustomEffect : public QGraphicsEffect @@ -84,7 +83,7 @@ public: : QGraphicsEffect(), numRepaints(0), m_margin(10), m_sourceChanged(false), m_sourceBoundingRectChanged(false), doNothingInDraw(false), storeDeviceDependentStuff(false), - m_painter(0), m_styleOption(0), m_source(0) + m_painter(0), m_source(0) {} QRectF boundingRectFor(const QRectF &rect) const @@ -96,7 +95,6 @@ public: m_sourceChanged = false; m_sourceBoundingRectChanged = false; m_painter = 0; - m_styleOption = 0; m_source = 0; deviceCoordinatesPixmap = QPixmap(); deviceRect = QRect(); @@ -112,20 +110,19 @@ public: int margin() const { return m_margin; } - void draw(QPainter *painter, QGraphicsEffectSource *source) + void draw(QPainter *painter) { ++numRepaints; if (storeDeviceDependentStuff) { - deviceCoordinatesPixmap = source->pixmap(Qt::DeviceCoordinates); - deviceRect = source->deviceRect(); - sourceDeviceBoundingRect = source->boundingRect(Qt::DeviceCoordinates); + deviceCoordinatesPixmap = source()->pixmap(Qt::DeviceCoordinates); + deviceRect = QRect(0, 0, painter->device()->width(), painter->device()->height()); + sourceDeviceBoundingRect = source()->boundingRect(Qt::DeviceCoordinates); } if (doNothingInDraw) return; - m_source = source; + m_source = source(); m_painter = painter; - m_styleOption = source->styleOption(); - source->draw(painter); + source()->draw(painter); } void sourceChanged() @@ -141,7 +138,6 @@ public: bool doNothingInDraw; bool storeDeviceDependentStuff; QPainter *m_painter; - const QStyleOption *m_styleOption; QGraphicsEffectSource *m_source; QPixmap deviceCoordinatesPixmap; QRect deviceRect; @@ -227,8 +223,6 @@ void tst_QGraphicsEffectSource::styleOption() QTest::qWait(50); QCOMPARE(item->numRepaints, 1); QCOMPARE(effect->numRepaints, 1); - QVERIFY(effect->m_styleOption); - QCOMPARE(effect->m_styleOption, item->m_styleOption); } void tst_QGraphicsEffectSource::isPixmap() @@ -291,10 +285,6 @@ void tst_QGraphicsEffectSource::boundingRect() void tst_QGraphicsEffectSource::deviceRect() { - QTest::ignoreMessage(QtWarningMsg, "QGraphicsEffectSource::deviceRect: Not yet implemented, lacking device context"); - QCOMPARE(effect->source()->deviceRect(), QRect()); - - // We can at least check that the rect was correct in QGraphicsEffect::draw. effect->storeDeviceDependentStuff = true; effect->source()->update(); QTest::qWait(50); @@ -332,13 +322,13 @@ public: return src.adjusted(-10, -10, 10, 10); } - void draw(QPainter *, QGraphicsEffectSource *source) { - pix = source->pixmap(coordinateMode, &offset, padMode); + void draw(QPainter *) { + pix = source()->pixmap(coordinateMode, &offset, padMode); } QPixmap pix; QPoint offset; - QGraphicsEffectSource::PixmapPadMode padMode; + QGraphicsEffect::PixmapPadMode padMode; Qt::CoordinateSystem coordinateMode; }; @@ -351,32 +341,32 @@ void tst_QGraphicsEffectSource::pixmapPadding_data() QTest::addColumn<uint>("ulPixel"); QTest::newRow("log,nopad") << int(Qt::LogicalCoordinates) - << int(QGraphicsEffectSource::NoExpandPadMode) + << int(QGraphicsEffect::NoPad) << QSize(10, 10) << QPoint(0, 0) << 0xffff0000u; QTest::newRow("log,transparent") << int(Qt::LogicalCoordinates) - << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) + << int(QGraphicsEffect::PadToTransparentBorder) << QSize(14, 14) << QPoint(-2, -2) << 0x00000000u; QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates) - << int(QGraphicsEffectSource::ExpandToEffectRectPadMode) + << int(QGraphicsEffect::PadToEffectiveBoundingRect) << QSize(30, 30) << QPoint(-10, -10) << 0x00000000u; QTest::newRow("dev,nopad") << int(Qt::DeviceCoordinates) - << int(QGraphicsEffectSource::NoExpandPadMode) + << int(QGraphicsEffect::NoPad) << QSize(20, 20) << QPoint(40, 40) << 0xffff0000u; QTest::newRow("dev,transparent") << int(Qt::DeviceCoordinates) - << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) + << int(QGraphicsEffect::PadToTransparentBorder) << QSize(24, 24) << QPoint(38, 38) << 0x00000000u; QTest::newRow("dev,effectrect") << int(Qt::DeviceCoordinates) - << int(QGraphicsEffectSource::ExpandToEffectRectPadMode) + << int(QGraphicsEffect::PadToEffectiveBoundingRect) << QSize(40, 40) << QPoint(30, 30) << 0x00000000u; @@ -404,7 +394,7 @@ void tst_QGraphicsEffectSource::pixmapPadding() QFETCH(QSize, size); QFETCH(uint, ulPixel); - effect->padMode = (QGraphicsEffectSource::PixmapPadMode) padMode; + effect->padMode = (QGraphicsEffect::PixmapPadMode) padMode; effect->coordinateMode = (Qt::CoordinateSystem) coordinateMode; scene->render(&dummyPainter, scene->itemsBoundingRect(), scene->itemsBoundingRect()); diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index 5c6ed54..cb8f1e9 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -879,7 +879,7 @@ void tst_QListWidget::moveItemsPriv() for (int r = 0; r < rowCount; ++r) new QListWidgetItem(QString::number(r), testWidget); - QListModel *model = dynamic_cast<QListModel *>(testWidget->model()); + QListModel *model = qobject_cast<QListModel *>(testWidget->model()); QVERIFY(model); QSignalSpy beginMoveSpy(model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); QSignalSpy movedSpy(model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int))); diff --git a/tests/auto/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp index f319891..b99760e 100644 --- a/tests/auto/qscopedpointer/tst_qscopedpointer.cpp +++ b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp @@ -321,7 +321,7 @@ struct RefCounted instanceCount.ref(); } - RefCounted(RefCounted const &other) + RefCounted(RefCounted const &) : ref(0) { instanceCount.ref(); @@ -335,6 +335,7 @@ struct RefCounted RefCounted &operator=(RefCounted const &) { + return *this; } QAtomicInt ref; @@ -413,27 +414,6 @@ void tst_QScopedPointer::comparison() QCOMPARE( int(RefCounted::instanceCount), 0 ); { - // QCustomScopedPointer is an internal helper class -- it is unsupported! - - RefCounted *a = new RefCounted; - RefCounted *b = new RefCounted; - - QCOMPARE( int(RefCounted::instanceCount), 2 ); - - QCustomScopedPointer<RefCounted> pa1(a); - QCustomScopedPointer<RefCounted> pa2(a); - QCustomScopedPointer<RefCounted> pb(b); - - scopedPointerComparisonTest(pa1, pa2, pb); - - pa2.take(); - - QCOMPARE( int(RefCounted::instanceCount), 2 ); - } - - QCOMPARE( int(RefCounted::instanceCount), 0 ); - - { // QScopedSharedPointer is an internal helper class -- it is unsupported! RefCounted *a = new RefCounted; @@ -441,13 +421,9 @@ void tst_QScopedPointer::comparison() QCOMPARE( int(RefCounted::instanceCount), 2 ); - a->ref.ref(); - QScopedSharedPointer<RefCounted> pa1(a); - a->ref.ref(); - QScopedSharedPointer<RefCounted> pa2(a); - b->ref.ref(); - QScopedSharedPointer<RefCounted> pb(b); - + QSharedDataPointer<RefCounted> pa1(a); + QSharedDataPointer<RefCounted> pa2(a); + QSharedDataPointer<RefCounted> pb(b); QCOMPARE( int(a->ref), 2 ); QCOMPARE( int(b->ref), 1 ); |