diff options
Diffstat (limited to 'tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp')
-rw-r--r-- | tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp | 60 |
1 files changed, 20 insertions, 40 deletions
diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp index be3ef968ef..3d0fab4603 100644 --- a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp +++ b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp @@ -1,33 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <QtTest/QtTest> +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + + +#include <QTest> #include <qcoreapplication.h> #include <qdebug.h> @@ -47,9 +22,11 @@ public: private slots: void getSetCheck(); void maximumBlockCount(); +#ifndef QT_NO_TEXTHTMLPARSER void anchorAt(); void imageAt(); void formatAt(); +#endif }; tst_QAbstractTextDocumentLayout::tst_QAbstractTextDocumentLayout() @@ -72,13 +49,14 @@ public: { } - void draw(QPainter *, const PaintContext &) {} - int hitTest(const QPointF &, Qt::HitTestAccuracy) const { return 0; } - int pageCount() const { return 0; } - QSizeF documentSize() const { return QSizeF(); } - QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); } - QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); } - void documentChanged(int from, int /* oldLength */, int length) { + void draw(QPainter *, const PaintContext &) override {} + int hitTest(const QPointF &, Qt::HitTestAccuracy) const override { return 0; } + int pageCount() const override { return 0; } + QSizeF documentSize() const override { return QSizeF(); } + QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); } + QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); } + void documentChanged(int from, int /* oldLength */, int length) override + { ++changeEvents; QTextBlock last = document()->lastBlock(); @@ -143,6 +121,7 @@ void tst_QAbstractTextDocumentLayout::maximumBlockCount() QCOMPARE(layout.blockCount, 10); } +#ifndef QT_NO_TEXTHTMLPARSER void tst_QAbstractTextDocumentLayout::anchorAt() { QTextDocument doc; @@ -150,7 +129,7 @@ void tst_QAbstractTextDocumentLayout::anchorAt() QAbstractTextDocumentLayout *documentLayout = doc.documentLayout(); QTextBlock firstBlock = doc.begin(); QTextLayout *layout = firstBlock.layout(); - layout->setPreeditArea(doc.toPlainText().length(), "xxx"); + layout->setPreeditArea(doc.toPlainText().size(), "xxx"); doc.setPageSize(QSizeF(1000, 1000)); QFontMetrics metrics(layout->font()); @@ -180,7 +159,7 @@ void tst_QAbstractTextDocumentLayout::imageAt() QAbstractTextDocumentLayout *documentLayout = doc.documentLayout(); QTextBlock firstBlock = doc.begin(); QTextLayout *layout = firstBlock.layout(); - layout->setPreeditArea(doc.toPlainText().length(), "xxx"); + layout->setPreeditArea(doc.toPlainText().size(), "xxx"); doc.setPageSize(QSizeF(1000, 1000)); QFontMetrics metrics(layout->font()); @@ -205,7 +184,7 @@ void tst_QAbstractTextDocumentLayout::formatAt() QAbstractTextDocumentLayout *documentLayout = doc.documentLayout(); QTextBlock firstBlock = doc.begin(); QTextLayout *layout = firstBlock.layout(); - layout->setPreeditArea(doc.toPlainText().length(), "xxx"); + layout->setPreeditArea(doc.toPlainText().size(), "xxx"); doc.setPageSize(QSizeF(1000, 1000)); QFontMetrics metrics(layout->font()); @@ -228,6 +207,7 @@ void tst_QAbstractTextDocumentLayout::formatAt() QVERIFY(!format.toCharFormat().fontItalic()); QVERIFY(!format.isImageFormat()); } +#endif QTEST_MAIN(tst_QAbstractTextDocumentLayout) #include "tst_qabstracttextdocumentlayout.moc" |