diff options
Diffstat (limited to 'tests/auto/other/lancelot/paintcommands.cpp')
-rw-r--r-- | tests/auto/other/lancelot/paintcommands.cpp | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 074644393d..65a688ec40 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -106,7 +106,8 @@ const char *PaintCommands::spreadMethodTable[] = { const char *PaintCommands::coordinateMethodTable[] = { "LogicalMode", "StretchToDeviceMode", - "ObjectBoundingMode" + "ObjectBoundingMode", + "ObjectMode" }; const char *PaintCommands::sizeModeTable[] = { @@ -176,6 +177,9 @@ const char *PaintCommands::imageFormatTable[] = { "Format_A2RGB30_Premultiplied", "Alpha8", "Grayscale8", + "RGBx64", + "RGBA64", + "RGBA64_Premultiplied", }; int PaintCommands::translateEnum(const char *table[], const QString &pattern, int limit) @@ -561,6 +565,10 @@ void PaintCommands::staticInit() "^bitmap_load\\s+([\\w.:\\/]*)\\s*([\\w.:\\/]*)$", "bitmap_load <bitmap filename> <bitmapName>\n - note that the image is stored as a pixmap", "bitmap_load :/images/bitmap.png myBitmap"); + DECL_PAINTCOMMAND("pixmap_setDevicePixelRatio", command_pixmap_setDevicePixelRatio, + "^pixmap_setDevicePixelRatio\\s+([\\w.:\\/]*)\\s+([.0-9]*)$", + "pixmap_setDevicePixelRatio <pixmapName> <dpr>", + "pixmap_setDevicePixelRatio myPixmap 2.0"); DECL_PAINTCOMMAND("image_convertToFormat", command_image_convertToFormat, "^image_convertToFormat\\s+([\\w.:\\/]*)\\s+([\\w.:\\/]+)\\s+([\\w0-9_]*)$", "image_convertToFormat <sourceImageName> <destImageName> <image format enum>", @@ -577,6 +585,10 @@ void PaintCommands::staticInit() "^image_setColorCount\\s+([\\w.:\\/]*)\\s+([0-9]*)$", "image_setColorCount <imageName> <nbColors>", "image_setColorCount myImage 128"); + DECL_PAINTCOMMAND("image_setDevicePixelRatio", command_image_setDevicePixelRatio, + "^image_setDevicePixelRatio\\s+([\\w.:\\/]*)\\s+([.0-9]*)$", + "image_setDevicePixelRatio <imageName> <dpr>", + "image_setDevicePixelRatio myImage 2.0"); DECL_PAINTCOMMANDSECTION("transformations"); DECL_PAINTCOMMAND("resetMatrix", command_resetMatrix, @@ -1761,7 +1773,9 @@ void PaintCommands::command_setBrush(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); - QImage img = image_load<QImage>(caps.at(1)); + QImage img = m_imageMap[caps.at(1)]; // try cache first + if (img.isNull()) + img = image_load<QImage>(caps.at(1)); if (!img.isNull()) { // Assume image brush if (m_verboseMode) printf(" -(lance) setBrush(image=%s, width=%d, height=%d)\n", @@ -2132,6 +2146,20 @@ void PaintCommands::command_bitmap_load(QRegularExpressionMatch re) m_pixmapMap[name] = bm; } +void PaintCommands::command_pixmap_setDevicePixelRatio(QRegularExpressionMatch re) +{ + QStringList caps = re.capturedTexts(); + + QString name = caps.at(1); + double dpr = convertToDouble(caps.at(2)); + + if (m_verboseMode) + printf(" -(lance) pixmap_setDevicePixelRatio(%s), %.1f -> %.1f\n", + qPrintable(name), m_pixmapMap[name].devicePixelRatioF(), dpr); + + m_pixmapMap[name].setDevicePixelRatio(dpr); +} + /***************************************************************************************************/ void PaintCommands::command_pixmap_setMask(QRegularExpressionMatch re) { @@ -2197,6 +2225,21 @@ void PaintCommands::command_image_setColor(QRegularExpressionMatch re) } /***************************************************************************************************/ +void PaintCommands::command_image_setDevicePixelRatio(QRegularExpressionMatch re) +{ + QStringList caps = re.capturedTexts(); + + QString name = caps.at(1); + double dpr = convertToDouble(caps.at(2)); + + if (m_verboseMode) + printf(" -(lance) image_setDevicePixelRatio(%s), %.1f -> %.1f\n", + qPrintable(name), m_imageMap[name].devicePixelRatioF(), dpr); + + m_imageMap[name].setDevicePixelRatio(dpr); +} + +/***************************************************************************************************/ void PaintCommands::command_abort(QRegularExpressionMatch) { m_abort = true; @@ -2355,7 +2398,7 @@ void PaintCommands::command_gradient_setSpread(QRegularExpressionMatch re) void PaintCommands::command_gradient_setCoordinateMode(QRegularExpressionMatch re) { - int coord = translateEnum(coordinateMethodTable, re.captured(1), 3); + int coord = translateEnum(coordinateMethodTable, re.captured(1), 4); if (m_verboseMode) printf(" -(lance) gradient_setCoordinateMode %d=[%s]\n", coord, |