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 <QDebug>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
@ -489,13 +490,13 @@ void tst_LargeFile::mapFile()
|
|||||||
// Keep full block mapped to facilitate OS and/or internal reuse by Qt.
|
// Keep full block mapped to facilitate OS and/or internal reuse by Qt.
|
||||||
uchar *baseAddress = largeFile.map(position, blockSize);
|
uchar *baseAddress = largeFile.map(position, blockSize);
|
||||||
QVERIFY( baseAddress );
|
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) {
|
for (int offset = 1; offset < blockSize; ++offset) {
|
||||||
uchar *address = largeFile.map(position + offset, blockSize - offset);
|
uchar *address = largeFile.map(position + offset, blockSize - offset);
|
||||||
|
|
||||||
QVERIFY( address );
|
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() << "Expected:" << block.toHex();
|
||||||
qDebug() << "Actual :" << QByteArray(reinterpret_cast<char*>(address), blockSize).toHex();
|
qDebug() << "Actual :" << QByteArray(reinterpret_cast<char*>(address), blockSize).toHex();
|
||||||
QVERIFY(false);
|
QVERIFY(false);
|
||||||
|
@ -309,7 +309,8 @@ bool QtTestModel::moveColumns(const QModelIndex &sourceParent, int src, int cnt,
|
|||||||
|
|
||||||
void QtTestModel::reset()
|
void QtTestModel::reset()
|
||||||
{
|
{
|
||||||
QAbstractItemModel::reset();
|
QAbstractItemModel::beginResetModel();
|
||||||
|
QAbstractItemModel::endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtTestModel::canDropMimeData(const QMimeData *data, Qt::DropAction action,
|
bool QtTestModel::canDropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||||
@ -1785,13 +1786,12 @@ class ModelWithCustomRole : public QStringListModel
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ModelWithCustomRole(QObject *parent = 0)
|
using QStringListModel::QStringListModel;
|
||||||
: QStringListModel(parent)
|
|
||||||
{
|
QHash<int, QByteArray> roleNames() const override
|
||||||
QHash<int, QByteArray> roleNames_ = roleNames();
|
{
|
||||||
roleNames_.insert(Qt::UserRole + 1, "custom");
|
return {{Qt::UserRole + 1, QByteArrayLiteral("custom")}};
|
||||||
setRoleNames(roleNames_);
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ListenerObject::ListenerObject(QAbstractProxyModel *parent)
|
ListenerObject::ListenerObject(QAbstractProxyModel *parent)
|
||||||
|
@ -313,11 +313,12 @@ public:
|
|||||||
CustomRole2
|
CustomRole2
|
||||||
};
|
};
|
||||||
|
|
||||||
StandardItemModelWithCustomRoleNames() {
|
QHash<int, QByteArray> roleNames() const override
|
||||||
QHash<int, QByteArray> _roleNames = roleNames();
|
{
|
||||||
_roleNames.insert(CustomRole1, "custom1");
|
auto result = QStandardItemModel::roleNames();
|
||||||
_roleNames.insert(CustomRole2, "custom2");
|
result.insert(CustomRole1, QByteArrayLiteral("custom1"));
|
||||||
setRoleNames(_roleNames);
|
result.insert(CustomRole2, QByteArrayLiteral("custom2"));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -329,11 +330,10 @@ public:
|
|||||||
AnotherCustomRole2
|
AnotherCustomRole2
|
||||||
};
|
};
|
||||||
|
|
||||||
AnotherStandardItemModelWithCustomRoleNames() {
|
QHash<int, QByteArray> roleNames() const override
|
||||||
QHash<int, QByteArray> _roleNames = roleNames();
|
{
|
||||||
_roleNames.insert(AnotherCustomRole1, "another_custom1");
|
return {{AnotherCustomRole1, QByteArrayLiteral("another_custom1")},
|
||||||
_roleNames.insert(AnotherCustomRole2, "another_custom2");
|
{AnotherCustomRole2, QByteArrayLiteral("another_custom2")}};
|
||||||
setRoleNames(_roleNames);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2211,8 +2211,8 @@ void tst_QItemSelectionModel::childrenDeselectionSignal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex root = model.index(0,0);
|
QModelIndex root = model.index(0,0);
|
||||||
QModelIndex par = root.child(0,0);
|
QModelIndex par = model.index(0, 0, root);
|
||||||
QModelIndex sel = par.child(0,0);
|
QModelIndex sel = model.index(0, 0, par);
|
||||||
|
|
||||||
QItemSelectionModel selectionModel(&model);
|
QItemSelectionModel selectionModel(&model);
|
||||||
selectionModel.select(sel, QItemSelectionModel::SelectCurrent);
|
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);
|
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);
|
selectionModel.select(sel2, QItemSelectionModel::Select);
|
||||||
|
|
||||||
QVERIFY(selectionModel.selection().contains(sel));
|
QVERIFY(selectionModel.selection().contains(sel));
|
||||||
|
@ -3977,7 +3977,7 @@ void tst_QSortFilterProxyModel::hierarchyFilterInvalidation()
|
|||||||
QTreeView view;
|
QTreeView view;
|
||||||
view.setModel(&proxy);
|
view.setModel(&proxy);
|
||||||
|
|
||||||
view.setCurrentIndex(proxy.index(2, 0).child(0, 0));
|
view.setCurrentIndex(proxy.index(0, 0, proxy.index(2, 0)));
|
||||||
|
|
||||||
view.show();
|
view.show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||||
|
@ -423,6 +423,7 @@ void tst_QLocale::defaulted_ctor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QLocale::setDefault(QLocale(QLocale::C));
|
QLocale::setDefault(QLocale(QLocale::C));
|
||||||
|
const QString empty;
|
||||||
|
|
||||||
TEST_CTOR("C", C, AnyCountry)
|
TEST_CTOR("C", C, AnyCountry)
|
||||||
TEST_CTOR("bla", C, AnyCountry)
|
TEST_CTOR("bla", C, AnyCountry)
|
||||||
@ -431,7 +432,7 @@ void tst_QLocale::defaulted_ctor()
|
|||||||
TEST_CTOR("zz...", C, AnyCountry)
|
TEST_CTOR("zz...", C, AnyCountry)
|
||||||
TEST_CTOR("", C, AnyCountry)
|
TEST_CTOR("", C, AnyCountry)
|
||||||
TEST_CTOR("en/", 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)
|
TEST_CTOR("en", English, UnitedStates)
|
||||||
TEST_CTOR("en.", English, UnitedStates)
|
TEST_CTOR("en.", English, UnitedStates)
|
||||||
|
@ -94,8 +94,8 @@ private slots:
|
|||||||
|
|
||||||
void convertTo();
|
void convertTo();
|
||||||
|
|
||||||
void light();
|
void lighter();
|
||||||
void dark();
|
void darker();
|
||||||
|
|
||||||
void specConstructor_data();
|
void specConstructor_data();
|
||||||
void specConstructor();
|
void specConstructor();
|
||||||
@ -1419,17 +1419,17 @@ void tst_QColor::convertTo()
|
|||||||
QCOMPARE(invalid.spec(), QColor::Invalid);
|
QCOMPARE(invalid.spec(), QColor::Invalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QColor::light()
|
void tst_QColor::lighter()
|
||||||
{
|
{
|
||||||
QColor gray(Qt::gray);
|
QColor gray(Qt::gray);
|
||||||
QColor lighter = gray.light();
|
QColor lighter = gray.lighter();
|
||||||
QVERIFY(lighter.value() > gray.value());
|
QVERIFY(lighter.value() > gray.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QColor::dark()
|
void tst_QColor::darker()
|
||||||
{
|
{
|
||||||
QColor gray(Qt::gray);
|
QColor gray(Qt::gray);
|
||||||
QColor darker = gray.dark();
|
QColor darker = gray.darker();
|
||||||
QVERIFY(darker.value() < gray.value());
|
QVERIFY(darker.value() < gray.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,10 +370,10 @@ void tst_QPainter::getSetCheck()
|
|||||||
|
|
||||||
// bool QPainter::matrixEnabled()
|
// bool QPainter::matrixEnabled()
|
||||||
// void QPainter::setMatrixEnabled(bool)
|
// void QPainter::setMatrixEnabled(bool)
|
||||||
obj1.setMatrixEnabled(false);
|
obj1.setWorldMatrixEnabled(false);
|
||||||
QCOMPARE(false, obj1.matrixEnabled());
|
QCOMPARE(false, obj1.worldMatrixEnabled());
|
||||||
obj1.setMatrixEnabled(true);
|
obj1.setWorldMatrixEnabled(true);
|
||||||
QCOMPARE(true, obj1.matrixEnabled());
|
QCOMPARE(true, obj1.worldMatrixEnabled());
|
||||||
|
|
||||||
// bool QPainter::viewTransformEnabled()
|
// bool QPainter::viewTransformEnabled()
|
||||||
// void QPainter::setViewTransformEnabled(bool)
|
// void QPainter::setViewTransformEnabled(bool)
|
||||||
@ -699,7 +699,7 @@ void tst_QPainter::initFrom()
|
|||||||
|
|
||||||
QCOMPARE(p.font(), font);
|
QCOMPARE(p.font(), font);
|
||||||
QCOMPARE(p.pen().color(), pal.color(QPalette::Foreground));
|
QCOMPARE(p.pen().color(), pal.color(QPalette::Foreground));
|
||||||
QCOMPARE(p.background(), pal.background());
|
QCOMPARE(p.background(), pal.window());
|
||||||
|
|
||||||
delete widget;
|
delete widget;
|
||||||
}
|
}
|
||||||
@ -3197,7 +3197,7 @@ void tst_QPainter::largeImagePainting()
|
|||||||
p.translate(4, 0);
|
p.translate(4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.resetMatrix();
|
p.resetTransform();
|
||||||
|
|
||||||
for (int i = 4; i < img.height(); i += 4) {
|
for (int i = 4; i < img.height(); i += 4) {
|
||||||
p.translate(0, 4);
|
p.translate(0, 4);
|
||||||
|
@ -154,12 +154,7 @@ void tst_QPdfWriter::testPageMetrics()
|
|||||||
|
|
||||||
if (setMargins) {
|
if (setMargins) {
|
||||||
// Setup the given margins
|
// Setup the given margins
|
||||||
QPdfWriter::Margins margins;
|
writer.setPageMargins({leftMMf, topMMf, rightMMf, bottomMMf}, QPageLayout::Millimeter);
|
||||||
margins.left = leftMMf;
|
|
||||||
margins.right = rightMMf;
|
|
||||||
margins.top = topMMf;
|
|
||||||
margins.bottom = bottomMMf;
|
|
||||||
writer.setMargins(margins);
|
|
||||||
QCOMPARE(writer.margins().left, leftMMf);
|
QCOMPARE(writer.margins().left, leftMMf);
|
||||||
QCOMPARE(writer.margins().right, rightMMf);
|
QCOMPARE(writer.margins().right, rightMMf);
|
||||||
QCOMPARE(writer.margins().top, topMMf);
|
QCOMPARE(writer.margins().top, topMMf);
|
||||||
@ -169,7 +164,7 @@ void tst_QPdfWriter::testPageMetrics()
|
|||||||
|
|
||||||
// Set the given size, in Portrait mode
|
// Set the given size, in Portrait mode
|
||||||
if (pageSize < 0) {
|
if (pageSize < 0) {
|
||||||
writer.setPageSizeMM(sizeMMf);
|
writer.setPageSize(QPageSize(sizeMMf, QPageSize::Millimeter));
|
||||||
QCOMPARE(writer.pageSize(), QPdfWriter::Custom);
|
QCOMPARE(writer.pageSize(), QPdfWriter::Custom);
|
||||||
QCOMPARE(writer.pageLayout().pageSize().id(), QPageSize::Custom);
|
QCOMPARE(writer.pageLayout().pageSize().id(), QPageSize::Custom);
|
||||||
} else {
|
} else {
|
||||||
@ -221,7 +216,7 @@ void tst_QPdfWriter::testPageMetrics()
|
|||||||
|
|
||||||
// Now while in Landscape mode, set the size again, results should be the same
|
// Now while in Landscape mode, set the size again, results should be the same
|
||||||
if (pageSize < 0) {
|
if (pageSize < 0) {
|
||||||
writer.setPageSizeMM(sizeMMf);
|
writer.setPageSize(QPageSize(sizeMMf, QPageSize::Millimeter));
|
||||||
QCOMPARE(writer.pageSize(), QPdfWriter::Custom);
|
QCOMPARE(writer.pageSize(), QPdfWriter::Custom);
|
||||||
QCOMPARE(writer.pageLayout().pageSize().id(), QPageSize::Custom);
|
QCOMPARE(writer.pageLayout().pageSize().id(), QPageSize::Custom);
|
||||||
} else {
|
} else {
|
||||||
@ -255,7 +250,7 @@ void tst_QPdfWriter::qtbug59443()
|
|||||||
QTemporaryFile file;
|
QTemporaryFile file;
|
||||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||||
QPdfWriter writer(file.fileName());
|
QPdfWriter writer(file.fileName());
|
||||||
writer.setPageSize(QPdfWriter::A4);
|
writer.setPageSize(QPageSize(QPageSize::A4));
|
||||||
QTextDocument doc;
|
QTextDocument doc;
|
||||||
doc.documentLayout()->setPaintDevice(&writer);
|
doc.documentLayout()->setPaintDevice(&writer);
|
||||||
|
|
||||||
|
@ -944,7 +944,7 @@ void tst_QTextDocumentFragment::namedAnchorFragments3()
|
|||||||
|
|
||||||
QCOMPARE(it.fragment().text(), QString::fromLatin1("T"));
|
QCOMPARE(it.fragment().text(), QString::fromLatin1("T"));
|
||||||
QVERIFY(it.fragment().charFormat().isAnchor());
|
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";
|
QStringList targets; targets << "target" << "target2";
|
||||||
QCOMPARE(it.fragment().charFormat().anchorNames(), targets);
|
QCOMPARE(it.fragment().charFormat().anchorNames(), targets);
|
||||||
|
|
||||||
|
@ -2228,7 +2228,6 @@ void tst_QTextLayout::superscriptCrash_qtbug53911()
|
|||||||
for (int j = 0; j < 4; ++j) {
|
for (int j = 0; j < 4; ++j) {
|
||||||
QTextLayout* newTextLayout = new QTextLayout();
|
QTextLayout* newTextLayout = new QTextLayout();
|
||||||
newTextLayout->setText(layoutText);
|
newTextLayout->setText(layoutText);
|
||||||
QList<QTextLayout::FormatRange> formatRanges;
|
|
||||||
QTextLayout::FormatRange formatRange;
|
QTextLayout::FormatRange formatRange;
|
||||||
|
|
||||||
formatRange.format.setFont(QFont());
|
formatRange.format.setFont(QFont());
|
||||||
@ -2257,8 +2256,7 @@ void tst_QTextLayout::superscriptCrash_qtbug53911()
|
|||||||
|
|
||||||
formatRange.start = 0;
|
formatRange.start = 0;
|
||||||
formatRange.length = layoutText.size();
|
formatRange.length = layoutText.size();
|
||||||
formatRanges << formatRange;
|
newTextLayout->setFormats({formatRange});
|
||||||
newTextLayout->setAdditionalFormats(formatRanges);
|
|
||||||
|
|
||||||
textLayouts.push_front(newTextLayout);
|
textLayouts.push_front(newTextLayout);
|
||||||
}
|
}
|
||||||
@ -2289,10 +2287,7 @@ void tst_QTextLayout::nbspWithFormat()
|
|||||||
formatRange.length = 1;
|
formatRange.length = 1;
|
||||||
formatRange.format.setFontUnderline(true);
|
formatRange.format.setFontUnderline(true);
|
||||||
|
|
||||||
QList<QTextLayout::FormatRange> overrides;
|
layout.setFormats({formatRange});
|
||||||
overrides.append(formatRange);
|
|
||||||
|
|
||||||
layout.setAdditionalFormats(overrides);
|
|
||||||
|
|
||||||
layout.beginLayout();
|
layout.beginLayout();
|
||||||
forever {
|
forever {
|
||||||
@ -2327,7 +2322,7 @@ void tst_QTextLayout::koreanWordWrap()
|
|||||||
QTextLine line = layout.createLine();
|
QTextLine line = layout.createLine();
|
||||||
if (!line.isValid())
|
if (!line.isValid())
|
||||||
break;
|
break;
|
||||||
line.setLineWidth(metrics.width(s) * 0.8);
|
line.setLineWidth(metrics.horizontalAdvance(s) * 0.8);
|
||||||
}
|
}
|
||||||
layout.endLayout();
|
layout.endLayout();
|
||||||
QCOMPARE(layout.lineCount(), 2);
|
QCOMPARE(layout.lineCount(), 2);
|
||||||
|
@ -314,7 +314,7 @@ void tst_QTextList::partialRemoval()
|
|||||||
selection.deleteChar(); // deletes the second list
|
selection.deleteChar(); // deletes the second list
|
||||||
|
|
||||||
QVERIFY(!secondList);
|
QVERIFY(!secondList);
|
||||||
QVERIFY(!firstList->isEmpty());
|
QVERIFY(firstList->count() > 0);
|
||||||
|
|
||||||
doc->undo();
|
doc->undo();
|
||||||
}
|
}
|
||||||
|
@ -1557,7 +1557,7 @@ void tst_QNetworkReply::initTestCase()
|
|||||||
|
|
||||||
QDir::setSearchPaths("testdata", QStringList() << testDataDir);
|
QDir::setSearchPaths("testdata", QStringList() << testDataDir);
|
||||||
#ifndef QT_NO_SSL
|
#ifndef QT_NO_SSL
|
||||||
QSslSocket::defaultCaCertificates(); //preload certificates
|
QSslConfiguration::defaultConfiguration().caCertificates(); //preload certificates
|
||||||
#endif
|
#endif
|
||||||
#ifndef QT_NO_BEARERMANAGEMENT
|
#ifndef QT_NO_BEARERMANAGEMENT
|
||||||
netConfMan = new QNetworkConfigurationManager(this);
|
netConfMan = new QNetworkConfigurationManager(this);
|
||||||
@ -8148,16 +8148,17 @@ void tst_QNetworkReply::backgroundRequest()
|
|||||||
SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
|
SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QWeakPointer<const QNetworkSession> session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
const QWeakPointer<const QNetworkSession> sessionWeakPtr = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||||
QVERIFY(session);
|
QVERIFY(!sessionWeakPtr.isNull());
|
||||||
QNetworkSession::UsagePolicies original = session.data()->usagePolicies();
|
auto session = const_cast<QNetworkSession *>(sessionWeakPtr.toStrongRef().data());
|
||||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), QNetworkSession::UsagePolicies(policy));
|
QNetworkSession::UsagePolicies original = session->usagePolicies();
|
||||||
|
QNetworkSessionPrivate::setUsagePolicies(*session, QNetworkSession::UsagePolicies(policy));
|
||||||
|
|
||||||
QNetworkReplyPtr reply(manager.get(request));
|
QNetworkReplyPtr reply(manager.get(request));
|
||||||
|
|
||||||
QVERIFY(waitForFinish(reply) != Timeout);
|
QVERIFY(waitForFinish(reply) != Timeout);
|
||||||
if (session)
|
if (session)
|
||||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), original);
|
QNetworkSessionPrivate::setUsagePolicies(*session, original);
|
||||||
|
|
||||||
QVERIFY(reply->isFinished());
|
QVERIFY(reply->isFinished());
|
||||||
QCOMPARE(reply->error(), error);
|
QCOMPARE(reply->error(), error);
|
||||||
@ -8212,10 +8213,11 @@ void tst_QNetworkReply::backgroundRequestInterruption()
|
|||||||
SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
|
SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QWeakPointer<const QNetworkSession> session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
const QWeakPointer<const QNetworkSession> sessionWeakPtr = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||||
QVERIFY(session);
|
QVERIFY(!sessionWeakPtr.isNull());
|
||||||
QNetworkSession::UsagePolicies original = session.data()->usagePolicies();
|
auto session = const_cast<QNetworkSession *>(sessionWeakPtr.toStrongRef().data());
|
||||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), QNetworkSession::NoPolicy);
|
QNetworkSession::UsagePolicies original = session->usagePolicies();
|
||||||
|
QNetworkSessionPrivate::setUsagePolicies(*session, QNetworkSession::NoPolicy);
|
||||||
|
|
||||||
request.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, 8192);
|
request.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, 8192);
|
||||||
QNetworkReplyPtr reply(manager.get(request));
|
QNetworkReplyPtr reply(manager.get(request));
|
||||||
@ -8224,14 +8226,14 @@ void tst_QNetworkReply::backgroundRequestInterruption()
|
|||||||
QSignalSpy spy(reply.data(), SIGNAL(readyRead()));
|
QSignalSpy spy(reply.data(), SIGNAL(readyRead()));
|
||||||
QTRY_VERIFY(spy.count() > 0);
|
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.
|
// After we have changed the policy we can download at full speed.
|
||||||
reply->setReadBufferSize(0);
|
reply->setReadBufferSize(0);
|
||||||
|
|
||||||
QVERIFY(waitForFinish(reply) != Timeout);
|
QVERIFY(waitForFinish(reply) != Timeout);
|
||||||
if (session)
|
if (session)
|
||||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), original);
|
QNetworkSessionPrivate::setUsagePolicies(*session, original);
|
||||||
|
|
||||||
QVERIFY(reply->isFinished());
|
QVERIFY(reply->isFinished());
|
||||||
QCOMPARE(reply->error(), error);
|
QCOMPARE(reply->error(), error);
|
||||||
@ -8271,8 +8273,8 @@ void tst_QNetworkReply::backgroundRequestConnectInBackground()
|
|||||||
|
|
||||||
QWeakPointer<const QNetworkSession> session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
QWeakPointer<const QNetworkSession> session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||||
//force QNAM to reopen the session.
|
//force QNAM to reopen the session.
|
||||||
if (session && session.data()->isOpen()) {
|
if (session && session.toStrongRef().data()->isOpen()) {
|
||||||
const_cast<QNetworkSession *>(session.data())->close();
|
const_cast<QNetworkSession *>(session.toStrongRef().data())->close();
|
||||||
QCoreApplication::processEvents(); //let signals propagate inside QNAM
|
QCoreApplication::processEvents(); //let signals propagate inside QNAM
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8281,19 +8283,19 @@ void tst_QNetworkReply::backgroundRequestConnectInBackground()
|
|||||||
|
|
||||||
session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||||
QVERIFY(session);
|
QVERIFY(session);
|
||||||
QNetworkSession::UsagePolicies original = session.data()->usagePolicies();
|
QNetworkSession::UsagePolicies original = session.toStrongRef().data()->usagePolicies();
|
||||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), QNetworkSession::NoPolicy);
|
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.toStrongRef().data()), QNetworkSession::NoPolicy);
|
||||||
|
|
||||||
QNetworkReplyPtr reply(manager.get(request));
|
QNetworkReplyPtr reply(manager.get(request));
|
||||||
|
|
||||||
QVERIFY(waitForFinish(reply) != Timeout);
|
QVERIFY(waitForFinish(reply) != Timeout);
|
||||||
session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
session = QNetworkAccessManagerPrivate::getNetworkSession(&manager);
|
||||||
if (session) {
|
if (session) {
|
||||||
QVariant cib = session.data()->sessionProperty(QStringLiteral("ConnectInBackground"));
|
QVariant cib = session.toStrongRef().data()->sessionProperty(QStringLiteral("ConnectInBackground"));
|
||||||
if (!cib.isValid())
|
if (!cib.isValid())
|
||||||
QSKIP("inconclusive - ConnectInBackground session property not supported by the bearer plugin");
|
QSKIP("inconclusive - ConnectInBackground session property not supported by the bearer plugin");
|
||||||
QCOMPARE(cib.toBool(), background);
|
QCOMPARE(cib.toBool(), background);
|
||||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), original);
|
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.toStrongRef().data()), original);
|
||||||
} else {
|
} else {
|
||||||
QSKIP("inconclusive - network session has been destroyed");
|
QSKIP("inconclusive - network session has been destroyed");
|
||||||
}
|
}
|
||||||
|
@ -1315,7 +1315,9 @@ void tst_QPrinter::pageSize()
|
|||||||
// Test set/get
|
// Test set/get
|
||||||
QPrinter::PaperSize expected = QPrinter::A4;
|
QPrinter::PaperSize expected = QPrinter::A4;
|
||||||
QPrinterInfo info = QPrinterInfo::printerInfo(native.printerName());
|
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()) {
|
if (supported != QPrinter::Custom && supported != native.paperSize()) {
|
||||||
expected = supported;
|
expected = supported;
|
||||||
break;
|
break;
|
||||||
@ -1359,7 +1361,9 @@ void tst_QPrinter::paperSize()
|
|||||||
// Test set/get
|
// Test set/get
|
||||||
QPrinter::PaperSize expected = QPrinter::A4;
|
QPrinter::PaperSize expected = QPrinter::A4;
|
||||||
QPrinterInfo info = QPrinterInfo::printerInfo(native.printerName());
|
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()) {
|
if (supported != QPrinter::Custom && supported != native.paperSize()) {
|
||||||
expected = supported;
|
expected = supported;
|
||||||
break;
|
break;
|
||||||
|
@ -300,8 +300,11 @@ void tst_QPrinterInfo::testConstructors()
|
|||||||
QCOMPARE(copy1.supportsCustomPageSizes(), printers.at(i).supportsCustomPageSizes());
|
QCOMPARE(copy1.supportsCustomPageSizes(), printers.at(i).supportsCustomPageSizes());
|
||||||
QCOMPARE(copy1.minimumPhysicalPageSize(), printers.at(i).minimumPhysicalPageSize());
|
QCOMPARE(copy1.minimumPhysicalPageSize(), printers.at(i).minimumPhysicalPageSize());
|
||||||
QCOMPARE(copy1.maximumPhysicalPageSize(), printers.at(i).maximumPhysicalPageSize());
|
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());
|
QCOMPARE(copy1.supportedSizesWithNames(), printers.at(i).supportedSizesWithNames());
|
||||||
|
QT_WARNING_POP
|
||||||
QCOMPARE(copy1.supportedResolutions(), printers.at(i).supportedResolutions());
|
QCOMPARE(copy1.supportedResolutions(), printers.at(i).supportedResolutions());
|
||||||
QCOMPARE(copy1.defaultDuplexMode(), printers.at(i).defaultDuplexMode());
|
QCOMPARE(copy1.defaultDuplexMode(), printers.at(i).defaultDuplexMode());
|
||||||
QCOMPARE(copy1.supportedDuplexModes(), printers.at(i).supportedDuplexModes());
|
QCOMPARE(copy1.supportedDuplexModes(), printers.at(i).supportedDuplexModes());
|
||||||
@ -321,8 +324,11 @@ void tst_QPrinterInfo::testConstructors()
|
|||||||
QCOMPARE(copy2.supportsCustomPageSizes(), printers.at(i).supportsCustomPageSizes());
|
QCOMPARE(copy2.supportsCustomPageSizes(), printers.at(i).supportsCustomPageSizes());
|
||||||
QCOMPARE(copy2.minimumPhysicalPageSize(), printers.at(i).minimumPhysicalPageSize());
|
QCOMPARE(copy2.minimumPhysicalPageSize(), printers.at(i).minimumPhysicalPageSize());
|
||||||
QCOMPARE(copy2.maximumPhysicalPageSize(), printers.at(i).maximumPhysicalPageSize());
|
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());
|
QCOMPARE(copy2.supportedSizesWithNames(), printers.at(i).supportedSizesWithNames());
|
||||||
|
QT_WARNING_POP
|
||||||
QCOMPARE(copy2.supportedResolutions(), printers.at(i).supportedResolutions());
|
QCOMPARE(copy2.supportedResolutions(), printers.at(i).supportedResolutions());
|
||||||
QCOMPARE(copy2.defaultDuplexMode(), printers.at(i).defaultDuplexMode());
|
QCOMPARE(copy2.defaultDuplexMode(), printers.at(i).defaultDuplexMode());
|
||||||
QCOMPARE(copy2.supportedDuplexModes(), printers.at(i).supportedDuplexModes());
|
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('Q') << quint8(image.format());
|
||||||
out << quint8(QSysInfo::ByteOrder) << quint8(0); // pad to multiple of 4 bytes
|
out << quint8(QSysInfo::ByteOrder) << quint8(0); // pad to multiple of 4 bytes
|
||||||
out << quint32(image.width()) << quint32(image.height()) << quint32(image.bytesPerLine());
|
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
|
//# can be followed by colormap for formats that use it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user