qtbase tests: Remove QT_DISABLE_DEPRECATED_BEFORE=0 for simple cases.

Fix usage of API that is marked deprecated.

Change-Id: Ie31b6ee029c5b5f015fe52fb9bcd8e94b22d6cd0
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-08-24 13:35:22 +02:00
parent 1ca789bfe3
commit 50b9e30970
27 changed files with 32 additions and 45 deletions

View File

@ -7,4 +7,3 @@ INCLUDEPATH += $$PWD/$${mtdir}
QT += testlib QT += testlib
SOURCES += tst_qidentityproxymodel.cpp $${mtdir}/dynamictreemodel.cpp $${mtdir}/modeltest.cpp SOURCES += tst_qidentityproxymodel.cpp $${mtdir}/dynamictreemodel.cpp $${mtdir}/modeltest.cpp
HEADERS += $${mtdir}/dynamictreemodel.h $${mtdir}/modeltest.h HEADERS += $${mtdir}/dynamictreemodel.h $${mtdir}/modeltest.h
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -3,4 +3,3 @@ CONFIG += parallel_test
TARGET = tst_qitemselectionmodel TARGET = tst_qitemselectionmodel
QT += testlib QT += testlib
SOURCES += tst_qitemselectionmodel.cpp SOURCES += tst_qitemselectionmodel.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -1512,7 +1512,7 @@ class MyStandardItemModel: public QStandardItemModel
Q_OBJECT Q_OBJECT
public: public:
inline MyStandardItemModel(int i1, int i2): QStandardItemModel(i1, i2) {} inline MyStandardItemModel(int i1, int i2): QStandardItemModel(i1, i2) {}
inline void reset() { QStandardItemModel::reset(); } inline void reset() { beginResetModel(); endResetModel(); }
}; };
void tst_QItemSelectionModel::resetModel() void tst_QItemSelectionModel::resetModel()

View File

@ -8,4 +8,3 @@ mtdir = ../../../other/modeltest
INCLUDEPATH += $$PWD/$${mtdir} INCLUDEPATH += $$PWD/$${mtdir}
SOURCES += tst_qsortfilterproxymodel.cpp $${mtdir}/dynamictreemodel.cpp $${mtdir}/modeltest.cpp SOURCES += tst_qsortfilterproxymodel.cpp $${mtdir}/dynamictreemodel.cpp $${mtdir}/modeltest.cpp
HEADERS += $${mtdir}/dynamictreemodel.h $${mtdir}/modeltest.h HEADERS += $${mtdir}/dynamictreemodel.h $${mtdir}/modeltest.h
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -2581,7 +2581,7 @@ void tst_QSortFilterProxyModel::hiddenColumns()
public: public:
MyStandardItemModel() : QStandardItemModel(0,5) {} MyStandardItemModel() : QStandardItemModel(0,5) {}
void reset() void reset()
{ QStandardItemModel::reset(); } { beginResetModel(); endResetModel(); }
friend class tst_QSortFilterProxyModel; friend class tst_QSortFilterProxyModel;
} model; } model;
QSortFilterProxyModel proxy; QSortFilterProxyModel proxy;
@ -3377,7 +3377,10 @@ void tst_QSortFilterProxyModel::resetInvalidate()
{ {
switch (test) { switch (test) {
case 0: break; case 0: break;
case 1: reset(); break; case 1:
beginResetModel();
endResetModel();
break;
case 2: invalidate(); break; case 2: invalidate(); break;
case 3: invalidateFilter(); break; case 3: invalidateFilter(); break;
} }

View File

@ -8,4 +8,3 @@ QT += core-private gui-private
SOURCES += tst_qkeysequence.cpp SOURCES += tst_qkeysequence.cpp
RESOURCES += qkeysequence.qrc RESOURCES += qkeysequence.qrc
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -250,7 +250,7 @@ void tst_QKeySequence::operatorQString()
seq = QKeySequence( modifiers | keycode ); seq = QKeySequence( modifiers | keycode );
QCOMPARE( (QString)seq, keystring ); QCOMPARE( seq.toString(QKeySequence::NativeText), keystring );
} }
// this verifies that the constructors can handle the same strings in and out // this verifies that the constructors can handle the same strings in and out
@ -260,7 +260,7 @@ void tst_QKeySequence::symetricConstructors()
QFETCH( int, keycode ); QFETCH( int, keycode );
QKeySequence seq1( modifiers | keycode ); QKeySequence seq1( modifiers | keycode );
QKeySequence seq2( (QString)seq1 ); QKeySequence seq2( seq1.toString(QKeySequence::NativeText) );
QVERIFY( seq1 == seq2 ); QVERIFY( seq1 == seq2 );
} }

View File

@ -9,7 +9,6 @@ SOURCES += tst_qpainter.cpp
TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \ TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \
task217400.png task217400.png
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
android: !android-no-sdk { android: !android-no-sdk {
RESOURCES += \ RESOURCES += \

View File

@ -4487,7 +4487,7 @@ void tst_QPainter::QTBUG5939_attachPainterPrivate()
TestWidget *widget = new TestWidget(); TestWidget *widget = new TestWidget();
proxy->setWidget(widget); proxy->setWidget(widget);
scene->addItem(proxy); scene->addItem(proxy);
proxy->rotate(45); proxy->setTransform(QTransform().rotate(45));
w->resize(scene->sceneRect().size().toSize()); w->resize(scene->sceneRect().size().toSize());
w->show(); w->show();

View File

@ -5,6 +5,3 @@ QT += testlib
QT += core-private gui-private QT += core-private gui-private
qtHaveModule(widgets): QT += widgets qtHaveModule(widgets): QT += widgets
SOURCES += tst_qfont.cpp SOURCES += tst_qfont.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -504,7 +504,7 @@ void tst_QFont::isCopyOf()
void tst_QFont::insertAndRemoveSubstitutions() void tst_QFont::insertAndRemoveSubstitutions()
{ {
QFont::removeSubstitution("BogusFontFamily"); QFont::removeSubstitutions("BogusFontFamily");
// make sure it is empty before we start // make sure it is empty before we start
QVERIFY(QFont::substitutes("BogusFontFamily").isEmpty()); QVERIFY(QFont::substitutes("BogusFontFamily").isEmpty());
QVERIFY(QFont::substitutes("bogusfontfamily").isEmpty()); QVERIFY(QFont::substitutes("bogusfontfamily").isEmpty());
@ -521,7 +521,7 @@ void tst_QFont::insertAndRemoveSubstitutions()
QCOMPARE(QFont::substitutes("BogusFontFamily").count(), 3); QCOMPARE(QFont::substitutes("BogusFontFamily").count(), 3);
QCOMPARE(QFont::substitutes("bogusfontfamily").count(), 3); QCOMPARE(QFont::substitutes("bogusfontfamily").count(), 3);
QFont::removeSubstitution("BogusFontFamily"); QFont::removeSubstitutions("BogusFontFamily");
// make sure it is empty again // make sure it is empty again
QVERIFY(QFont::substitutes("BogusFontFamily").isEmpty()); QVERIFY(QFont::substitutes("BogusFontFamily").isEmpty());
QVERIFY(QFont::substitutes("bogusfontfamily").isEmpty()); QVERIFY(QFont::substitutes("bogusfontfamily").isEmpty());

View File

@ -4,4 +4,3 @@ win32:testcase.timeout = 1800 # test runtime varies greatly on Windows, QTBUG-
TARGET = tst_languagechange TARGET = tst_languagechange
QT += widgets core-private gui-private testlib QT += widgets core-private gui-private testlib
SOURCES += tst_languagechange.cpp SOURCES += tst_languagechange.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -253,7 +253,7 @@ void tst_languageChange::retranslatability()
switch (dialogType) { switch (dialogType) {
case InputDialog: case InputDialog:
stateMachine.start(); stateMachine.start();
QInputDialog::getInteger(0, QLatin1String("title"), QLatin1String("label")); QInputDialog::getInt(0, QLatin1String("title"), QLatin1String("label"));
break; break;
case ColorDialog: case ColorDialog:

View File

@ -299,7 +299,8 @@ bool ModelResetCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart
void ModelResetCommand::emitPostSignal() void ModelResetCommand::emitPostSignal()
{ {
m_model->reset(); m_model->beginResetModel();
m_model->endResetModel();
} }
ModelResetCommandFixed::ModelResetCommandFixed(DynamicTreeModel* model, QObject* parent) ModelResetCommandFixed::ModelResetCommandFixed(DynamicTreeModel* model, QObject* parent)

View File

@ -3,7 +3,3 @@ TARGET = tst_modeltest
QT += widgets testlib QT += widgets testlib
SOURCES += tst_modeltest.cpp modeltest.cpp dynamictreemodel.cpp SOURCES += tst_modeltest.cpp modeltest.cpp dynamictreemodel.cpp
HEADERS += modeltest.h dynamictreemodel.h HEADERS += modeltest.h dynamictreemodel.h
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -21,4 +21,3 @@ win32 {
LIBS += -luuid LIBS += -luuid
!winphone: LIBS += -loleacc -loleaut32 -lole32 !winphone: LIBS += -loleacc -loleaut32 -lole32
} }
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -1763,7 +1763,7 @@ void tst_QAccessibility::textEditTest()
} }
edit.show(); edit.show();
QTest::qWaitForWindowShown(&edit); QTest::qWaitForWindowExposed(&edit);
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&edit); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&edit);
QCOMPARE(iface->text(QAccessible::Value), edit.toPlainText()); QCOMPARE(iface->text(QAccessible::Value), edit.toPlainText());
QVERIFY(iface->state().focusable); QVERIFY(iface->state().focusable);
@ -2175,7 +2175,7 @@ void tst_QAccessibility::lineEditTest()
QLineEdit le(QStringLiteral("My characters have geometries."), toplevel); QLineEdit le(QStringLiteral("My characters have geometries."), toplevel);
// characterRect() // characterRect()
le.show(); le.show();
QTest::qWaitForWindowShown(&le); QTest::qWaitForWindowExposed(&le);
QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(&le)); QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(&le));
QAccessibleTextInterface* textIface = iface->textInterface(); QAccessibleTextInterface* textIface = iface->textInterface();
QVERIFY(textIface); QVERIFY(textIface);
@ -3576,7 +3576,7 @@ void tst_QAccessibility::comboBoxTest()
// Fully decorated windows have a minimum width of 160 on Windows. // Fully decorated windows have a minimum width of 160 on Windows.
combo.setMinimumWidth(200); combo.setMinimumWidth(200);
combo.show(); combo.show();
QVERIFY(QTest::qWaitForWindowShown(&combo)); QVERIFY(QTest::qWaitForWindowExposed(&combo));
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&combo); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&combo);
QCOMPARE(verifyHierarchy(iface), 0); QCOMPARE(verifyHierarchy(iface), 0);

View File

@ -2,4 +2,3 @@ QT += widgets testlib
TARGET = tst_bench_qwidget TARGET = tst_bench_qwidget
SOURCES += tst_qwidget.cpp SOURCES += tst_qwidget.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -128,7 +128,7 @@ private:
void tst_QWidget::initTestCase() void tst_QWidget::initTestCase()
{ {
widget.show(); widget.show();
QTest::qWaitForWindowShown(&widget); QTest::qWaitForWindowExposed(&widget);
QTest::qWait(300); QTest::qWait(300);
processEvents(); processEvents();
} }

View File

@ -4,5 +4,3 @@ TEMPLATE = app
TARGET = tst_bench_qtbench TARGET = tst_bench_qtbench
SOURCES += tst_qtbench.cpp SOURCES += tst_qtbench.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -229,7 +229,7 @@ void tst_QtBench::qtBench()
BenchWidget widget(reinterpret_cast<Benchmark *>(benchmark)); BenchWidget widget(reinterpret_cast<Benchmark *>(benchmark));
widget.show(); widget.show();
QTest::qWaitForWindowShown(&widget); QTest::qWaitForWindowExposed(&widget);
while (!widget.done()) { while (!widget.done()) {
widget.update(); widget.update();

View File

@ -173,7 +173,7 @@ void tst_qstylesheetstyle::grid()
w->setStyleSheet("/* */"); w->setStyleSheet("/* */");
if(show) { if(show) {
w->show(); w->show();
QTest::qWaitForWindowShown(w); QTest::qWaitForWindowExposed(w);
QApplication::flush(); QApplication::flush();
QApplication::processEvents(); QApplication::processEvents();
QTest::qWait(30); QTest::qWait(30);

View File

@ -5,4 +5,3 @@ TARGET = tst_bench_qstylesheetstyle
CONFIG += release CONFIG += release
SOURCES += main.cpp SOURCES += main.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -7,4 +7,3 @@ SOURCES += tst_network_remote_stresstest.cpp
RESOURCES += url-list.qrc RESOURCES += url-list.qrc
LIBS += $$QMAKE_LIBS_NETWORK LIBS += $$QMAKE_LIBS_NETWORK
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -246,30 +246,31 @@ void tst_NetworkRemoteStressTest::blockingSequentialRemoteHosts()
socket = QSharedPointer<QTcpSocket>(new QTcpSocket); socket = QSharedPointer<QTcpSocket>(new QTcpSocket);
socket->connectToHost(url.host(), url.port(isHttps ? 443 : 80)); socket->connectToHost(url.host(), url.port(isHttps ? 443 : 80));
QVERIFY2(socket->waitForConnected(10000), "Timeout connecting to " + url.encodedHost()); const QByteArray encodedHost = url.host(QUrl::FullyEncoded).toLatin1();
QVERIFY2(socket->waitForConnected(10000), "Timeout connecting to " + encodedHost);
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
if (isHttps) { if (isHttps) {
static_cast<QSslSocket *>(socket.data())->setProtocol(QSsl::TlsV1_0); static_cast<QSslSocket *>(socket.data())->setProtocol(QSsl::TlsV1_0);
static_cast<QSslSocket *>(socket.data())->startClientEncryption(); static_cast<QSslSocket *>(socket.data())->startClientEncryption();
static_cast<QSslSocket *>(socket.data())->ignoreSslErrors(); static_cast<QSslSocket *>(socket.data())->ignoreSslErrors();
QVERIFY2(static_cast<QSslSocket *>(socket.data())->waitForEncrypted(10000), "Timeout starting TLS with " + url.encodedHost()); QVERIFY2(static_cast<QSslSocket *>(socket.data())->waitForEncrypted(10000), "Timeout starting TLS with " + encodedHost);
} }
#endif // QT_NO_SSL #endif // QT_NO_SSL
socket->write("GET " + url.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemoveFragment) + " HTTP/1.0\r\n" socket->write("GET " + url.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemoveFragment) + " HTTP/1.0\r\n"
"Connection: close\r\n" "Connection: close\r\n"
"User-Agent: tst_QTcpSocket_stresstest/1.0\r\n" "User-Agent: tst_QTcpSocket_stresstest/1.0\r\n"
"Host: " + url.encodedHost() + "\r\n" "Host: " + encodedHost + "\r\n"
"\r\n"); "\r\n");
while (socket->bytesToWrite()) while (socket->bytesToWrite())
QVERIFY2(socket->waitForBytesWritten(10000), "Timeout writing to " + url.encodedHost()); QVERIFY2(socket->waitForBytesWritten(10000), "Timeout writing to " + encodedHost);
while (socket->state() == QAbstractSocket::ConnectedState && !timeout.hasExpired(10000)) { while (socket->state() == QAbstractSocket::ConnectedState && !timeout.hasExpired(10000)) {
socket->waitForReadyRead(10000); socket->waitForReadyRead(10000);
byteCounter += socket->readAll().size(); // discard byteCounter += socket->readAll().size(); // discard
} }
QVERIFY2(!timeout.hasExpired(10000), "Timeout reading from " + url.encodedHost()); QVERIFY2(!timeout.hasExpired(10000), "Timeout reading from " + encodedHost);
totalBytes += byteCounter; totalBytes += byteCounter;
if (intermediateDebug) { if (intermediateDebug) {
@ -318,16 +319,17 @@ void tst_NetworkRemoteStressTest::sequentialRemoteHosts()
socket->connectToHost(url.host(), url.port(80)); socket->connectToHost(url.host(), url.port(80));
} }
const QByteArray encodedHost = url.host(QUrl::FullyEncoded).toLatin1();
socket->write("GET " + url.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemoveFragment) + " HTTP/1.0\r\n" socket->write("GET " + url.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemoveFragment) + " HTTP/1.0\r\n"
"Connection: close\r\n" "Connection: close\r\n"
"User-Agent: tst_QTcpSocket_stresstest/1.0\r\n" "User-Agent: tst_QTcpSocket_stresstest/1.0\r\n"
"Host: " + url.encodedHost() + "\r\n" "Host: " + encodedHost + "\r\n"
"\r\n"); "\r\n");
connect(socket.data(), SIGNAL(readyRead()), SLOT(slotReadAll())); connect(socket.data(), SIGNAL(readyRead()), SLOT(slotReadAll()));
QTestEventLoop::instance().connect(socket.data(), SIGNAL(disconnected()), SLOT(exitLoop())); QTestEventLoop::instance().connect(socket.data(), SIGNAL(disconnected()), SLOT(exitLoop()));
QTestEventLoop::instance().enterLoop(30); QTestEventLoop::instance().enterLoop(30);
QVERIFY2(!QTestEventLoop::instance().timeout(), "Timeout with " + url.encodedHost() + "; " QVERIFY2(!QTestEventLoop::instance().timeout(), "Timeout with " + encodedHost + "; "
+ QByteArray::number(socket->bytesToWrite()) + " bytes to write"); + QByteArray::number(socket->bytesToWrite()) + " bytes to write");
totalBytes += byteCounter; totalBytes += byteCounter;
@ -397,10 +399,11 @@ void tst_NetworkRemoteStressTest::parallelRemoteHosts()
socket->connectToHost(url.host(), url.port(isHttps ? 443 : 80)); socket->connectToHost(url.host(), url.port(isHttps ? 443 : 80));
} }
const QByteArray encodedHost = url.host(QUrl::FullyEncoded).toLatin1();
socket->write("GET " + url.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemoveFragment) + " HTTP/1.0\r\n" socket->write("GET " + url.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemoveFragment) + " HTTP/1.0\r\n"
"Connection: close\r\n" "Connection: close\r\n"
"User-Agent: tst_QTcpSocket_stresstest/1.0\r\n" "User-Agent: tst_QTcpSocket_stresstest/1.0\r\n"
"Host: " + url.encodedHost() + "\r\n" "Host: " + encodedHost + "\r\n"
"\r\n"); "\r\n");
connect(socket, SIGNAL(readyRead()), SLOT(slotReadAll())); connect(socket, SIGNAL(readyRead()), SLOT(slotReadAll()));
QTestEventLoop::instance().connect(socket, SIGNAL(disconnected()), SLOT(exitLoop())); QTestEventLoop::instance().connect(socket, SIGNAL(disconnected()), SLOT(exitLoop()));

View File

@ -4,4 +4,3 @@ SOURCES += \
tabletwidget.cpp tabletwidget.cpp
HEADERS += \ HEADERS += \
tabletwidget.h tabletwidget.h
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -61,7 +61,7 @@ bool TabletWidget::eventFilter(QObject *, QEvent *ev)
mType = event->type(); mType = event->type();
mPos = event->pos(); mPos = event->pos();
mGPos = event->globalPos(); mGPos = event->globalPos();
mHiResGlobalPos = event->hiResGlobalPos(); mHiResGlobalPos = event->posF();
mDev = event->device(); mDev = event->device();
mPointerType = event->pointerType(); mPointerType = event->pointerType();
mUnique = event->uniqueId(); mUnique = event->uniqueId();