summaryrefslogtreecommitdiff
path: root/tests/auto/geotestplugin/qgeomappingmanagerengine_test.h
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@nokia.com>2011-12-15 09:07:20 +0200
committerQt by Nokia <qt-info@nokia.com>2011-12-15 08:22:26 +0100
commit2faa9dee6b4fa5eec3f72607bcfe31d1935f3d73 (patch)
treefe1f721434ef9ff78e788ce037bd769cb375c7a6 /tests/auto/geotestplugin/qgeomappingmanagerengine_test.h
parent298bb31eba85ce4d152c0d9e3cbdefb147bbf984 (diff)
downloadqtlocation-2faa9dee6b4fa5eec3f72607bcfe31d1935f3d73.tar.gz
Map testing plugin improvement.
Draws basic tile info into the tile for debugging purposes. Each vertically or horizontally adjacent frame has different border color. Change-Id: I05b89ff6ab4a56990f81506a81bfe40d91aec4e9 Reviewed-by: Alex <alex.blasche@nokia.com>
Diffstat (limited to 'tests/auto/geotestplugin/qgeomappingmanagerengine_test.h')
-rw-r--r--tests/auto/geotestplugin/qgeomappingmanagerengine_test.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/tests/auto/geotestplugin/qgeomappingmanagerengine_test.h b/tests/auto/geotestplugin/qgeomappingmanagerengine_test.h
index 7d4ebd10..37e57385 100644
--- a/tests/auto/geotestplugin/qgeomappingmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeomappingmanagerengine_test.h
@@ -45,6 +45,7 @@
#include <qgeoserviceprovider.h>
#include <qgeomappingmanagerengine.h>
#include <QLocale>
+#include <QPainter>
#include <QPixmap>
#include <QByteArray>
#include <QBuffer>
@@ -108,19 +109,30 @@ public:
QGeoTiledMapReply* getTileImage(const TileSpec &spec)
{
- //qDebug() << __FUNCTION__ << "in test plugin for spec: " << spec.x() << spec.y() << spec.zoom();
mappingReply_ = new TiledMapReplyTest(spec, this);
QImage im(256, 256, QImage::Format_RGB888);
- im.fill(0);
-
- for (int y = 0; y < im.height(); y++) {
- for (int x = 0; x < im.width(); x++) {
- im.setPixel(x, y, (x + y) % 255);
- }
- }
+ im.fill(QColor("lightgray"));
+ QRectF rect;
+ QString text("X: " + QString::number(spec.x()) + "\nY: " + QString::number(spec.y()) + "\nZ: " + QString::number(spec.zoom()));
+ rect.setWidth(250);
+ rect.setHeight(250);
+ rect.setLeft(3);
+ rect.setTop(3);
+ QPainter painter;
+ QPen pen(QColor("firebrick"));
+ painter.begin(&im);
+ painter.setPen(pen);
+ painter.setFont( QFont("Times", 35, 10, false));
+ painter.drawText(rect, text);
+ // different border color for vertically and horizontally adjacent frames
+ if ((spec.x() + spec.y()) % 2 == 0)
+ pen.setColor(QColor("yellow"));
+ pen.setWidth(5);
+ painter.setPen(pen);
+ painter.drawRect(0,0,255,255);
+ painter.end();
QPixmap pm = QPixmap::fromImage(im);
-
QByteArray bytes;
QBuffer buffer(&bytes);
buffer.open(QIODevice::WriteOnly);