summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-07-01 12:21:03 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2014-07-03 22:43:17 +0200
commit9150563940f61be9fb17510be49c0734244866a5 (patch)
treeebbd771a825f6a9d3912f023c2ed9e259c6d8ecd /tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
parent71c58f036957fdda4012703c6de7891c20455242 (diff)
Windows clipboard: Deny CF_DIB support for images with alpha.
Support CF_DIBV5 for these images so that transparency is preserved. Task-number: QTBUG-11463 Change-Id: I51881ae8bfbd05b92abd309766f4da9a7ea26c2d Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp')
-rw-r--r--tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
index 8a2009a601..b677ee1ea4 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -46,6 +46,8 @@
#include <QtCore/QDir>
#include <QtGui/QGuiApplication>
#include <QtGui/QClipboard>
+#include <QtGui/QImage>
+#include <QtGui/QColor>
#include "../../../shared/platformclipboard.h"
class tst_QClipboard : public QObject
@@ -59,6 +61,7 @@ private slots:
void init();
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_QNX)
void copy_exit_paste();
+ void copyImage();
#endif
void capabilityFunctions();
void modes();
@@ -278,18 +281,42 @@ void tst_QClipboard::copy_exit_paste()
// ### It's still possible to test copy/paste - just keep the apps running
if (!PlatformClipboard::isAvailable())
QSKIP("Native clipboard not working in this setup");
- const QStringList stringArgument(QStringLiteral("Test string."));
+ const QString stringArgument(QStringLiteral("Test string."));
QByteArray errorMessage;
- QVERIFY2(runHelper(QStringLiteral("copier/copier"), stringArgument, &errorMessage),
+ QVERIFY2(runHelper(QStringLiteral("copier/copier"), QStringList(stringArgument), &errorMessage),
errorMessage.constData());
#ifdef Q_OS_MAC
// The Pasteboard needs a moment to breathe (at least on older Macs).
QTest::qWait(100);
#endif // Q_OS_MAC
- QVERIFY2(runHelper(QStringLiteral("paster/paster"), stringArgument, &errorMessage),
+ QVERIFY2(runHelper(QStringLiteral("paster/paster"),
+ QStringList() << QStringLiteral("--text") << stringArgument,
+ &errorMessage),
errorMessage.constData());
#endif // QT_NO_PROCESS
}
+
+void tst_QClipboard::copyImage()
+{
+#ifndef QT_NO_PROCESS
+ if (!PlatformClipboard::isAvailable())
+ QSKIP("Native clipboard not working in this setup");
+ QImage image(100, 100, QImage::Format_ARGB32);
+ image.fill(QColor(Qt::transparent));
+ image.setPixel(QPoint(1, 0), QColor(Qt::blue).rgba());
+ QGuiApplication::clipboard()->setImage(image);
+#ifdef Q_OS_OSX
+ // The Pasteboard needs a moment to breathe (at least on older Macs).
+ QTest::qWait(100);
+#endif // Q_OS_OSX
+ // paster will perform hard-coded checks on the copied image.
+ QByteArray errorMessage;
+ QVERIFY2(runHelper(QStringLiteral("paster/paster"),
+ QStringList(QStringLiteral("--image")), &errorMessage),
+ errorMessage.constData());
+#endif // QT_NO_PROCESS
+}
+
#endif // Q_OS_WIN || Q_OS_MAC || Q_OS_QNX
void tst_QClipboard::setMimeData()