Tests: Fix some warnings about deprecated functions not under test
Fix warnings like: baselineserver/shared/baselineprotocol.cpp:295:72: warning: ‘int QImage::byteCount() const’ is deprecated: Use sizeInBytes [-Wdeprecated-declarations] tst_qnetworkreply.cpp:1560:17: warning: ‘static QList<QSslCertificate> QSslSocket::defaultCaCertificates()’ is deprecated [-Wdeprecated-declarations] tst_qnetworkreply.cpp:1560:39: warning: ‘static QList<QSslCertificate> QSslSocket::defaultCaCertificates()’ is deprecated [-Wdeprecated-declarations] tst_qnetworkreply.cpp:8153:60: warning: ‘T* QWeakPointer<T>::data() const [with T = const QNetworkSession]’ is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations]. ... st_qprinter.cpp:1318:74: warning: ‘QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const’ is deprecated [-Wdeprecated-declarations] tst_qprinter.cpp:1362:74: warning: ‘QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const’ is deprecated [-Wdeprecated-declarations] tst_largefile.cpp:492:85: warning: ‘bool qEqual(InputIterator1, InputIterator1, InputIterator2) [with InputIterator1 = char*; InputIterator2 = char*]’ is deprecated: Use std::equal [-Wdeprecated-declarations] tst_largefile.cpp:498:91: warning: ‘bool qEqual(InputIterator1, InputIterator1, InputIterator2) [with InputIterator1 = char*; InputIterator2 = char*]’ is deprecated: Use std::equal [-Wdeprecated-declarations] tst_qabstractitemmodel.cpp:312:25: warning: ‘void QAbstractItemModel::reset()’ is deprecated [-Wdeprecated-declarations] ... tst_qabstractitemmodel.cpp:1793:28: warning: ‘void QAbstractItemModel::setRoleNames(const QHash<int, QByteArray>&)’ is deprecated [-Wdeprecated-declarations] ... tst_qcolor.cpp:1425:33: warning: ‘QColor QColor::light(int) const’ is deprecated: Use QColor::lighter() instead [-Wdeprecated-declarations] tst_qcolor.cpp:1432:31: warning: ‘QColor QColor::dark(int) const’ is deprecated: Use QColor::darker() instead [-Wdeprecated-declarations] tst_qprinterinfo.cpp:303:61: warning: 'QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const' is deprecated [-Wdeprecated-declarations] tst_qprinterinfo.cpp:304:65: warning: 'QList<QPair<QString, QSizeF> > QPrinterInfo::supportedSizesWithNames() const' is deprecated [-Wdeprecated-declarations] tst_qtextdocumentfragment.cpp:947:52: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations] tst_qtextlayout.cpp:2261:61: warning: ‘void QTextLayout::setAdditionalFormats(const QList<QTextLayout::FormatRange>&)’ is deprecated: Use setFormats() [-Wdeprecated-declarations] tst_qtextlayout.cpp:2330:42: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] tst_qitemselectionmodel.cpp:2214:37: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] ... tst_qtextlist.cpp:317:68: warning: 'bool QTextList::isEmpty() const' is deprecated: Use count() instead [-Wdeprecated-declarations] tst_qpainter.cpp:373:32: warning: ‘void QPainter::setMatrixEnabled(bool)’ is deprecated: Use setWorldMatrixEnabled() instead [-Wdeprecated-declarations] tst_qpainter.cpp:374:40: warning: ‘bool QPainter::matrixEnabled() const’ is deprecated: Use worldMatrixEnabled() instead [-Wdeprecated-declarations] tst_qpainter.cpp:702:45: warning: ‘const QBrush& QPalette::background() const’ is deprecated: Use QPalette::window() instead [-Wdeprecated-declarations] tst_qpainter.cpp:1573:29: warning: ‘void QPainter::drawRoundRect(const QRect&, int, int)’ is deprecated: Use drawRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:76:38: warning: ‘virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:81:41: warning: ‘virtual void QPdfWriter::setPageSizeMM(const QSizeF&)’ is deprecated: Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:105:30: warning: ‘virtual void QPdfWriter::setMargins(const QPagedPaintDevice::Margins&)’ is deprecated: Use setPageMargins(QMarginsF(l, t, r, b), QPageLayout::Millimeter) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:172:37: warning: ‘virtual void QPdfWriter::setPageSizeMM(const QSizeF&)’ is deprecated: Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:258:38: warning: ‘virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations] qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp:3980:54: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] tst_qlocale.cpp:434:26: warning: 'QString::null' is deprecated: use QString() [-Wdeprecated-declarations] ... Change-Id: I77c1a934b27119eedeb26a77c913686314a2a5c7 Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
59937de098
commit
bf207acb34
@ -36,6 +36,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
@ -489,13 +490,13 @@ void tst_LargeFile::mapFile()
|
||||
// Keep full block mapped to facilitate OS and/or internal reuse by Qt.
|
||||
uchar *baseAddress = largeFile.map(position, blockSize);
|
||||
QVERIFY( baseAddress );
|
||||
QVERIFY( qEqual(block.begin(), block.end(), reinterpret_cast<char*>(baseAddress)) );
|
||||
QVERIFY( std::equal(block.begin(), block.end(), reinterpret_cast<char*>(baseAddress)) );
|
||||
|
||||
for (int offset = 1; offset < blockSize; ++offset) {
|
||||
uchar *address = largeFile.map(position + offset, blockSize - offset);
|
||||
|
||||
QVERIFY( address );
|
||||
if ( !qEqual(block.begin() + offset, block.end(), reinterpret_cast<char*>(address)) ) {
|
||||
if ( !std::equal(block.begin() + offset, block.end(), reinterpret_cast<char*>(address)) ) {
|
||||
qDebug() << "Expected:" << block.toHex();
|
||||
qDebug() << "Actual :" << QByteArray(reinterpret_cast<char*>(address), blockSize).toHex();
|
||||
QVERIFY(false);
|
||||
|
@ -309,7 +309,8 @@ bool QtTestModel::moveColumns(const QModelIndex &sourceParent, int src, int cnt,
|
||||
|
||||
void QtTestModel::reset()
|
||||
{
|
||||
QAbstractItemModel::reset();
|
||||
QAbstractItemModel::beginResetModel();
|
||||
QAbstractItemModel::endResetModel();
|
||||
}
|
||||
|
||||
bool QtTestModel::canDropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
@ -1785,13 +1786,12 @@ class ModelWithCustomRole : public QStringListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ModelWithCustomRole(QObject *parent = 0)
|
||||
: QStringListModel(parent)
|
||||
{
|
||||
QHash<int, QByteArray> roleNames_ = roleNames();
|
||||
roleNames_.insert(Qt::UserRole + 1, "custom");
|
||||
setRoleNames(roleNames_);
|
||||
}
|
||||
using QStringListModel::QStringListModel;
|
||||
|
||||
QHash<int, QByteArray> roleNames() const override
|
||||
{
|
||||
return {{Qt::UserRole + 1, QByteArrayLiteral("custom")}};
|
||||
}
|
||||
};
|
||||
|
||||
ListenerObject::ListenerObject(QAbstractProxyModel *parent)
|
||||
|
@ -313,11 +313,12 @@ public:
|
||||
CustomRole2
|
||||
};
|
||||
|
||||
StandardItemModelWithCustomRoleNames() {
|
||||
QHash<int, QByteArray> _roleNames = roleNames();
|
||||
_roleNames.insert(CustomRole1, "custom1");
|
||||
_roleNames.insert(CustomRole2, "custom2");
|
||||
setRoleNames(_roleNames);
|
||||
QHash<int, QByteArray> roleNames() const override
|
||||
{
|
||||
auto result = QStandardItemModel::roleNames();
|
||||
result.insert(CustomRole1, QByteArrayLiteral("custom1"));
|
||||
result.insert(CustomRole2, QByteArrayLiteral("custom2"));
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
@ -329,11 +330,10 @@ public:
|
||||
AnotherCustomRole2
|
||||
};
|
||||
|
||||
AnotherStandardItemModelWithCustomRoleNames() {
|
||||
QHash<int, QByteArray> _roleNames = roleNames();
|
||||
_roleNames.insert(AnotherCustomRole1, "another_custom1");
|
||||
_roleNames.insert(AnotherCustomRole2, "another_custom2");
|
||||
setRoleNames(_roleNames);
|
||||
QHash<int, QByteArray> roleNames() const override
|
||||
{
|
||||
return {{AnotherCustomRole1, QByteArrayLiteral("another_custom1")},
|
||||
{AnotherCustomRole2, QByteArrayLiteral("another_custom2")}};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2211,8 +2211,8 @@ void tst_QItemSelectionModel::childrenDeselectionSignal()
|
||||
}
|
||||
|
||||
QModelIndex root = model.index(0,0);
|
||||
QModelIndex par = root.child(0,0);
|
||||
QModelIndex sel = par.child(0,0);
|
||||
QModelIndex par = model.index(0, 0, root);
|
||||
QModelIndex sel = model.index(0, 0, par);
|
||||
|
||||
QItemSelectionModel selectionModel(&model);
|
||||
selectionModel.select(sel, QItemSelectionModel::SelectCurrent);
|
||||
@ -2240,9 +2240,9 @@ void tst_QItemSelectionModel::childrenDeselectionSignal()
|
||||
}
|
||||
}
|
||||
|
||||
sel = model.index(0, 0).child(0, 0);
|
||||
sel = model.index(0, 0, model.index(0, 0));
|
||||
selectionModel.select(sel, QItemSelectionModel::Select);
|
||||
QModelIndex sel2 = model.index(1, 0).child(0, 0);
|
||||
QModelIndex sel2 = model.index(0, 0, model.index(1, 0));
|
||||
selectionModel.select(sel2, QItemSelectionModel::Select);
|
||||
|
||||
QVERIFY(selectionModel.selection().contains(sel));
|
||||
|
@ -3977,7 +3977,7 @@ void tst_QSortFilterProxyModel::hierarchyFilterInvalidation()
|
||||
QTreeView view;
|
||||
view.setModel(&proxy);
|
||||
|
||||
view.setCurrentIndex(proxy.index(2, 0).child(0, 0));
|
||||
view.setCurrentIndex(proxy.index(0, 0, proxy.index(2, 0)));
|
||||
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
|
@ -423,6 +423,7 @@ void tst_QLocale::defaulted_ctor()
|
||||
}
|
||||
|
||||
QLocale::setDefault(QLocale(QLocale::C));
|
||||
const QString empty;
|
||||
|
||||
TEST_CTOR("C", C, AnyCountry)
|
||||
TEST_CTOR("bla", C, AnyCountry)
|
||||
@ -431,7 +432,7 @@ void tst_QLocale::defaulted_ctor()
|
||||
TEST_CTOR("zz...", C, AnyCountry)
|
||||
TEST_CTOR("", C, AnyCountry)
|
||||
TEST_CTOR("en/", C, AnyCountry)
|
||||
TEST_CTOR(QString::null, C, AnyCountry)
|
||||
TEST_CTOR(empty, C, AnyCountry)
|
||||
TEST_CTOR("en", English, UnitedStates)
|
||||
TEST_CTOR("en", English, UnitedStates)
|
||||
TEST_CTOR("en.", English, UnitedStates)
|
||||
|
@ -94,8 +94,8 @@ private slots:
|
||||
|
||||
void convertTo();
|
||||
|
||||
void light();
|
||||
void dark();
|
||||
void lighter();
|
||||
void darker();
|
||||
|
||||
void specConstructor_data();
|
||||
void specConstructor();
|
||||
@ -1419,17 +1419,17 @@ void tst_QColor::convertTo()
|
||||
QCOMPARE(invalid.spec(), QColor::Invalid);
|
||||
}
|
||||
|
||||
void tst_QColor::light()
|
||||
void tst_QColor::lighter()
|
||||
{
|
||||
QColor gray(Qt::gray);
|
||||
QColor lighter = gray.light();
|
||||
QColor lighter = gray.lighter();
|
||||
QVERIFY(lighter.value() > gray.value());
|
||||
}
|
||||
|
||||
void tst_QColor::dark()
|
||||
void tst_QColor::darker()
|
||||
{
|
||||
QColor gray(Qt::gray);
|
||||
QColor darker = gray.dark();
|
||||
QColor darker = gray.darker();
|
||||
QVERIFY(darker.value() < gray.value());
|
||||
}
|
||||
|
||||
|
@ -370,10 +370,10 @@ void tst_QPainter::getSetCheck()
|
||||
|
||||
// bool QPainter::matrixEnabled()
|
||||
// void QPainter::setMatrixEnabled(bool)
|
||||
obj1.setMatrixEnabled(false);
|
||||
QCOMPARE(false, obj1.matrixEnabled());
|
||||
obj1.setMatrixEnabled(true);
|
||||
QCOMPARE(true, obj1.matrixEnabled());
|
||||
obj1.setWorldMatrixEnabled(false);
|
||||
QCOMPARE(false, obj1.worldMatrixEnabled());
|
||||
obj1.setWorldMatrixEnabled(true);
|
||||
QCOMPARE(true, obj1.worldMatrixEnabled());
|
||||
|
||||
// bool QPainter::viewTransformEnabled()
|
||||
// void QPainter::setViewTransformEnabled(bool)
|
||||
@ -699,7 +699,7 @@ void tst_QPainter::initFrom()
|
||||
|
||||
QCOMPARE(p.font(), font);
|
||||
QCOMPARE(p.pen().color(), pal.color(QPalette::Foreground));
|
||||
QCOMPARE(p.background(), pal.background());
|
||||
QCOMPARE(p.background(), pal.window());
|
||||
|
||||
delete widget;
|
||||
}
|
||||
@ -3197,7 +3197,7 @@ void tst_QPainter::largeImagePainting()
|
||||
p.translate(4, 0);
|
||||
}
|
||||
|
||||
p.resetMatrix();
|
||||
p.resetTransform();
|
||||
|
||||
for (int i = 4; i < img.height(); i += 4) {
|
||||
p.translate(0, 4);
|
||||
|
@ -154,12 +154,7 @@ void tst_QPdfWriter::testPageMetrics()
|
||||
|
||||
if (setMargins) {
|
||||
// Setup the given margins
|
||||
QPdfWriter::Margins margins;
|
||||
margins.left = leftMMf;
|
||||
margins.right = rightMMf;
|
||||
margins.top = topMMf;
|
||||
margins.bottom = bottomMMf;
|
||||
writer.setMargins(margins);
|
||||
writer.setPageMargins({leftMMf, topMMf, rightMMf, bottomMMf}, QPageLayout::Millimeter);
|
||||
QCOMPARE(writer.margins().left, leftMMf);
|
||||
QCOMPARE(writer.margins().right, rightMMf);
|
||||
QCOMPARE(writer.margins().top, topMMf);
|
||||
@ -169,7 +164,7 @@ void tst_QPdfWriter::testPageMetrics()
|
||||
|
||||
// Set the given size, in Portrait mode
|
||||
if (pageSize < 0) {
|
||||
writer.setPageSizeMM(sizeMMf);
|
||||
writer.setPageSize(QPageSize(sizeMMf, QPageSize::Millimeter));
|
||||
QCOMPARE(writer.pageSize(), QPdfWriter::Custom);
|
||||
QCOMPARE(writer.pageLayout().pageSize().id(), QPageSize::Custom);
|
||||
} else {
|
||||
@ -221,7 +216,7 @@ void tst_QPdfWriter::testPageMetrics()
|
||||
|
||||
// Now while in Landscape mode, set the size again, results should be the same
|
||||
if (pageSize < 0) {
|
||||
writer.setPageSizeMM(sizeMMf);
|
||||
writer.setPageSize(QPageSize(sizeMMf, QPageSize::Millimeter));
|
||||
QCOMPARE(writer.pageSize(), QPdfWriter::Custom);
|
||||
QCOMPARE(writer.pageLayout().pageSize().id(), QPageSize::Custom);
|
||||
} else {
|
||||
@ -255,7 +250,7 @@ void tst_QPdfWriter::qtbug59443()
|
||||
QTemporaryFile file;
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
QPdfWriter writer(file.fileName());
|
||||
writer.setPageSize(QPdfWriter::A4);
|
||||
writer.setPageSize(QPageSize(QPageSize::A4));
|
||||
QTextDocument doc;
|
||||
doc.documentLayout()->setPaintDevice(&writer);
|
||||
|
||||
|
@ -944,7 +944,7 @@ void tst_QTextDocumentFragment::namedAnchorFragments3()
|
||||
|
||||
QCOMPARE(it.fragment().text(), QString::fromLatin1("T"));
|
||||
QVERIFY(it.fragment().charFormat().isAnchor());
|
||||
QCOMPARE(it.fragment().charFormat().anchorName(), QString("target"));
|
||||
QCOMPARE(it.fragment().charFormat().anchorNames().constFirst(), QLatin1String("target"));
|
||||
QStringList targets; targets << "target" << "target2";
|
||||
QCOMPARE(it.fragment().charFormat().anchorNames(), targets);
|
||||
|
||||
|
@ -2228,7 +2228,6 @@ void tst_QTextLayout::superscriptCrash_qtbug53911()
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
QTextLayout* newTextLayout = new QTextLayout();
|
||||
newTextLayout->setText(layoutText);
|
||||
QList<QTextLayout::FormatRange> formatRanges;
|
||||
QTextLayout::FormatRange formatRange;
|
||||
|
||||
formatRange.format.setFont(QFont());
|
||||
@ -2257,8 +2256,7 @@ void tst_QTextLayout::superscriptCrash_qtbug53911()
|
||||
|
||||
formatRange.start = 0;
|
||||
formatRange.length = layoutText.size();
|
||||
formatRanges << formatRange;
|
||||
newTextLayout->setAdditionalFormats(formatRanges);
|
||||
newTextLayout->setFormats({formatRange});
|
||||
|
||||
textLayouts.push_front(newTextLayout);
|
||||
}
|
||||
@ -2289,10 +2287,7 @@ void tst_QTextLayout::nbspWithFormat()
|
||||
formatRange.length = 1;
|
||||
formatRange.format.setFontUnderline(true);
|
||||
|
||||
QList<QTextLayout::FormatRange> overrides;
|
||||
overrides.append(formatRange);
|
||||
|
||||
layout.setAdditionalFormats(overrides);
|
||||
layout.setFormats({formatRange});
|
||||
|
||||
layout.beginLayout();
|
||||
forever {
|
||||
@ -2327,7 +2322,7 @@ void tst_QTextLayout::koreanWordWrap()
|
||||
QTextLine line = layout.createLine();
|
||||
if (!line.isValid())
|
||||
break;
|
||||
line.setLineWidth(metrics.width(s) * 0.8);
|
||||
line.setLineWidth(metrics.horizontalAdvance(s) * 0.8);
|
||||
}
|
||||
layout.endLayout();
|
||||
QCOMPARE(layout.lineCount(), 2);
|
||||
|
@ -314,7 +314,7 @@ void tst_QTextList::partialRemoval()
|
||||
selection.deleteChar(); // deletes the second list
|
||||
|
||||
QVERIFY(!secondList);
|
||||
QVERIFY(!firstList->isEmpty());
|
||||
QVERIFY(firstList->count() > 0);
|
||||
|
||||
doc->undo();
|
||||
}
|
||||
|
@ -1557,7 +1557,7 @@ void tst_QNetworkReply::initTestCase()
|
||||
|
||||
QDir::setSearchPaths("testdata", QStringList() << testDataDir);
|
||||
#ifndef QT_NO_SSL
|
||||
QSslSocket::defaultCaCertificates(); //preload certificates
|
||||
QSslConfiguration::defaultConfiguration().caCertificates(); //preload certificates
|
||||
#endif
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
netConfMan = new QNetworkConfigurationManager(this);
|
||||
@ -8148,16 +8148,17 @@ void tst_QNetworkReply::backgroundRequest()
|
||||
SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
|
||||
#endif
|
||||
|
||||
const QWeakPointer<const QNetworkSession> session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||
QVERIFY(session);
|
||||
QNetworkSession::UsagePolicies original = session.data()->usagePolicies();
|
||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), QNetworkSession::UsagePolicies(policy));
|
||||
const QWeakPointer<const QNetworkSession> sessionWeakPtr = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||
QVERIFY(!sessionWeakPtr.isNull());
|
||||
auto session = const_cast<QNetworkSession *>(sessionWeakPtr.toStrongRef().data());
|
||||
QNetworkSession::UsagePolicies original = session->usagePolicies();
|
||||
QNetworkSessionPrivate::setUsagePolicies(*session, QNetworkSession::UsagePolicies(policy));
|
||||
|
||||
QNetworkReplyPtr reply(manager.get(request));
|
||||
|
||||
QVERIFY(waitForFinish(reply) != Timeout);
|
||||
if (session)
|
||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), original);
|
||||
QNetworkSessionPrivate::setUsagePolicies(*session, original);
|
||||
|
||||
QVERIFY(reply->isFinished());
|
||||
QCOMPARE(reply->error(), error);
|
||||
@ -8212,10 +8213,11 @@ void tst_QNetworkReply::backgroundRequestInterruption()
|
||||
SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
|
||||
#endif
|
||||
|
||||
const QWeakPointer<const QNetworkSession> session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||
QVERIFY(session);
|
||||
QNetworkSession::UsagePolicies original = session.data()->usagePolicies();
|
||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), QNetworkSession::NoPolicy);
|
||||
const QWeakPointer<const QNetworkSession> sessionWeakPtr = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||
QVERIFY(!sessionWeakPtr.isNull());
|
||||
auto session = const_cast<QNetworkSession *>(sessionWeakPtr.toStrongRef().data());
|
||||
QNetworkSession::UsagePolicies original = session->usagePolicies();
|
||||
QNetworkSessionPrivate::setUsagePolicies(*session, QNetworkSession::NoPolicy);
|
||||
|
||||
request.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, 8192);
|
||||
QNetworkReplyPtr reply(manager.get(request));
|
||||
@ -8224,14 +8226,14 @@ void tst_QNetworkReply::backgroundRequestInterruption()
|
||||
QSignalSpy spy(reply.data(), SIGNAL(readyRead()));
|
||||
QTRY_VERIFY(spy.count() > 0);
|
||||
|
||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), QNetworkSession::NoBackgroundTrafficPolicy);
|
||||
QNetworkSessionPrivate::setUsagePolicies(*session, QNetworkSession::NoBackgroundTrafficPolicy);
|
||||
|
||||
// After we have changed the policy we can download at full speed.
|
||||
reply->setReadBufferSize(0);
|
||||
|
||||
QVERIFY(waitForFinish(reply) != Timeout);
|
||||
if (session)
|
||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), original);
|
||||
QNetworkSessionPrivate::setUsagePolicies(*session, original);
|
||||
|
||||
QVERIFY(reply->isFinished());
|
||||
QCOMPARE(reply->error(), error);
|
||||
@ -8271,8 +8273,8 @@ void tst_QNetworkReply::backgroundRequestConnectInBackground()
|
||||
|
||||
QWeakPointer<const QNetworkSession> session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||
//force QNAM to reopen the session.
|
||||
if (session && session.data()->isOpen()) {
|
||||
const_cast<QNetworkSession *>(session.data())->close();
|
||||
if (session && session.toStrongRef().data()->isOpen()) {
|
||||
const_cast<QNetworkSession *>(session.toStrongRef().data())->close();
|
||||
QCoreApplication::processEvents(); //let signals propagate inside QNAM
|
||||
}
|
||||
|
||||
@ -8281,19 +8283,19 @@ void tst_QNetworkReply::backgroundRequestConnectInBackground()
|
||||
|
||||
session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||
QVERIFY(session);
|
||||
QNetworkSession::UsagePolicies original = session.data()->usagePolicies();
|
||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), QNetworkSession::NoPolicy);
|
||||
QNetworkSession::UsagePolicies original = session.toStrongRef().data()->usagePolicies();
|
||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.toStrongRef().data()), QNetworkSession::NoPolicy);
|
||||
|
||||
QNetworkReplyPtr reply(manager.get(request));
|
||||
|
||||
QVERIFY(waitForFinish(reply) != Timeout);
|
||||
session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||
if (session) {
|
||||
QVariant cib = session.data()->sessionProperty(QStringLiteral("ConnectInBackground"));
|
||||
QVariant cib = session.toStrongRef().data()->sessionProperty(QStringLiteral("ConnectInBackground"));
|
||||
if (!cib.isValid())
|
||||
QSKIP("inconclusive - ConnectInBackground session property not supported by the bearer plugin");
|
||||
QCOMPARE(cib.toBool(), background);
|
||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), original);
|
||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.toStrongRef().data()), original);
|
||||
} else {
|
||||
QSKIP("inconclusive - network session has been destroyed");
|
||||
}
|
||||
|
@ -1315,7 +1315,9 @@ void tst_QPrinter::pageSize()
|
||||
// Test set/get
|
||||
QPrinter::PaperSize expected = QPrinter::A4;
|
||||
QPrinterInfo info = QPrinterInfo::printerInfo(native.printerName());
|
||||
foreach (QPrinter::PaperSize supported, info.supportedPaperSizes()) {
|
||||
const auto &pageSizes = info.supportedPageSizes();
|
||||
for (const auto &pageSize : pageSizes) {
|
||||
const QPrinter::PaperSize supported = QPrinter::PaperSize(pageSize.id());
|
||||
if (supported != QPrinter::Custom && supported != native.paperSize()) {
|
||||
expected = supported;
|
||||
break;
|
||||
@ -1359,7 +1361,9 @@ void tst_QPrinter::paperSize()
|
||||
// Test set/get
|
||||
QPrinter::PaperSize expected = QPrinter::A4;
|
||||
QPrinterInfo info = QPrinterInfo::printerInfo(native.printerName());
|
||||
foreach (QPrinter::PaperSize supported, info.supportedPaperSizes()) {
|
||||
const auto &pageSizes = info.supportedPageSizes();
|
||||
for (const auto &pageSize : pageSizes) {
|
||||
const QPrinter::PaperSize supported = QPrinter::PaperSize(pageSize.id());
|
||||
if (supported != QPrinter::Custom && supported != native.paperSize()) {
|
||||
expected = supported;
|
||||
break;
|
||||
|
@ -300,8 +300,11 @@ void tst_QPrinterInfo::testConstructors()
|
||||
QCOMPARE(copy1.supportsCustomPageSizes(), printers.at(i).supportsCustomPageSizes());
|
||||
QCOMPARE(copy1.minimumPhysicalPageSize(), printers.at(i).minimumPhysicalPageSize());
|
||||
QCOMPARE(copy1.maximumPhysicalPageSize(), printers.at(i).maximumPhysicalPageSize());
|
||||
QCOMPARE(copy1.supportedPaperSizes(), printers.at(i).supportedPaperSizes());
|
||||
QCOMPARE(copy1.supportedPageSizes(), printers.at(i).supportedPageSizes());
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
QCOMPARE(copy1.supportedSizesWithNames(), printers.at(i).supportedSizesWithNames());
|
||||
QT_WARNING_POP
|
||||
QCOMPARE(copy1.supportedResolutions(), printers.at(i).supportedResolutions());
|
||||
QCOMPARE(copy1.defaultDuplexMode(), printers.at(i).defaultDuplexMode());
|
||||
QCOMPARE(copy1.supportedDuplexModes(), printers.at(i).supportedDuplexModes());
|
||||
@ -321,8 +324,11 @@ void tst_QPrinterInfo::testConstructors()
|
||||
QCOMPARE(copy2.supportsCustomPageSizes(), printers.at(i).supportsCustomPageSizes());
|
||||
QCOMPARE(copy2.minimumPhysicalPageSize(), printers.at(i).minimumPhysicalPageSize());
|
||||
QCOMPARE(copy2.maximumPhysicalPageSize(), printers.at(i).maximumPhysicalPageSize());
|
||||
QCOMPARE(copy2.supportedPaperSizes(), printers.at(i).supportedPaperSizes());
|
||||
QCOMPARE(copy2.supportedPageSizes(), printers.at(i).supportedPageSizes());
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
QCOMPARE(copy2.supportedSizesWithNames(), printers.at(i).supportedSizesWithNames());
|
||||
QT_WARNING_POP
|
||||
QCOMPARE(copy2.supportedResolutions(), printers.at(i).supportedResolutions());
|
||||
QCOMPARE(copy2.defaultDuplexMode(), printers.at(i).defaultDuplexMode());
|
||||
QCOMPARE(copy2.supportedDuplexModes(), printers.at(i).supportedDuplexModes());
|
||||
|
@ -292,7 +292,8 @@ void ImageItem::writeImageToStream(QDataStream &out) const
|
||||
out << quint8('Q') << quint8(image.format());
|
||||
out << quint8(QSysInfo::ByteOrder) << quint8(0); // pad to multiple of 4 bytes
|
||||
out << quint32(image.width()) << quint32(image.height()) << quint32(image.bytesPerLine());
|
||||
out << qCompress((const uchar *)image.constBits(), image.byteCount());
|
||||
out << qCompress(reinterpret_cast<const uchar *>(image.constBits()),
|
||||
int(image.sizeInBytes()));
|
||||
//# can be followed by colormap for formats that use it
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user