summaryrefslogtreecommitdiffstats
path: root/tests/auto/qclipboard
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-10-25 12:54:16 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-10-25 12:54:16 +0200
commitcb50699b39e016a64a2a06088042622546c428a2 (patch)
tree77d269a3103a6c140098b9caaafd17a29a81addd /tests/auto/qclipboard
parent89807f70656b95c1568ef183dd7f28c527fc3eaa (diff)
parent890c1110ec5e39bb6e63e99fe09c296c1ea824be (diff)
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: demos/declarative/snake/snake.qml qmake/generators/symbian/symbiancommon.cpp src/network/access/qnetworkaccessmanager.cpp src/s60installs/s60installs.pro tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp tests/auto/qnetworkreply/tst_qnetworkreply.cpp
Diffstat (limited to 'tests/auto/qclipboard')
-rw-r--r--tests/auto/qclipboard/test/test.pro2
-rw-r--r--tests/auto/qclipboard/tst_qclipboard.cpp82
2 files changed, 84 insertions, 0 deletions
diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro
index 7d5c2f3e00..6e61b31227 100644
--- a/tests/auto/qclipboard/test/test.pro
+++ b/tests/auto/qclipboard/test/test.pro
@@ -17,6 +17,8 @@ wince*|symbian: {
paster.path = paster
symbian: {
+ LIBS += -lbafl -lestor -letext
+
load(data_caging_paths)
rsc.files = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc
rsc.files += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc
diff --git a/tests/auto/qclipboard/tst_qclipboard.cpp b/tests/auto/qclipboard/tst_qclipboard.cpp
index d1f3e86a9b..2e0362c1b8 100644
--- a/tests/auto/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/qclipboard/tst_qclipboard.cpp
@@ -47,6 +47,14 @@
#ifdef Q_WS_MAC
#include <Carbon/Carbon.h>
#endif
+#ifdef Q_OS_SYMBIAN
+#include "private/qcore_symbian_p.h"
+#include "txtetext.h"
+#include <baclipb.h>
+#endif
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include "txtclipboard.h"
+#endif
//TESTED_CLASS=
//TESTED_FILES=
@@ -62,6 +70,10 @@ private slots:
void testSignals();
void setMimeData();
void clearBeforeSetText();
+#ifdef Q_OS_SYMBIAN
+ void pasteCopySymbian();
+ void copyPasteSymbian();
+#endif
private:
bool nativeClipboardWorking();
@@ -335,6 +347,76 @@ void tst_QClipboard::clearBeforeSetText()
QCOMPARE(QApplication::clipboard()->text(), text);
}
+/*
+ Test that text copied from qt application
+ can be pasted with symbian clipboard
+*/
+#ifdef Q_OS_SYMBIAN
+// ### This test case only makes sense in symbian
+void tst_QClipboard::pasteCopySymbian()
+{
+ if (!nativeClipboardWorking())
+ QSKIP("Native clipboard not working in this setup", SkipAll);
+ const QString string("Test string symbian.");
+ QApplication::clipboard()->setText(string);
+
+ const TInt KPlainTextBegin = 0;
+ RFs fs = qt_s60GetRFs();
+ CClipboard* cb = CClipboard::NewForReadingLC(fs);
+
+ CPlainText* text = CPlainText::NewL();
+ CleanupStack::PushL(text);
+ TInt dataLength = text->PasteFromStoreL(cb->Store(), cb->StreamDictionary(),
+ KPlainTextBegin);
+ if (dataLength == 0) {
+ User::Leave(KErrNotFound);
+ }
+ HBufC* hBuf = HBufC::NewL(dataLength);
+ TPtr buf = hBuf->Des();
+ text->Extract(buf, KPlainTextBegin, dataLength);
+
+ QString storeString = qt_TDesC2QString(buf);
+ CleanupStack::PopAndDestroy(text);
+ CleanupStack::PopAndDestroy(cb);
+
+ QCOMPARE(string, storeString);
+}
+#endif
+
+/*
+ Test that text copied to symbian clipboard
+ can be pasted to qt clipboard
+*/
+#ifdef Q_OS_SYMBIAN
+// ### This test case only makes sense in symbian
+void tst_QClipboard::copyPasteSymbian()
+{
+ if (!nativeClipboardWorking())
+ QSKIP("Native clipboard not working in this setup", SkipAll);
+ const QString string("Test string symbian.");
+ const TInt KPlainTextBegin = 0;
+
+ RFs fs = qt_s60GetRFs();
+ CClipboard* cb = CClipboard::NewForWritingLC(fs);
+ CStreamStore& store = cb->Store();
+ CStreamDictionary& dict = cb->StreamDictionary();
+ RStoreWriteStream symbianStream;
+ TStreamId symbianStId = symbianStream.CreateLC(cb->Store());
+
+ CPlainText* text = CPlainText::NewL();
+ CleanupStack::PushL(text);
+ TPtrC textPtr(qt_QString2TPtrC(string));
+ text->InsertL(KPlainTextBegin, textPtr);
+ text->CopyToStoreL(store, dict, KPlainTextBegin, textPtr.Length());
+ CleanupStack::PopAndDestroy(text);
+ (cb->StreamDictionary()).AssignL(KClipboardUidTypePlainText, symbianStId);
+ cb->CommitL();
+ CleanupStack::PopAndDestroy(2, cb);
+
+ QCOMPARE(QApplication::clipboard()->text(), string);
+}
+#endif
+
QTEST_MAIN(tst_QClipboard)
#include "tst_qclipboard.moc"