summaryrefslogtreecommitdiffstats
path: root/tests/auto/qclipboard
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2010-11-23 11:26:54 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2010-11-23 11:26:54 (GMT)
commit802498fcd43558a10bb7477d3957cdd27fd8ec09 (patch)
treec40ddd859b032ffa7ed9c6df1173312c0bb1947d /tests/auto/qclipboard
parent901fee7e610ec53f744416aeeca89c4605923120 (diff)
parent538e7b8ddf45936bb274ed3230b591b3459edfa7 (diff)
downloadQt-802498fcd43558a10bb7477d3957cdd27fd8ec09.zip
Qt-802498fcd43558a10bb7477d3957cdd27fd8ec09.tar.gz
Qt-802498fcd43558a10bb7477d3957cdd27fd8ec09.tar.bz2
Merge remote branch 'qt/master' into file-engine-refactor
Conflicts: demos/declarative/minehunt/minehunt.pro src/corelib/io/io.pri src/corelib/io/qfsfileengine.cpp src/corelib/io/qfsfileengine_unix.cpp src/corelib/io/qfsfileengine_win.cpp src/s60installs/bwins/QtCoreu.def src/s60installs/bwins/QtDeclarativeu.def src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtCoreu.def src/s60installs/eabi/QtDeclarativeu.def src/s60installs/eabi/QtGuiu.def tests/auto/qapplication/test/test.pro tests/auto/qaudioinput/qaudioinput.pro tests/auto/qaudiooutput/qaudiooutput.pro tests/auto/qchar/qchar.pro tests/auto/qdiriterator/qdiriterator.pro tests/auto/qsound/qsound.pro
Diffstat (limited to 'tests/auto/qclipboard')
-rw-r--r--tests/auto/qclipboard/test/test.pro14
-rw-r--r--tests/auto/qclipboard/tst_qclipboard.cpp82
2 files changed, 90 insertions, 6 deletions
diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro
index 620ff36..12c6b6c 100644
--- a/tests/auto/qclipboard/test/test.pro
+++ b/tests/auto/qclipboard/test/test.pro
@@ -11,18 +11,20 @@ win32 {
}
wince*|symbian: {
- copier.sources = ../copier/copier.exe
+ copier.files = ../copier/copier.exe
copier.path = copier
- paster.sources = ../paster/paster.exe
+ paster.files = ../paster/paster.exe
paster.path = paster
symbian: {
+ LIBS += -lbafl -lestor -letext
+
load(data_caging_paths)
- rsc.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc
- rsc.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc
+ rsc.files = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc
+ rsc.files += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc
rsc.path = $$APP_RESOURCE_DIR
- reg_resource.sources = $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/copier_reg.rsc
- reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/paster_reg.rsc
+ reg_resource.files = $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/copier_reg.rsc
+ reg_resource.files += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/paster_reg.rsc
reg_resource.path = $$REG_RESOURCE_IMPORT_DIR
}
diff --git a/tests/auto/qclipboard/tst_qclipboard.cpp b/tests/auto/qclipboard/tst_qclipboard.cpp
index d1f3e86..2e0362c 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"