summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-08-19 11:52:07 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-08-25 17:59:10 +0200
commitb77a3f47c9d6f4fd68a687e3bdb38e550d2810ad (patch)
tree0849ece35646b7847218a54005ff512ae25eda5d /tests
parentc0d0949448c5a75d50ca189974d4d9f48133aea8 (diff)
Rename confusingly named QFont/QPalette::resolve overloads
Having three methods with the same name doing different things is unnecessarily confusing, so follow the standard naming convention in Qt and call the getter of the resolve mask resolveMask, and the setter setResolveMask. These methods were all documented as internal. The publicly documented resolve() method that merges two fonts and palettes based on the respective masks remains as it is, even though 'merge' would perhaps be a better name. Change-Id: If90b1ad800834baccd1dbc38fc6b861540d6df6e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp4
-rw-r--r--tests/auto/gui/kernel/qpalette/tst_qpalette.cpp6
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp10
-rw-r--r--tests/auto/gui/text/qtextformat/tst_qtextformat.cpp16
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp66
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp10
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp8
-rw-r--r--tests/manual/textrendering/nativetext/main.cpp2
8 files changed, 61 insertions, 61 deletions
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index 0d8e68f3f8..e0415441b9 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -510,7 +510,7 @@ void tst_QGuiApplication::keyboardModifiers()
*/
static bool palettesMatch(const QPalette &actual, const QPalette &expected)
{
- if (actual.resolve() != expected.resolve())
+ if (actual.resolveMask() != expected.resolveMask())
return false;
for (int i = 0; i < QPalette::NColorGroups; i++) {
@@ -541,7 +541,7 @@ void tst_QGuiApplication::palette()
QCOMPARE(QGuiApplication::palette(), QPalette());
// The default application palette is not resolved
- QVERIFY(!QGuiApplication::palette().resolve());
+ QVERIFY(!QGuiApplication::palette().resolveMask());
QSignalSpy signalSpy(&app, SIGNAL(paletteChanged(QPalette)));
diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp
index 04343727bb..cd968100e6 100644
--- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp
+++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp
@@ -132,7 +132,7 @@ static void compareAllPaletteData(const QPalette &firstPalette, const QPalette &
// For historical reasons, operator== compares only brushes, but it's not enough for proper
// comparison after move/copy, because some additional data can also be moved/copied.
// Let's compare this data here.
- QCOMPARE(firstPalette.resolve(), secondPalette.resolve());
+ QCOMPARE(firstPalette.resolveMask(), secondPalette.resolveMask());
QCOMPARE(firstPalette.currentColorGroup(), secondPalette.currentColorGroup());
}
@@ -233,7 +233,7 @@ void tst_QPalette::setAllPossibleBrushes()
{
QPalette p;
- QCOMPARE(p.resolve(), QPalette::ResolveMask(0));
+ QCOMPARE(p.resolveMask(), QPalette::ResolveMask(0));
for (int r = 0; r < QPalette::NColorRoles; ++r) {
p.setBrush(QPalette::All, QPalette::ColorRole(r), Qt::red);
@@ -248,7 +248,7 @@ void tst_QPalette::setAllPossibleBrushes()
void tst_QPalette::noBrushesSetForDefaultPalette()
{
- QCOMPARE(QPalette().resolve(), QPalette::ResolveMask(0));
+ QCOMPARE(QPalette().resolveMask(), QPalette::ResolveMask(0));
}
void tst_QPalette::cannotCheckIfInvalidBrushSet()
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index 83d8d01062..5e4fdfcdc9 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -322,22 +322,22 @@ void tst_QFont::resetFont()
QWidget secondChild(&parent);
secondChild.setFont(childFont);
- QVERIFY(parentFont.resolve() != 0);
- QVERIFY(childFont.resolve() != 0);
+ QVERIFY(parentFont.resolveMask() != 0);
+ QVERIFY(childFont.resolveMask() != 0);
QVERIFY(childFont != parentFont);
// reset font on both children
firstChild.setFont(QFont());
secondChild.setFont(QFont());
- QCOMPARE(firstChild.font().resolve(), QFont::SizeResolved);
- QCOMPARE(secondChild.font().resolve(), QFont::SizeResolved);
+ QCOMPARE(firstChild.font().resolveMask(), QFont::SizeResolved);
+ QCOMPARE(secondChild.font().resolveMask(), QFont::SizeResolved);
#ifdef Q_OS_ANDROID
QEXPECT_FAIL("", "QTBUG-69214", Continue);
#endif
QCOMPARE(firstChild.font().pointSize(), parent.font().pointSize());
QCOMPARE(secondChild.font().pointSize(), parent.font().pointSize());
- QVERIFY(parent.font().resolve() != 0);
+ QVERIFY(parent.font().resolveMask() != 0);
}
#endif
diff --git a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp
index 7548dbb8e4..ef5e3a0e0b 100644
--- a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp
+++ b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp
@@ -535,19 +535,19 @@ void tst_QTextFormat::setFont()
QCOMPARE((int)f.font().capitalization(), (int)f.fontCapitalization());
QCOMPARE(f.font().kerning(), f.fontKerning());
- if (overrideAll || (font2.resolve() & QFont::StyleHintResolved))
+ if (overrideAll || (font2.resolveMask() & QFont::StyleHintResolved))
QCOMPARE((int)f.font().styleHint(), (int)font2.styleHint());
else
QCOMPARE((int)f.font().styleHint(), (int)font1.styleHint());
- if (overrideAll || (font2.resolve() & QFont::StyleStrategyResolved))
+ if (overrideAll || (font2.resolveMask() & QFont::StyleStrategyResolved))
QCOMPARE((int)f.font().styleStrategy(), (int)font2.styleStrategy());
else
QCOMPARE((int)f.font().styleStrategy(), (int)font1.styleStrategy());
- if (overrideAll || (font2.resolve() & QFont::CapitalizationResolved))
+ if (overrideAll || (font2.resolveMask() & QFont::CapitalizationResolved))
QCOMPARE((int)f.font().capitalization(), (int)font2.capitalization());
else
QCOMPARE((int)f.font().capitalization(), (int)font1.capitalization());
- if (overrideAll || (font2.resolve() & QFont::KerningResolved))
+ if (overrideAll || (font2.resolveMask() & QFont::KerningResolved))
QCOMPARE(f.font().kerning(), font2.kerning());
else
QCOMPARE(f.font().kerning(), font1.kerning());
@@ -639,19 +639,19 @@ void tst_QTextFormat::setFont_collection()
int formatIndex = collection.indexForFormat(tmp);
QTextCharFormat f = collection.charFormat(formatIndex);
- if (overrideAll || (font2.resolve() & QFont::StyleHintResolved))
+ if (overrideAll || (font2.resolveMask() & QFont::StyleHintResolved))
QCOMPARE((int)f.font().styleHint(), (int)font2.styleHint());
else
QCOMPARE((int)f.font().styleHint(), (int)font1.styleHint());
- if (overrideAll || (font2.resolve() & QFont::StyleStrategyResolved))
+ if (overrideAll || (font2.resolveMask() & QFont::StyleStrategyResolved))
QCOMPARE((int)f.font().styleStrategy(), (int)font2.styleStrategy());
else
QCOMPARE((int)f.font().styleStrategy(), (int)font1.styleStrategy());
- if (overrideAll || (font2.resolve() & QFont::CapitalizationResolved))
+ if (overrideAll || (font2.resolveMask() & QFont::CapitalizationResolved))
QCOMPARE((int)f.font().capitalization(), (int)font2.capitalization());
else
QCOMPARE((int)f.font().capitalization(), (int)font1.capitalization());
- if (overrideAll || (font2.resolve() & QFont::KerningResolved))
+ if (overrideAll || (font2.resolveMask() & QFont::KerningResolved))
QCOMPARE(f.font().kerning(), font2.kerning());
else
QCOMPARE(f.font().kerning(), font1.kerning());
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 882aa8bcbd..4298cc3da7 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -640,11 +640,11 @@ void tst_QGraphicsWidget::fontPropagatesResolveToChildren()
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
- QCOMPARE(font.resolve(), uint(QFont::StyleResolved));
- QCOMPARE(root->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(child1->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(child2->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(child3->font().resolve(), uint(QFont::StyleResolved));
+ QCOMPARE(font.resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(root->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(child1->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(child2->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(child3->font().resolveMask(), uint(QFont::StyleResolved));
}
void tst_QGraphicsWidget::fontPropagatesResolveToGrandChildren()
@@ -675,12 +675,12 @@ void tst_QGraphicsWidget::fontPropagatesResolveToGrandChildren()
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
- QCOMPARE(font.resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild3->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild4->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild5->font().resolve(), uint(QFont::StyleResolved));
+ QCOMPARE(font.resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild1->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild2->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild3->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild4->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild5->font().resolveMask(), uint(QFont::StyleResolved));
}
void tst_QGraphicsWidget::fontPropagatesResolveViaNonWidget()
@@ -711,12 +711,12 @@ void tst_QGraphicsWidget::fontPropagatesResolveViaNonWidget()
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
- QCOMPARE(font.resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild3->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild4->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild5->font().resolve(), uint(QFont::StyleResolved));
+ QCOMPARE(font.resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild1->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild2->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild3->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild4->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild5->font().resolveMask(), uint(QFont::StyleResolved));
}
void tst_QGraphicsWidget::fontPropagatesResolveFromScene()
@@ -747,16 +747,16 @@ void tst_QGraphicsWidget::fontPropagatesResolveFromScene()
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
- QCOMPARE(font.resolve(), uint(QFont::StyleResolved));
- QCOMPARE(root->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(child1->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(child2->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(child3->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild3->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild4->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild5->font().resolve(), uint(QFont::StyleResolved));
+ QCOMPARE(font.resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(root->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(child1->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(child2->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(child3->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild1->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild2->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild3->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild4->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild5->font().resolveMask(), uint(QFont::StyleResolved));
}
void tst_QGraphicsWidget::fontPropagatesResolveInParentChange()
@@ -785,8 +785,8 @@ void tst_QGraphicsWidget::fontPropagatesResolveInParentChange()
QVERIFY(!grandChild2->font().italic());
QVERIFY(grandChild2->font().bold());
- QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild2->font().resolve(), uint(QFont::WeightResolved));
+ QCOMPARE(grandChild1->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild2->font().resolveMask(), uint(QFont::WeightResolved));
grandChild2->setParentItem(child1);
@@ -800,8 +800,8 @@ void tst_QGraphicsWidget::fontPropagatesResolveInParentChange()
QVERIFY(grandChild2->font().italic());
QVERIFY(!grandChild2->font().bold());
- QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved));
- QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild1->font().resolveMask(), uint(QFont::StyleResolved));
+ QCOMPARE(grandChild2->font().resolveMask(), uint(QFont::StyleResolved));
}
@@ -911,12 +911,12 @@ void tst_QGraphicsWidget::fontPropagationWidgetItemWidget()
widget->setFont(font);
QCOMPARE(widget2->font().pointSize(), 43);
- QCOMPARE(widget2->font().resolve(), uint(QFont::SizeResolved));
+ QCOMPARE(widget2->font().resolveMask(), uint(QFont::SizeResolved));
widget->setFont(QFont());
QCOMPARE(widget2->font().pointSize(), qApp->font().pointSize());
- QCOMPARE(widget2->font().resolve(), QFont().resolve());
+ QCOMPARE(widget2->font().resolveMask(), QFont().resolveMask());
}
void tst_QGraphicsWidget::fontPropagationSceneChange()
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 611ae3474b..0ba42c0e36 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -1836,7 +1836,7 @@ void tst_QApplication::applicationPalettePolish()
qputenv("QT_DESKTOP_STYLE_KEY", "customstyle");
QApplication app(argc, &argv0);
QVERIFY(CustomStyle::polished);
- QVERIFY(!app.palette().resolve());
+ QVERIFY(!app.palette().resolveMask());
QCOMPARE(app.palette().color(QPalette::Link), Qt::red);
qunsetenv("QT_DESKTOP_STYLE_KEY");
}
@@ -1846,7 +1846,7 @@ void tst_QApplication::applicationPalettePolish()
QApplication::setStyle(new CustomStyle);
QApplication app(argc, &argv0);
QVERIFY(CustomStyle::polished);
- QVERIFY(!app.palette().resolve());
+ QVERIFY(!app.palette().resolveMask());
QCOMPARE(app.palette().color(QPalette::Link), Qt::red);
}
@@ -1854,13 +1854,13 @@ void tst_QApplication::applicationPalettePolish()
QApplication app(argc, &argv0);
app.setStyle(new CustomStyle);
QVERIFY(CustomStyle::polished);
- QVERIFY(!app.palette().resolve());
+ QVERIFY(!app.palette().resolveMask());
QCOMPARE(app.palette().color(QPalette::Link), Qt::red);
CustomStyle::polished = 0;
app.setPalette(QPalette());
QVERIFY(CustomStyle::polished);
- QVERIFY(!app.palette().resolve());
+ QVERIFY(!app.palette().resolveMask());
QCOMPARE(app.palette().color(QPalette::Link), Qt::red);
CustomStyle::polished = 0;
@@ -1868,7 +1868,7 @@ void tst_QApplication::applicationPalettePolish()
palette.setColor(QPalette::Active, QPalette::Highlight, Qt::green);
app.setPalette(palette);
QVERIFY(CustomStyle::polished);
- QVERIFY(app.palette().resolve());
+ QVERIFY(app.palette().resolveMask());
QCOMPARE(app.palette().color(QPalette::Link), Qt::red);
QCOMPARE(app.palette().color(QPalette::Highlight), Qt::green);
}
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 00939e5118..b61faf6c2b 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -2111,13 +2111,13 @@ void tst_QStyleSheetStyle::widgetStylePropagation()
QLabel childLabel(&parentLabel);
childLabel.setObjectName("childLabel");
- if (parentFont.resolve())
+ if (parentFont.resolveMask())
parentLabel.setFont(parentFont);
- if (childFont.resolve())
+ if (childFont.resolveMask())
childLabel.setFont(childFont);
- if (parentPalette.resolve())
+ if (parentPalette.resolveMask())
parentLabel.setPalette(parentPalette);
- if (childPalette.resolve())
+ if (childPalette.resolveMask())
childLabel.setPalette(childPalette);
if (!parentStyleSheet.isEmpty())
parentLabel.setStyleSheet(parentStyleSheet);
diff --git a/tests/manual/textrendering/nativetext/main.cpp b/tests/manual/textrendering/nativetext/main.cpp
index b481e44bae..ae87dfa929 100644
--- a/tests/manual/textrendering/nativetext/main.cpp
+++ b/tests/manual/textrendering/nativetext/main.cpp
@@ -125,7 +125,7 @@ public:
p.setPen(palette().text().color());
QFont f = font();
- f.resolve(-1);
+ f.setResolveMask(-1);
p.setFont(f);
p.drawText(QPoint(0, ascent), text());