diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-15 13:10:20 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-19 08:06:53 +0000 |
commit | 733ac31cccc6ef9e0f1180f3aa4aa4f7db3fe65d (patch) | |
tree | 8024ed3e18b96690588bd0b8039109e44bded536 /tests/auto/gui/text/qcssparser/tst_qcssparser.cpp | |
parent | 71ae742c1f325a7bc18b3adb8d93d57d3a62e69d (diff) |
tests/auto/gui: Remove some placeholder formatting.
Use QByteArray/QString addition instead in loops and for
test row names.
Change-Id: I31adb60bdaf7ea243143a9244b6c4f66f38b189d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'tests/auto/gui/text/qcssparser/tst_qcssparser.cpp')
-rw-r--r-- | tests/auto/gui/text/qcssparser/tst_qcssparser.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 878c03e563..2308f4f215 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -916,21 +916,37 @@ void tst_QCssParser::marginValue_data() int ex = QFontMetrics(f).xHeight(); int em = QFontMetrics(f).height(); + const QString ex1234 = QString::number(ex) + QLatin1Char(' ') + QString::number(2 * ex) + + QLatin1Char(' ') + QString::number(3 * ex) + QLatin1Char(' ') + + QString::number(4 * ex); + const QString em2ex4 = QLatin1String("1 ") + QString::number(2*em) + QLatin1String(" 3 ") + + QString::number(4 * ex); + QTest::newRow("one value") << "margin: 1px" << "1 1 1 1"; QTest::newRow("two values") << "margin: 1px 2px" << "1 2 1 2"; QTest::newRow("three value") << "margin: 1px 2px 3px" << "1 2 3 2"; QTest::newRow("four values") << "margin: 1px 2px 3px 4px" << "1 2 3 4"; QTest::newRow("default px") << "margin: 1 2 3 4" << "1 2 3 4"; QTest::newRow("no unit") << "margin: 1 2 3 4" << "1 2 3 4"; - QTest::newRow("em") << "margin: 1ex 2ex 3ex 4ex" << QString("%1 %2 %3 %4").arg(ex).arg(2*ex).arg(3*ex).arg(4*ex); - QTest::newRow("ex") << "margin: 1 2em 3px 4ex" << QString("%1 %2 %3 %4").arg(1).arg(2*em).arg(3).arg(4*ex); + QTest::newRow("em") << "margin: 1ex 2ex 3ex 4ex" + << (QString::number(ex) + QLatin1Char(' ') + QString::number(2 * ex) + + QLatin1Char(' ') + QString::number(3 * ex) + QLatin1Char(' ') + + QString::number(4 * ex)); + QTest::newRow("ex") << "margin: 1 2em 3px 4ex" + << (QLatin1String("1 ") + QString::number(2 * em) + QLatin1String(" 3 ") + + QString::number(4 * ex)); f.setPointSize(20); f.setBold(true); ex = QFontMetrics(f).xHeight(); em = QFontMetrics(f).height(); - QTest::newRow("em2") << "font: bold 20pt; margin: 1ex 2ex 3ex 4ex" << QString("%1 %2 %3 %4").arg(ex).arg(2*ex).arg(3*ex).arg(4*ex); - QTest::newRow("ex2") << "margin: 1 2em 3px 4ex; font-size: 20pt; font-weight: bold;" << QString("%1 %2 %3 %4").arg(1).arg(2*em).arg(3).arg(4*ex); + QTest::newRow("em2") << "font: bold 20pt; margin: 1ex 2ex 3ex 4ex" + << (QString::number(ex) + QLatin1Char(' ') + QString::number(2 * ex) + + QLatin1Char(' ') + QString::number(3 * ex) + QLatin1Char(' ') + + QString::number(4 * ex)); + QTest::newRow("ex2") << "margin: 1 2em 3px 4ex; font-size: 20pt; font-weight: bold;" + << (QLatin1String("1 ") + QString::number(2 * em) + QLatin1String(" 3 ") + + QString::number(4 * ex)); QTest::newRow("crap") << "margin: crap" << "0 0 0 0"; } @@ -963,7 +979,8 @@ void tst_QCssParser::marginValue() int p[4]; int spacing; v.extractBox(m, p, &spacing); - QString str = QString("%1 %2 %3 %4").arg(m[0]).arg(m[1]).arg(m[2]).arg(m[3]); + QString str = QString::number(m[0]) + QLatin1Char(' ') + QString::number(m[1]) + + QLatin1Char(' ') + QString::number(m[2]) + QLatin1Char(' ') + QString::number(m[3]); QCOMPARE(str, expectedMargin); } } @@ -1090,7 +1107,7 @@ void tst_QCssParser::styleSelector() QFETCH(QString, xml); QFETCH(QString, elementToCheck); - QString css = QString("%1 { background-color: green }").arg(selector); + const QString css = selector + QLatin1String(" { background-color: green }"); QCss::Parser parser(css); QCss::StyleSheet sheet; QVERIFY(parser.parse(&sheet)); @@ -1154,7 +1171,7 @@ void tst_QCssParser::specificity() { QFETCH(QString, selector); - QString css = QString("%1 { }").arg(selector); + QString css = selector + QLatin1String(" { }"); QCss::Parser parser(css); QCss::StyleSheet sheet; QVERIFY(parser.parse(&sheet)); |