summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals.cid@kdab.com>2021-10-04 11:50:56 +0200
committerAlbert Astals Cid <albert.astals.cid@kdab.com>2021-10-04 16:10:00 +0200
commit6cd1d6e9271cf07f40682df1fbd1891d13f90d07 (patch)
tree9160c52570e5d395297acd02efb5858b63edc2a1 /tests/auto/other
parent3a8c8e7cf620883af0e2b7ba6bfb1e5fced46b42 (diff)
Add lancelot test for smallcaps text path
Change-Id: I62b824e852fe6c05afabbd7ab80efaad5a298f82 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/lancelot/paintcommands.cpp18
-rw-r--r--tests/auto/other/lancelot/paintcommands.h1
-rw-r--r--tests/auto/other/lancelot/scripts/smallcaps_path.qps9
3 files changed, 26 insertions, 2 deletions
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 <composition mode enum>",
"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 <fontFace> [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 <fontFace> [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