diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-05-18 12:59:14 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-05-18 13:07:53 (GMT) |
commit | e8ac2b958d92319da7c725f0c30f8ba5fe06497b (patch) | |
tree | bb3c2748ee8db5639c14dcbbdc6f9c269f5414e0 /tests | |
parent | 3c40b1af35319f1fd1b10c97b954adff3abbe9b0 (diff) | |
download | Qt-e8ac2b958d92319da7c725f0c30f8ba5fe06497b.zip Qt-e8ac2b958d92319da7c725f0c30f8ba5fe06497b.tar.gz Qt-e8ac2b958d92319da7c725f0c30f8ba5fe06497b.tar.bz2 |
QCss: font-family handle fallback font specs
if one specify more than one parameter in font-family,
e.g., font-family: Verdana, Arial
Qt should fallback on the second font if the first cannot be found.
QFont::setFamily handle the case when the family name contains a comas,
so we do not need to handle that specially in the css parser code.
Task-number: 252311
Reviewed-by: Thomas Zander
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qcssparser/tst_cssparser.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/auto/qcssparser/tst_cssparser.cpp b/tests/auto/qcssparser/tst_cssparser.cpp index ab6bad6..7c4fac1 100644 --- a/tests/auto/qcssparser/tst_cssparser.cpp +++ b/tests/auto/qcssparser/tst_cssparser.cpp @@ -123,7 +123,7 @@ static void debug(const QVector<QCss::Symbol> &symbols, int index = -1) qDebug() << "failure at index" << index; } -static void debug(const QCss::Parser &p) { debug(p.symbols); } +//static void debug(const QCss::Parser &p) { debug(p.symbols); } void tst_CssParser::scanner() { @@ -1473,7 +1473,12 @@ void tst_CssParser::extractFontFamily_data() QTest::newRow("quoted-family-name") << "font-family: 'Times New Roman'" << QString("Times New Roman"); QTest::newRow("unquoted-family-name") << "font-family: Times New Roman" << QString("Times New Roman"); QTest::newRow("unquoted-family-name2") << "font-family: Times New Roman" << QString("Times New Roman"); - QTest::newRow("multiple") << "font-family: Times New Roman , foobar, 'baz'" << QString("Times New Roman"); + QTest::newRow("multiple") << "font-family: Times New Roman , foobar, 'baz'" << QString("Times New Roman"); + QTest::newRow("multiple2") << "font-family: invalid, Times New Roman " << QString("Times New Roman"); + QTest::newRow("invalid") << "font-family: invalid" << QFont().family(); + QTest::newRow("shorthand") << "font: 12pt Times New Roman" << QString("Times New Roman"); + QTest::newRow("shorthand multiple quote") << "font: 12pt invalid, \"Times New Roman\" " << QString("Times New Roman"); + QTest::newRow("shorthand multiple") << "font: 12pt invalid, Times New Roman " << QString("Times New Roman"); } void tst_CssParser::extractFontFamily() @@ -1497,8 +1502,8 @@ void tst_CssParser::extractFontFamily() int adjustment = 0; QFont fnt; extractor.extractFont(&fnt, &adjustment); - - QTEST(fnt.family(), "expectedFamily"); + QFontInfo info(fnt); + QTEST(info.family(), "expectedFamily"); } void tst_CssParser::extractBorder_data() |