diff options
Diffstat (limited to 'tests/auto/qplaintextedit/tst_qplaintextedit.cpp')
-rw-r--r-- | tests/auto/qplaintextedit/tst_qplaintextedit.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp index 5161d3c..2e78174 100644 --- a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp @@ -87,24 +87,32 @@ public slots: void cleanup(); private slots: void getSetCheck(); +#ifndef QT_NO_CLIPBOARD void clearMustNotChangeClipboard(); +#endif void clearMustNotResetRootFrameMarginToDefault(); void paragSeparatorOnPlaintextAppend(); +#ifndef QT_NO_CLIPBOARD void selectAllSetsNotSelection(); +#endif void asciiTab(); void setDocument(); void emptyAppend(); void appendOnEmptyDocumentShouldReuseInitialParagraph(); void cursorPositionChanged(); void setTextCursor(); +#ifndef QT_NO_CLIPBOARD void undoAvailableAfterPaste(); +#endif void undoRedoAvailableRepetition(); void appendShouldNotTouchTheSelection(); void backspace(); void shiftBackspace(); void undoRedo(); void preserveCharFormatInAppend(); +#ifndef QT_NO_CLIPBOARD void copyAndSelectAllInReadonly(); +#endif void ctrlAltInput(); void noPropertiesOnDefaultTextEditCharFormat(); void setPlainTextShouldEmitTextChangedOnce(); @@ -118,13 +126,17 @@ private slots: void undoRedoAfterSetContent(); void numPadKeyNavigation(); void moveCursor(); +#ifndef QT_NO_CLIPBOARD void mimeDataReimplementations(); +#endif void shiftEnterShouldInsertLineSeparator(); void selectWordsFromStringsContainingSeparators_data(); void selectWordsFromStringsContainingSeparators(); +#ifndef QT_NO_CLIPBOARD void canPaste(); void copyAvailable_data(); void copyAvailable(); +#endif void ensureCursorVisibleOnInitialShow(); void setTextInsideResizeEvent(); void colorfulAppend(); @@ -209,7 +221,7 @@ void tst_QPlainTextEdit::getSetCheck() QCOMPARE(0, obj1.tabStopWidth()); obj1.setTabStopWidth(INT_MIN); QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value -#if defined(QT_ARCH_WINDOWSCE) +#if defined(QT_ARCH_WINDOWSCE) || defined (QT_ARCH_SYMBIAN) // due to rounding error in qRound when qreal==float // we cannot use INT_MAX for this check obj1.setTabStopWidth(SHRT_MAX*2); @@ -290,7 +302,7 @@ void tst_QPlainTextEdit::createSelection() #endif QCOMPARE(ed->textCursor().position(), 11); } - +#ifndef QT_NO_CLIPBOARD void tst_QPlainTextEdit::clearMustNotChangeClipboard() { if (!nativeClipboardWorking()) @@ -301,6 +313,7 @@ void tst_QPlainTextEdit::clearMustNotChangeClipboard() ed->clear(); QCOMPARE(QApplication::clipboard()->text(), txt); } +#endif void tst_QPlainTextEdit::clearMustNotResetRootFrameMarginToDefault() { @@ -322,6 +335,7 @@ void tst_QPlainTextEdit::paragSeparatorOnPlaintextAppend() QCOMPARE(cnt, 2); } +#ifndef QT_NO_CLIPBOARD void tst_QPlainTextEdit::selectAllSetsNotSelection() { if (!QApplication::clipboard()->supportsSelection()) { @@ -337,6 +351,7 @@ void tst_QPlainTextEdit::selectAllSetsNotSelection() QCOMPARE(QApplication::clipboard()->text(QClipboard::Selection), QString::fromAscii("foobar")); } +#endif void tst_QPlainTextEdit::asciiTab() { @@ -466,6 +481,7 @@ void tst_QPlainTextEdit::setTextCursor() QCOMPARE(spy.count(), 1); } +#ifndef QT_NO_CLIPBOARD void tst_QPlainTextEdit::undoAvailableAfterPaste() { if (!nativeClipboardWorking()) @@ -479,6 +495,7 @@ void tst_QPlainTextEdit::undoAvailableAfterPaste() QVERIFY(spy.count() >= 1); QCOMPARE(ed->toPlainText(), txt); } +#endif class UndoRedoRecorder : public QObject { @@ -657,6 +674,7 @@ void tst_QPlainTextEdit::preserveCharFormatInAppend() QCOMPARE(cursor.block().text(), QString("third para")); } +#ifndef QT_NO_CLIPBOARD void tst_QPlainTextEdit::copyAndSelectAllInReadonly() { if (!nativeClipboardWorking()) @@ -687,6 +705,7 @@ void tst_QPlainTextEdit::copyAndSelectAllInReadonly() QTest::keyClick(ed, Qt::Key_C, Qt::ControlModifier); QCOMPARE(QApplication::clipboard()->text(), QString("Hello World")); } +#endif void tst_QPlainTextEdit::ctrlAltInput() { @@ -856,7 +875,12 @@ void tst_QPlainTextEdit::lineWrapModes() ed->setLineWrapMode(QPlainTextEdit::NoWrap); QCOMPARE(lineCount(), 1); ed->setLineWrapMode(QPlainTextEdit::WidgetWidth); - ed->resize(1, 1000); + + // QPlainTextEdit does lazy line layout on resize, only for the visible blocks. + // We thus need to make it wide enough to show something visible. + int minimumWidth = 2 * ed->document()->documentMargin(); + minimumWidth += ed->fontMetrics().width(QLatin1Char('a')); + ed->resize(minimumWidth, 1000); QCOMPARE(lineCount(), 26); ed->setParent(0); delete window; @@ -903,6 +927,7 @@ void tst_QPlainTextEdit::implicitClear() QVERIFY(ed->toPlainText().isEmpty()); } +#ifndef QT_NO_CLIPBOARD void tst_QPlainTextEdit::copyAvailable_data() { QTest::addColumn<pairListType>("keystrokes"); @@ -1020,6 +1045,7 @@ void tst_QPlainTextEdit::copyAvailable() QVERIFY2(variantSpyCopyAvailable.toBool() == copyAvailable.at(i), QString("Spied singnal: %1").arg(i).toLatin1()); } } +#endif void tst_QPlainTextEdit::undoRedoAfterSetContent() { @@ -1085,6 +1111,7 @@ public: }; +#ifndef QT_NO_CLIPBOARD void tst_QPlainTextEdit::mimeDataReimplementations() { MyTextEdit ed; @@ -1106,6 +1133,7 @@ void tst_QPlainTextEdit::mimeDataReimplementations() QCOMPARE(ed.canInsertCallCount, 0); QCOMPARE(ed.insertCallCount, 0); +#ifdef QT_BUILD_INTERNAL QTextControl *control = qFindChild<QTextControl *>(&ed); QVERIFY(control); @@ -1120,7 +1148,9 @@ void tst_QPlainTextEdit::mimeDataReimplementations() QCOMPARE(ed.createMimeDataCallCount, 1); QCOMPARE(ed.canInsertCallCount, 1); QCOMPARE(ed.insertCallCount, 1); +#endif } +#endif void tst_QPlainTextEdit::shiftEnterShouldInsertLineSeparator() { @@ -1160,6 +1190,7 @@ void tst_QPlainTextEdit::selectWordsFromStringsContainingSeparators() cursor.clearSelection(); } +#ifndef QT_NO_CLIPBOARD void tst_QPlainTextEdit::canPaste() { if (!nativeClipboardWorking()) @@ -1172,6 +1203,7 @@ void tst_QPlainTextEdit::canPaste() ed->setTextInteractionFlags(Qt::NoTextInteraction); QVERIFY(!ed->canPaste()); } +#endif void tst_QPlainTextEdit::ensureCursorVisibleOnInitialShow() { |