From 6cd1d6e9271cf07f40682df1fbd1891d13f90d07 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 4 Oct 2021 11:50:56 +0200 Subject: Add lancelot test for smallcaps text path Change-Id: I62b824e852fe6c05afabbd7ab80efaad5a298f82 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/other/lancelot/paintcommands.cpp | 18 ++++++++++++++++-- tests/auto/other/lancelot/paintcommands.h | 1 + tests/auto/other/lancelot/scripts/smallcaps_path.qps | 9 +++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 tests/auto/other/lancelot/scripts/smallcaps_path.qps (limited to 'tests/auto/other') diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index b61f170f42..d2e48688f9 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -92,6 +92,14 @@ const char *PaintCommands::fontHintingTable[] = { "Full" }; +const char *PaintCommands::fontCapitalizationTable[] = { + "MixedCase", + "AllUppercase", + "AllLowercase", + "SmallCaps", + "Capitalize" +}; + const char *PaintCommands::clipOperationTable[] = { "NoClip", "ReplaceClip", @@ -305,8 +313,8 @@ void PaintCommands::staticInit() "setCompositionMode ", "setCompositionMode SourceOver"); DECL_PAINTCOMMAND("setFont", command_setFont, - "^setFont\\s+\"([\\w\\s]*)\"\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)$", - "setFont [size] [font weight|font weight enum] [italic] [hinting enum] [underline] [strikeout] [overline]\n - font weight is an integer between 0 and 99", + "^setFont\\s+\"([\\w\\s]*)\"\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)$", + "setFont [size] [font weight|font weight enum] [italic] [hinting enum] [underline] [strikeout] [overline] [capitalization enum]\n - font weight is an integer between 0 and 99", "setFont \"times\" 12"); DECL_PAINTCOMMAND("setPen", command_setPen, "^setPen\\s+#?(\\w*)$", @@ -2145,6 +2153,12 @@ void PaintCommands::command_setFont(QRegularExpressionMatch re) font.setStrikeOut(strikeOut); font.setOverline(overline); + int capitalization = translateEnum(fontCapitalizationTable, caps.at(9), 5); + if (capitalization == -1) + capitalization = 0; + else + font.setCapitalization(QFont::Capitalization(capitalization)); + if (m_verboseMode) printf(" -(lance) setFont(family=%s, size=%d, weight=%d, italic=%d hinting=%s\n", qPrintable(family), size, weight, italic, fontHintingTable[hinting]); diff --git a/tests/auto/other/lancelot/paintcommands.h b/tests/auto/other/lancelot/paintcommands.h index 0f206884ab..15c6d3fa58 100644 --- a/tests/auto/other/lancelot/paintcommands.h +++ b/tests/auto/other/lancelot/paintcommands.h @@ -298,6 +298,7 @@ private: static const char *penStyleTable[]; static const char *fontWeightTable[]; static const char *fontHintingTable[]; + static const char *fontCapitalizationTable[]; static const char *clipOperationTable[]; static const char *spreadMethodTable[]; static const char *coordinateMethodTable[]; diff --git a/tests/auto/other/lancelot/scripts/smallcaps_path.qps b/tests/auto/other/lancelot/scripts/smallcaps_path.qps new file mode 100644 index 0000000000..4e89b50d96 --- /dev/null +++ b/tests/auto/other/lancelot/scripts/smallcaps_path.qps @@ -0,0 +1,9 @@ +# Version: 1 + +setPen black 1 +setBrush 7f7fff + +setFont "times" 50 Light false Default false false false SmallCaps +path_addText text 0 50 "Hello Qt" + +drawPath text -- cgit v1.2.3