diff options
| author | Eskil Abrahamsen Blomfeldt <[email protected]> | 2025-08-15 08:42:58 +0200 |
|---|---|---|
| committer | Eskil Abrahamsen Blomfeldt <[email protected]> | 2025-08-19 14:03:17 +0200 |
| commit | 7e56f34ca4cb2aa6253be57cbd36087f53121f94 (patch) | |
| tree | 0a2bf9d113c571d4af49933c4a640c94e4c5bd0c /tests/baseline/shared/paintcommands.cpp | |
| parent | c1a4f722eca79a1811304a47349d332d57a86704 (diff) | |
Add Lancelot tests for mnemonics in text
This adds a new paint command drawAlignedText which allows you
to draw text inside a rectangle and provide the text flags.
In addition, it adds a test for mnemonics in text to demonstrate
the issue this introduces with Arabic ligatures.
Pick-to: 6.10
Task-number: QTBUG-93371
Change-Id: Ic3f094f9aa9cdcbecf871a947c71b8e31a97bf44
Reviewed-by: Eirik Aavitsland <[email protected]>
Diffstat (limited to 'tests/baseline/shared/paintcommands.cpp')
| -rw-r--r-- | tests/baseline/shared/paintcommands.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/baseline/shared/paintcommands.cpp b/tests/baseline/shared/paintcommands.cpp index 2cb3cd3bba7..9ace4dc55c5 100644 --- a/tests/baseline/shared/paintcommands.cpp +++ b/tests/baseline/shared/paintcommands.cpp @@ -442,6 +442,10 @@ void PaintCommands::staticInit() "^drawText\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$", "drawText <x> <y> <text>", "drawText 10 10 \"my text\""); + DECL_PAINTCOMMAND("drawAlignedText", command_drawAlignedText, + "^drawAlignedText\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$", + "drawAlignedText <x> <y> <width> <height> <flags> <text>", + "drawAlignedText 10 10 1000 1000 2 \"my text\""); DECL_PAINTCOMMAND("drawStaticText", command_drawStaticText, "^drawStaticText\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$", "drawStaticText <x> <y> <text>", @@ -1359,6 +1363,27 @@ void PaintCommands::command_drawText(QRegularExpressionMatch re) m_painter->drawText(x, y, txt); } +/***************************************************************************************************/ +void PaintCommands::command_drawAlignedText(QRegularExpressionMatch re) +{ + if (!m_shouldDrawText) + return; + QStringList caps = re.capturedTexts(); + int x = convertToInt(caps.at(1)); + int y = convertToInt(caps.at(2)); + int width = convertToInt(caps.at(3)); + int height = convertToInt(caps.at(4)); + int flags = convertToInt(caps.at(5)); + QString txt = caps.at(6); + + if (m_verboseMode) { + printf(" -(lance) drawText(%d, %d, %d, %d, %d, %s)\n", + x, y, width, height, flags, qPrintable(txt)); + } + + m_painter->drawText(x, y, width, height, flags, txt); +} + void PaintCommands::command_drawStaticText(QRegularExpressionMatch re) { if (!m_shouldDrawText) |
