summaryrefslogtreecommitdiffstats
path: root/tests/arthur/common
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-06-03 11:31:05 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-06-03 13:18:36 (GMT)
commit81da1a8f774ec258f45549734e84770655a7c8e8 (patch)
tree40c8c250ba679eabd105f3c3436738864a3471bd /tests/arthur/common
parentd2d6f3963d11e969bf0fe0ff35064be5455f80c5 (diff)
downloadQt-81da1a8f774ec258f45549734e84770655a7c8e8.zip
Qt-81da1a8f774ec258f45549734e84770655a7c8e8.tar.gz
Qt-81da1a8f774ec258f45549734e84770655a7c8e8.tar.bz2
Add basic static text drawing capability to lance
Task-number: QTBUG-17514 Change-Id: Ife7cd8f940424d805f634ca190bcbf6fd83d8682 Reviewed-on: http://codereview.qt.nokia.com/321 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: aavit (cherry picked from commit ce041a6516bfb0d9bd9ee1707605b478e1c9171a)
Diffstat (limited to 'tests/arthur/common')
-rw-r--r--tests/arthur/common/paintcommands.cpp20
-rw-r--r--tests/arthur/common/paintcommands.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp
index 9273142..7b10da0 100644
--- a/tests/arthur/common/paintcommands.cpp
+++ b/tests/arthur/common/paintcommands.cpp
@@ -48,6 +48,7 @@
#include <qtextstream.h>
#include <qtextlayout.h>
#include <qdebug.h>
+#include <QStaticText>
#ifdef QT3_SUPPORT
#include <q3painter.h>
@@ -464,6 +465,10 @@ void PaintCommands::staticInit()
"^drawText\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$",
"drawText <x> <y> <text>",
"drawText 10 10 \"my text\"");
+ DECL_PAINTCOMMAND("drawStaticText", command_drawStaticText,
+ "^drawStaticText\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$",
+ "drawStaticText <x> <y> <text>",
+ "drawStaticText 10 10 \"my text\"");
DECL_PAINTCOMMAND("drawTiledPixmap", command_drawTiledPixmap,
"^drawTiledPixmap\\s+([\\w.:\\/]*)"
"\\s+(-?\\w*)\\s+(-?\\w*)\\s*(-?\\w*)\\s*(-?\\w*)"
@@ -1404,6 +1409,21 @@ void PaintCommands::command_drawText(QRegExp re)
m_painter->drawText(x, y, txt);
}
+void PaintCommands::command_drawStaticText(QRegExp re)
+{
+ if (!m_shouldDrawText)
+ return;
+ QStringList caps = re.capturedTexts();
+ int x = convertToInt(caps.at(1));
+ int y = convertToInt(caps.at(2));
+ QString txt = caps.at(3);
+
+ if (m_verboseMode)
+ printf(" -(lance) drawStaticText(%d, %d, %s)\n", x, y, qPrintable(txt));
+
+ m_painter->drawStaticText(x, y, QStaticText(txt));
+}
+
/***************************************************************************************************/
void PaintCommands::command_noop(QRegExp)
{
diff --git a/tests/arthur/common/paintcommands.h b/tests/arthur/common/paintcommands.h
index 08c0e25..d0a2b98 100644
--- a/tests/arthur/common/paintcommands.h
+++ b/tests/arthur/common/paintcommands.h
@@ -209,6 +209,7 @@ private:
void command_drawRoundedRect(QRegExp re);
void command_drawRoundRect(QRegExp re);
void command_drawText(QRegExp re);
+ void command_drawStaticText(QRegExp re);
void command_drawTiledPixmap(QRegExp re);
void command_path_addEllipse(QRegExp re);
void command_path_addPolygon(QRegExp re);