diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/gui/text/qfontdatabase/testdata.qrc | 1 | ||||
-rw-r--r-- | tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp | 29 | ||||
-rw-r--r-- | tests/auto/other/lancelot/paintcommands.cpp | 15 | ||||
-rw-r--r-- | tests/auto/other/lancelot/scripts/filltest.qps | 26 | ||||
-rw-r--r-- | tests/auto/other/lancelot/scripts/perspectives2.qps | 14 | ||||
-rw-r--r-- | tests/auto/shared/resources/testfont_open.otf | bin | 0 -> 62676 bytes |
6 files changed, 62 insertions, 23 deletions
diff --git a/tests/auto/gui/text/qfontdatabase/testdata.qrc b/tests/auto/gui/text/qfontdatabase/testdata.qrc index 224e845601..a590099b20 100644 --- a/tests/auto/gui/text/qfontdatabase/testdata.qrc +++ b/tests/auto/gui/text/qfontdatabase/testdata.qrc @@ -4,5 +4,6 @@ <file alias="testfont.ttf">../../../shared/resources/testfont.ttf</file> <file alias="testfont_condensed.ttf">../../../shared/resources/testfont_condensed.ttf</file> <file alias="testfont_italic.ttf">../../../shared/resources/testfont_italic.ttf</file> + <file alias="testfont_open.otf">../../../shared/resources/testfont_open.otf</file> </qresource> </RCC> diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index 2b69801b59..12e8083622 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -76,6 +76,9 @@ private slots: void rasterFonts(); void smoothFonts(); + void registerOpenTypePreferredNamesSystem(); + void registerOpenTypePreferredNamesApplication(); + private: QString m_ledFont; QString m_testFont; @@ -440,5 +443,31 @@ void tst_QFontDatabase::smoothFonts() QVERIFY(!QFontDatabase().isBitmapScalable(font.family())); } +void tst_QFontDatabase::registerOpenTypePreferredNamesSystem() +{ + QFontDatabase db; + // This font family was picked because it was the only one I had installed which showcased the + // problem + if (!db.hasFamily(QString::fromLatin1("Source Code Pro ExtraLight"))) + QSKIP("Source Code Pro ExtraLight is not installed"); + + QStringList styles = db.styles(QString::fromLatin1("Source Code Pro")); + QVERIFY(styles.contains(QLatin1String("ExtraLight"))); +} + +void tst_QFontDatabase::registerOpenTypePreferredNamesApplication() +{ + QFontDatabase db; + + int id = QFontDatabase::addApplicationFont(QString::fromLatin1(":/testfont_open.otf")); + if (id == -1) + QSKIP("Skip the test since app fonts are not supported on this system"); + + QStringList styles = db.styles(QString::fromLatin1("QtBidiTestFont")); + QVERIFY(styles.contains(QLatin1String("Open"))); + + QFontDatabase::removeApplicationFont(id); +} + QTEST_MAIN(tst_QFontDatabase) #include "tst_qfontdatabase.moc" diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 215a4c2a29..7430c93a8e 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -230,9 +230,9 @@ void PaintCommands::staticInit() "begin_block <blockName>", "begin_block blockName"); DECL_PAINTCOMMAND("end_block", command_end_block, - "^end_block$", - "end_block", - "end_block"); + "^end_block\\s*(\\w*)$", + "end_block [blockName]", + "end_block blockName"); DECL_PAINTCOMMAND("repeat_block", command_repeat_block, "^repeat_block\\s+(\\w*)$", "repeat_block <blockName>", @@ -744,6 +744,13 @@ void PaintCommands::runCommands() if (height <= 0) height = 800; + m_pathMap.clear(); + m_imageMap.clear(); + m_pixmapMap.clear(); + m_regionMap.clear(); + m_gradientStops.clear(); + m_blockMap.clear(); + // paint background if (m_checkers_background) { QPixmap pm(20, 20); @@ -901,6 +908,8 @@ void PaintCommands::command_begin_block(QRegularExpressionMatch re) const QString &blockName = re.captured(1); if (m_verboseMode) printf(" -(lance) begin_block (%s)\n", qPrintable(blockName)); + if (m_blockMap.contains(blockName)) + qFatal("Two blocks named (%s)", qPrintable(blockName)); m_commands[m_currentCommandIndex] = QLatin1String("# begin block (") + blockName + QLatin1Char(')'); QStringList newBlock; diff --git a/tests/auto/other/lancelot/scripts/filltest.qps b/tests/auto/other/lancelot/scripts/filltest.qps index 2eeba2ecf6..112ffc85be 100644 --- a/tests/auto/other/lancelot/scripts/filltest.qps +++ b/tests/auto/other/lancelot/scripts/filltest.qps @@ -133,7 +133,7 @@ setPen nopen translate 50 0 -begin_block rects +begin_block rects2 drawPath rect drawRect 0 20 10 10 drawImage img 0 40 @@ -154,59 +154,59 @@ translate 10 20 rotate 90 drawRect 0 0 10 10 restore -end_block rects +end_block rects2 setPen red drawText -5 -10 "0.0" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.1" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.2" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.3" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.4" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.5" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.6" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.7" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.8" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "0.9" setPen nopen translate 40 0.1 -repeat_block rects +repeat_block rects2 setPen red drawText -5 -10 "1.0" setPen nopen @@ -410,4 +410,4 @@ drawText 0 0 "outline/fill consistency" setPen red setBrush green translate 80 -30 -drawPolygon [13.6965 -99.1837 -71.4767 13.823 32.4596 -33.1847]
\ No newline at end of file +drawPolygon [13.6965 -99.1837 -71.4767 13.823 32.4596 -33.1847] diff --git a/tests/auto/other/lancelot/scripts/perspectives2.qps b/tests/auto/other/lancelot/scripts/perspectives2.qps index 2f6d1d653c..6762e21af4 100644 --- a/tests/auto/other/lancelot/scripts/perspectives2.qps +++ b/tests/auto/other/lancelot/scripts/perspectives2.qps @@ -8,7 +8,7 @@ image_convertToFormat zebra_png zebra ARGB32_Premultiplied translate 75 100 # standard draw -begin_block row +begin_block row1 drawImage zebra -50 -50 translate 90 0 @@ -136,12 +136,12 @@ save rotate_y 180 drawImage zebra -50 -50 restore -end_block +end_block row1 resetMatrix translate 75 280 setRenderHint SmoothPixmapTransform -repeat_block row +repeat_block row1 resetMatrix setPen black @@ -162,7 +162,7 @@ setRenderHint SmoothPixmapTransform false translate 75 100 # standard draw -begin_block row +begin_block row2 drawImage dome -50 -50 translate 90 0 @@ -290,13 +290,13 @@ save rotate_y 180 drawImage dome -50 -50 restore -end_block +end_block row2 resetMatrix translate 0 400 translate 75 280 setRenderHint SmoothPixmapTransform -repeat_block row +repeat_block row2 resetMatrix setPen black @@ -306,4 +306,4 @@ drawText 0 0 "Fast Pixmap Transform" resetMatrix translate 0 400 translate 300 210 -drawText 0 0 "Smooth Pixmap Transform"
\ No newline at end of file +drawText 0 0 "Smooth Pixmap Transform" diff --git a/tests/auto/shared/resources/testfont_open.otf b/tests/auto/shared/resources/testfont_open.otf Binary files differnew file mode 100644 index 0000000000..0f7950f2dd --- /dev/null +++ b/tests/auto/shared/resources/testfont_open.otf |