summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-02-19 11:26:57 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-03-04 08:28:04 +0100
commit4724dfff627f3cd3754f5d4a827c6b6790a89955 (patch)
treefcd6dec7ba40e6bc438ac2fd24772606fbab6b96 /tests/auto
parent5f1afeacf69c55495a51dc2cffbc6acf8f654239 (diff)
Remove references to QTextDocumentPrivate from public API
The private object of QTextDocument has been exposed through public APIs marked internal, which we should avoid as much as possible, since it clutters the headers. For accessing private data without adding friends, we have a nice pattern of adding a static get() function to the private class itself. Fixes: QTBUG-55059 Change-Id: I03e949a677e03487e95f24e3608a06aa0a3511ab Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/text/qtextblock/tst_qtextblock.cpp2
-rw-r--r--tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp2
-rw-r--r--tests/auto/gui/text/qtextdocument/common.h2
-rw-r--r--tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp b/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp
index a9004edfc0..0d638706eb 100644
--- a/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp
+++ b/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp
@@ -89,7 +89,7 @@ void tst_QTextBlock::fragmentOverBlockBoundaries()
// Block separators are always a fragment of their self. Thus:
// |Hello|\b|World|\b|
#if !defined(Q_OS_WIN)
- QCOMPARE(doc->docHandle()->fragmentMap().numNodes(), 4);
+ QCOMPARE(QTextDocumentPrivate::get(doc)->fragmentMap().numNodes(), 4);
#endif
QCOMPARE(cursor.block().text(), QString("Hello"));
cursor.movePosition(QTextCursor::NextBlock);
diff --git a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp
index 2bc611fe93..3da32a2842 100644
--- a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp
+++ b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp
@@ -1280,7 +1280,7 @@ void tst_QTextCursor::anchorInitialized1()
void tst_QTextCursor::anchorInitialized2()
{
cursor.insertBlock();
- cursor = QTextCursorPrivate::fromPosition(cursor.block().docHandle(), 1);
+ cursor = QTextCursorPrivate::fromPosition(const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(cursor.block())), 1);
QCOMPARE(cursor.position(), 1);
QCOMPARE(cursor.anchor(), 1);
QCOMPARE(cursor.selectionStart(), 1);
diff --git a/tests/auto/gui/text/qtextdocument/common.h b/tests/auto/gui/text/qtextdocument/common.h
index 33afb98c61..0681f7f0e2 100644
--- a/tests/auto/gui/text/qtextdocument/common.h
+++ b/tests/auto/gui/text/qtextdocument/common.h
@@ -42,7 +42,7 @@ public:
virtual void documentChanged(int from, int oldLength, int length)
{
called = true;
- lastDocumentLengths.append(document()->docHandle()->length());
+ lastDocumentLengths.append(QTextDocumentPrivate::get(document())->length());
if (f < 0)
return;
diff --git a/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp
index 39f5e9ecc3..436cd09914 100644
--- a/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp
+++ b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp
@@ -110,7 +110,7 @@ tst_QTextPieceTable::tst_QTextPieceTable()
void tst_QTextPieceTable::init()
{
doc = new QTextDocument(0);
- table = doc->docHandle();
+ table = QTextDocumentPrivate::get(doc);
blockFormatIndex = table->formatCollection()->indexForFormat(QTextBlockFormat());
charFormatIndex = table->formatCollection()->indexForFormat(QTextCharFormat());
}