mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-04 08:15:30 +08:00
qt 6.5.1 original
This commit is contained in:
17
tests/auto/gui/text/qtextdocument/CMakeLists.txt
Normal file
17
tests/auto/gui/text/qtextdocument/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## tst_qtextdocument Test:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_add_test(tst_qtextdocument
|
||||
SOURCES
|
||||
common.h
|
||||
tst_qtextdocument.cpp
|
||||
LIBRARIES
|
||||
Qt::CorePrivate
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Xml
|
||||
)
|
55
tests/auto/gui/text/qtextdocument/common.h
Normal file
55
tests/auto/gui/text/qtextdocument/common.h
Normal file
@ -0,0 +1,55 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include <private/qtextdocument_p.h>
|
||||
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
class QTestDocumentLayout : public QAbstractTextDocumentLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTestDocumentLayout(QTextDocument *doc) : QAbstractTextDocumentLayout(doc), f(-1), called(false) {}
|
||||
virtual void draw(QPainter *, const PaintContext &) override {}
|
||||
virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const override { return 0; }
|
||||
|
||||
virtual void documentChanged(int from, int oldLength, int length) override
|
||||
{
|
||||
called = true;
|
||||
lastDocumentLengths.append(QTextDocumentPrivate::get(document())->length());
|
||||
|
||||
if (f < 0)
|
||||
return;
|
||||
|
||||
if(from != f ||
|
||||
o != oldLength ||
|
||||
l != length) {
|
||||
qDebug("checkDocumentChanged: got %d %d %d, expected %d %d %d", from, oldLength, length, f, o, l);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
||||
virtual int pageCount() const override { return 1; }
|
||||
virtual QSizeF documentSize() const override { return QSizeF(); }
|
||||
|
||||
virtual QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); }
|
||||
virtual QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); }
|
||||
|
||||
int f;
|
||||
int o;
|
||||
int l;
|
||||
|
||||
void expect(int from, int oldLength, int length) {
|
||||
f = from;
|
||||
o = oldLength;
|
||||
l = length;
|
||||
error = false;
|
||||
called = false;
|
||||
}
|
||||
bool error;
|
||||
bool called;
|
||||
QList<int> lastDocumentLengths;
|
||||
};
|
||||
|
||||
#endif
|
3
tests/auto/gui/text/qtextdocument/test.css
Normal file
3
tests/auto/gui/text/qtextdocument/test.css
Normal file
@ -0,0 +1,3 @@
|
||||
body {
|
||||
font: normal 400 14px/1.2 Arial;
|
||||
}
|
3969
tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
Normal file
3969
tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user