From 882bf3475c8926abe62ed71e6719458b024caac0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 13 Jan 2014 15:48:44 +0100 Subject: expand tabs and related whitespace fixes in *.{cpp,h,qdoc} the diff -w for this commit is empty. Started-by: Thiago Macieira Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e Reviewed-by: Thiago Macieira --- tests/auto/gui/text/qfont/tst_qfont.cpp | 158 ++++++++-------- .../gui/text/qfontdatabase/tst_qfontdatabase.cpp | 10 +- .../gui/text/qfontmetrics/tst_qfontmetrics.cpp | 2 +- tests/auto/gui/text/qtextdocument/common.h | 10 +- .../tst_qtextdocumentfragment.cpp | 198 ++++++++++----------- .../auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 110 ++++++------ tests/auto/gui/text/qtextlist/tst_qtextlist.cpp | 2 +- .../text/qtextpiecetable/tst_qtextpiecetable.cpp | 180 +++++++++---------- 8 files changed, 335 insertions(+), 335 deletions(-) (limited to 'tests/auto/gui/text') diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index aa5fa10a33..a7248869ed 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -316,25 +316,25 @@ void tst_QFont::italicOblique() QStringList::ConstIterator f_it, f_end = families.end(); for (f_it = families.begin(); f_it != f_end; ++f_it) { - QString family = *f_it; - QStringList styles = fdb.styles(family); - QVERIFY(!styles.isEmpty()); - QStringList::ConstIterator s_it, s_end = styles.end(); - for (s_it = styles.begin(); s_it != s_end; ++s_it) { - QString style = *s_it; - - if (fdb.isSmoothlyScalable(family, style)) { - if (style.contains("Oblique")) { - style.replace("Oblique", "Italic"); - } else if (style.contains("Italic")) { - style.replace("Italic", "Oblique"); - } else { - continue; - } - QFont f = fdb.font(family, style, 12); - QVERIFY(f.italic()); - } - } + QString family = *f_it; + QStringList styles = fdb.styles(family); + QVERIFY(!styles.isEmpty()); + QStringList::ConstIterator s_it, s_end = styles.end(); + for (s_it = styles.begin(); s_it != s_end; ++s_it) { + QString style = *s_it; + + if (fdb.isSmoothlyScalable(family, style)) { + if (style.contains("Oblique")) { + style.replace("Oblique", "Italic"); + } else if (style.contains("Italic")) { + style.replace("Italic", "Oblique"); + } else { + continue; + } + QFont f = fdb.font(family, style, 12); + QVERIFY(f.italic()); + } + } } } @@ -342,16 +342,16 @@ void tst_QFont::compare() { QFont font; { - QFont font2 = font; - font2.setPointSize( 24 ); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); + QFont font2 = font; + font2.setPointSize(24); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); } { - QFont font2 = font; - font2.setPixelSize( 24 ); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); + QFont font2 = font; + font2.setPixelSize(24); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); } font.setPointSize(12); @@ -361,69 +361,69 @@ void tst_QFont::compare() font.setStrikeOut(false); font.setOverline(false); { - QFont font2 = font; - font2.setPointSize( 24 ); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); + QFont font2 = font; + font2.setPointSize(24); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); } { - QFont font2 = font; - font2.setPixelSize( 24 ); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); + QFont font2 = font; + font2.setPixelSize(24); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); } { - QFont font2 = font; - - font2.setItalic(true); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); - font2.setItalic(false); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); - - font2.setWeight(QFont::Bold); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); - font2.setWeight(QFont::Normal); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); - - font.setUnderline(true); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); - font.setUnderline(false); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); - - font.setStrikeOut(true); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); - font.setStrikeOut(false); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); - - font.setOverline(true); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); - font.setOverline(false); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); + QFont font2 = font; + + font2.setItalic(true); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); + font2.setItalic(false); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); + + font2.setWeight(QFont::Bold); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); + font2.setWeight(QFont::Normal); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); + + font.setUnderline(true); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); + font.setUnderline(false); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); + + font.setStrikeOut(true); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); + font.setStrikeOut(false); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); + + font.setOverline(true); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); + font.setOverline(false); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); font.setCapitalization(QFont::SmallCaps); - QVERIFY( font != font2 ); - QCOMPARE(font < font2,!(font2 < font)); + QVERIFY(font != font2); + QCOMPARE(font < font2,!(font2 < font)); font.setCapitalization(QFont::MixedCase); - QVERIFY( font == font2 ); - QVERIFY(!(font < font2)); + QVERIFY(font == font2); + QVERIFY(!(font < font2)); } #if defined(Q_WS_X11) { - QFont font1, font2; - font1.setRawName("-Adobe-Helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1"); - font2.setRawName("-Adobe-Helvetica-medium-r-normal--24-240-75-75-p-130-iso8859-1"); - QVERIFY(font1 != font2); + QFont font1, font2; + font1.setRawName("-Adobe-Helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1"); + font2.setRawName("-Adobe-Helvetica-medium-r-normal--24-240-75-75-p-130-iso8859-1"); + QVERIFY(font1 != font2); } #endif } diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index 104d3465f2..fa5c81a2f0 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -124,11 +124,11 @@ void tst_QFontDatabase::styles() QStringList styles = fdb.styles( font ); QStringList::Iterator it = styles.begin(); while ( it != styles.end() ) { - QString style = *it; - QString trimmed = style.trimmed(); - ++it; + QString style = *it; + QString trimmed = style.trimmed(); + ++it; - QCOMPARE( style, trimmed ); + QCOMPARE(style, trimmed); } } @@ -160,7 +160,7 @@ void tst_QFontDatabase::fixedPitch() QFontDatabase fdb; if (!fdb.families().contains(font)) - QSKIP( "Font not installed"); + QSKIP("Font not installed"); QCOMPARE(fdb.isFixedPitch(font), fixedPitch); diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp index cddec5b6e7..7adaac9fac 100644 --- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp @@ -163,7 +163,7 @@ void tst_QFontMetrics::metrics() fontmetrics.lineSpacing()); } } - } + } } } diff --git a/tests/auto/gui/text/qtextdocument/common.h b/tests/auto/gui/text/qtextdocument/common.h index 8fb5fe2499..184b2f7ec7 100644 --- a/tests/auto/gui/text/qtextdocument/common.h +++ b/tests/auto/gui/text/qtextdocument/common.h @@ -79,11 +79,11 @@ public: int l; void expect(int from, int oldLength, int length) { - f = from; - o = oldLength; - l = length; - error = false; - called = false; + f = from; + o = oldLength; + l = length; + error = false; + called = false; } bool error; bool called; diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 9f9b6acb02..009b536d7e 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -360,8 +360,8 @@ void tst_QTextDocumentFragment::listCopying2() cursor.movePosition(QTextCursor::Start); int listItemCount = 0; do { - if (cursor.currentList()) - listItemCount++; + if (cursor.currentList()) + listItemCount++; } while (cursor.movePosition(QTextCursor::NextBlock)); QCOMPARE(listItemCount, 4); @@ -378,35 +378,35 @@ void tst_QTextDocumentFragment::tableCopying() // as the pasiveness of the tablemanager. QTextDocumentFragment fragment; { - QTextDocument doc; - QTextCursor cursor(&doc); + QTextDocument doc; + QTextCursor cursor(&doc); - QTextTableFormat fmt; - QTextTable *table = cursor.insertTable(2, 2, fmt); + QTextTableFormat fmt; + QTextTable *table = cursor.insertTable(2, 2, fmt); - table->cellAt(0, 0).firstCursorPosition().insertText("First Cell"); - table->cellAt(0, 1).firstCursorPosition().insertText("Second Cell"); - table->cellAt(1, 0).firstCursorPosition().insertText("Third Cell"); - table->cellAt(1, 1).firstCursorPosition().insertText("Fourth Cell"); + table->cellAt(0, 0).firstCursorPosition().insertText("First Cell"); + table->cellAt(0, 1).firstCursorPosition().insertText("Second Cell"); + table->cellAt(1, 0).firstCursorPosition().insertText("Third Cell"); + table->cellAt(1, 1).firstCursorPosition().insertText("Fourth Cell"); - fragment = QTextDocumentFragment(&doc); + fragment = QTextDocumentFragment(&doc); } { - QTextDocument doc; - QTextCursor cursor(&doc); + QTextDocument doc; + QTextCursor cursor(&doc); - cursor.insertText("FooBar"); - cursor.insertBlock(); - cursor.movePosition(QTextCursor::Left); + cursor.insertText("FooBar"); + cursor.insertBlock(); + cursor.movePosition(QTextCursor::Left); - cursor.insertFragment(fragment); - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock); + cursor.insertFragment(fragment); + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::NextBlock); - QTextTable *table = cursor.currentTable(); - QVERIFY(table); - QCOMPARE(table->rows(), 2); - QCOMPARE(table->columns(), 2); + QTextTable *table = cursor.currentTable(); + QVERIFY(table); + QCOMPARE(table->rows(), 2); + QCOMPARE(table->columns(), 2); } } @@ -488,91 +488,91 @@ void tst_QTextDocumentFragment::tableImport() void tst_QTextDocumentFragment::tableImport2() { { - const char html[] = "" - "" - "" - "" - "
First CellSecond Cell
Third CellFourth Cell
"; - - QTextDocument doc; - QTextCursor cursor(&doc); - cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(html, sizeof(html) / sizeof(html[0])))); - - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock); - QTextTable *table = cursor.currentTable(); - QVERIFY(table); - QCOMPARE(table->columns(), 2); - QCOMPARE(table->rows(), 2); + const char html[] = "" + "" + "" + "" + "
First CellSecond Cell
Third CellFourth Cell
"; + + QTextDocument doc; + QTextCursor cursor(&doc); + cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(html, sizeof(html) / sizeof(html[0])))); + + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::NextBlock); + QTextTable *table = cursor.currentTable(); + QVERIFY(table); + QCOMPARE(table->columns(), 2); + QCOMPARE(table->rows(), 2); } { - const char html[] = "" - "" - "" - "" - "
First CellSecond Cell
Third Cell" - " " - " " - " " - " " - "
First Nested CellSecond Nested Cell
Third Nested CellFourth Nested Cell
Fifth Nested CellSixth Nested Cell
"; - - QTextDocument doc; - QTextCursor cursor(&doc); - cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(html, sizeof(html) / sizeof(html[0])))); - - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock); - QTextTable *table = cursor.currentTable(); - QVERIFY(table); - QCOMPARE(table->columns(), 2); - QCOMPARE(table->rows(), 2); + const char html[] = "" + "" + "" + "" + "
First CellSecond Cell
Third Cell" + " " + " " + " " + " " + "
First Nested CellSecond Nested Cell
Third Nested CellFourth Nested Cell
Fifth Nested CellSixth Nested Cell
"; + + QTextDocument doc; + QTextCursor cursor(&doc); + cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(html, sizeof(html) / sizeof(html[0])))); + + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::NextBlock); + QTextTable *table = cursor.currentTable(); + QVERIFY(table); + QCOMPARE(table->columns(), 2); + QCOMPARE(table->rows(), 2); /* - QTextCursor fourthCell = table->cellAt(1, 1).firstCursorPosition(); - fourthCell.movePosition(QTextCursor::NextBlock); - table = fourthCell.currentTable(); - QVERIFY(table); - QVERIFY(table != cursor.currentTable()); - QCOMPARE(table->columns(), 2); - QCOMPARE(table->rows(), 3); + QTextCursor fourthCell = table->cellAt(1, 1).firstCursorPosition(); + fourthCell.movePosition(QTextCursor::NextBlock); + table = fourthCell.currentTable(); + QVERIFY(table); + QVERIFY(table != cursor.currentTable()); + QCOMPARE(table->columns(), 2); + QCOMPARE(table->rows(), 3); */ } { - const char buggyHtml[] = "" - "" - "
First CellSecond Cell" - "
Third CellFourth Cell" - "
"; - - QTextDocument doc; - QTextCursor cursor(&doc); - cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(buggyHtml, sizeof(buggyHtml) / sizeof(buggyHtml[0])))); - - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock); - QTextTable *table = cursor.currentTable(); - QVERIFY(table); - QCOMPARE(table->columns(), 2); - QCOMPARE(table->rows(), 2); + const char buggyHtml[] = "" + "" + "
First CellSecond Cell" + "
Third CellFourth Cell" + "
"; + + QTextDocument doc; + QTextCursor cursor(&doc); + cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(buggyHtml, sizeof(buggyHtml) / sizeof(buggyHtml[0])))); + + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::NextBlock); + QTextTable *table = cursor.currentTable(); + QVERIFY(table); + QCOMPARE(table->columns(), 2); + QCOMPARE(table->rows(), 2); } { - const char buggyHtml[] = "" - "" - "
First CellSecond Cell" - "
Third CellFourth Cell" - "
"; - - QTextDocument doc; - QTextCursor cursor(&doc); - cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(buggyHtml, sizeof(buggyHtml) / sizeof(buggyHtml[0])))); - - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock); - QTextTable *table = cursor.currentTable(); - QVERIFY(table); - QCOMPARE(table->columns(), 2); - QCOMPARE(table->rows(), 2); + const char buggyHtml[] = "" + "" + "
First CellSecond Cell" + "
Third CellFourth Cell" + "
"; + + QTextDocument doc; + QTextCursor cursor(&doc); + cursor.insertFragment(QTextDocumentFragment::fromHtml(QByteArray::fromRawData(buggyHtml, sizeof(buggyHtml) / sizeof(buggyHtml[0])))); + + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::NextBlock); + QTextTable *table = cursor.currentTable(); + QVERIFY(table); + QCOMPARE(table->columns(), 2); + QCOMPARE(table->rows(), 2); } } diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 90137079f3..56d6711dc6 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -212,63 +212,63 @@ void tst_QTextLayout::lineBreaking() { #if 0 struct Breaks { - const char *utf8; - uchar breaks[32]; + const char *utf8; + uchar breaks[32]; }; Breaks brks[] = { - { "11", { false, 0xff } }, - { "aa", { false, 0xff } }, - { "++", { false, 0xff } }, - { "--", { false, 0xff } }, - { "((", { false, 0xff } }, - { "))", { false, 0xff } }, - { "..", { false, 0xff } }, - { "\"\"", { false, 0xff } }, - { "$$", { false, 0xff } }, - { "!!", { false, 0xff } }, - { "??", { false, 0xff } }, - { ",,", { false, 0xff } }, - - { ")()", { true, false, 0xff } }, - { "?!?", { false, false, 0xff } }, - { ".,.", { false, false, 0xff } }, - { "+-+", { false, false, 0xff } }, - { "+=+", { false, false, 0xff } }, - { "+(+", { false, false, 0xff } }, - { "+)+", { false, false, 0xff } }, - - { "a b", { false, true, 0xff } }, - { "a(b", { false, false, 0xff } }, - { "a)b", { false, false, 0xff } }, - { "a-b", { false, true, 0xff } }, - { "a.b", { false, false, 0xff } }, - { "a+b", { false, false, 0xff } }, - { "a?b", { false, false, 0xff } }, - { "a!b", { false, false, 0xff } }, - { "a$b", { false, false, 0xff } }, - { "a,b", { false, false, 0xff } }, - { "a/b", { false, false, 0xff } }, - { "1/2", { false, false, 0xff } }, - { "./.", { false, false, 0xff } }, - { ",/,", { false, false, 0xff } }, - { "!/!", { false, false, 0xff } }, - { "\\/\\", { false, false, 0xff } }, - { "1 2", { false, true, 0xff } }, - { "1(2", { false, false, 0xff } }, - { "1)2", { false, false, 0xff } }, - { "1-2", { false, false, 0xff } }, - { "1.2", { false, false, 0xff } }, - { "1+2", { false, false, 0xff } }, - { "1?2", { false, true, 0xff } }, - { "1!2", { false, true, 0xff } }, - { "1$2", { false, false, 0xff } }, - { "1,2", { false, false, 0xff } }, - { "1/2", { false, false, 0xff } }, - { "\330\260\331\216\331\204\331\220\331\203\331\216", { false, false, false, false, false, 0xff } }, - { "\330\247\331\204\331\205 \330\247\331\204\331\205", { false, false, false, true, false, false, 0xff } }, - { "1#2", { false, false, 0xff } }, - { "!#!", { false, false, 0xff } }, - { 0, {} } + { "11", { false, 0xff } }, + { "aa", { false, 0xff } }, + { "++", { false, 0xff } }, + { "--", { false, 0xff } }, + { "((", { false, 0xff } }, + { "))", { false, 0xff } }, + { "..", { false, 0xff } }, + { "\"\"", { false, 0xff } }, + { "$$", { false, 0xff } }, + { "!!", { false, 0xff } }, + { "??", { false, 0xff } }, + { ",,", { false, 0xff } }, + + { ")()", { true, false, 0xff } }, + { "?!?", { false, false, 0xff } }, + { ".,.", { false, false, 0xff } }, + { "+-+", { false, false, 0xff } }, + { "+=+", { false, false, 0xff } }, + { "+(+", { false, false, 0xff } }, + { "+)+", { false, false, 0xff } }, + + { "a b", { false, true, 0xff } }, + { "a(b", { false, false, 0xff } }, + { "a)b", { false, false, 0xff } }, + { "a-b", { false, true, 0xff } }, + { "a.b", { false, false, 0xff } }, + { "a+b", { false, false, 0xff } }, + { "a?b", { false, false, 0xff } }, + { "a!b", { false, false, 0xff } }, + { "a$b", { false, false, 0xff } }, + { "a,b", { false, false, 0xff } }, + { "a/b", { false, false, 0xff } }, + { "1/2", { false, false, 0xff } }, + { "./.", { false, false, 0xff } }, + { ",/,", { false, false, 0xff } }, + { "!/!", { false, false, 0xff } }, + { "\\/\\", { false, false, 0xff } }, + { "1 2", { false, true, 0xff } }, + { "1(2", { false, false, 0xff } }, + { "1)2", { false, false, 0xff } }, + { "1-2", { false, false, 0xff } }, + { "1.2", { false, false, 0xff } }, + { "1+2", { false, false, 0xff } }, + { "1?2", { false, true, 0xff } }, + { "1!2", { false, true, 0xff } }, + { "1$2", { false, false, 0xff } }, + { "1,2", { false, false, 0xff } }, + { "1/2", { false, false, 0xff } }, + { "\330\260\331\216\331\204\331\220\331\203\331\216", { false, false, false, false, false, 0xff } }, + { "\330\247\331\204\331\205 \330\247\331\204\331\205", { false, false, false, true, false, false, 0xff } }, + { "1#2", { false, false, 0xff } }, + { "!#!", { false, false, 0xff } }, + { 0, {} } }; Breaks *b = brks; while (b->utf8) { diff --git a/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp b/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp index 10a25ba437..0628cc66d1 100644 --- a/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp +++ b/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp @@ -119,7 +119,7 @@ void tst_QTextList::autoNumbering() QVERIFY(list); for (int i = 0; i < 27; ++i) - cursor.insertBlock(); + cursor.insertBlock(); QVERIFY(list->count() == 28); diff --git a/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp index 3359cc8d32..5efb532233 100644 --- a/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp +++ b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp @@ -158,12 +158,12 @@ void tst_QTextPieceTable::insertion3() { QString compare; for (int i = 0; i < 20000; ++i) { - int pos = rand() % (i+1); - QChar c((unsigned short)(i & 0xff) + 1); - QString str; - str += c; - table->insert(pos, str, charFormatIndex); - compare.insert(pos, str); + int pos = rand() % (i+1); + QChar c((unsigned short)(i & 0xff) + 1); + QString str; + str += c; + table->insert(pos, str, charFormatIndex); + compare.insert(pos, str); } QVERIFY(table->plainText() == compare); } @@ -172,17 +172,17 @@ void tst_QTextPieceTable::insertion4() { QString compare; for (int i = 0; i < 20000; ++i) { - int pos = rand() % (i+1); - QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); - QString str; - str += c; - str += c; - table->insert(pos, str, charFormatIndex); - compare.insert(pos, str); - // if (table->text() != compare) { - // qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->text().latin1()); - // exit(12); - // } + int pos = rand() % (i+1); + QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); + QString str; + str += c; + str += c; + table->insert(pos, str, charFormatIndex); + compare.insert(pos, str); +// if (table->text() != compare) { +// qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->text().latin1()); +// exit(12); +// } } QVERIFY(table->plainText() == compare); } @@ -191,23 +191,23 @@ void tst_QTextPieceTable::insertion5() { QString compare; for (int i = 0; i < 20000; ++i) { - int pos = rand() % (i+1); - QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); - QString str; - str += c; - str += c; - if (c == 'a') { - table->insertBlock(pos, blockFormatIndex, charFormatIndex); - str = QChar(QChar::ParagraphSeparator); - } else { - table->insert(pos, str, charFormatIndex); - } - compare.insert(pos, str); + int pos = rand() % (i+1); + QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); + QString str; + str += c; + str += c; + if (c == 'a') { + table->insertBlock(pos, blockFormatIndex, charFormatIndex); + str = QChar(QChar::ParagraphSeparator); + } else { + table->insert(pos, str, charFormatIndex); + } + compare.insert(pos, str); } QVERIFY(table->plainText() == compare); for (QTextBlock it = table->blocksBegin(); it != table->blocksEnd(); it = it.next()) { - QTextDocumentPrivate::FragmentIterator fit = table->find(it.position()); - QVERIFY(fit.position() == it.position()); + QTextDocumentPrivate::FragmentIterator fit = table->find(it.position()); + QVERIFY(fit.position() == it.position()); } } @@ -249,24 +249,24 @@ void tst_QTextPieceTable::removal3() QString compare; int l = 0; for (int i = 0; i < 20000; ++i) { - bool remove = l && (rand() % 2); - int pos = rand() % (remove ? l : (l+1)); - QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); - QString str; - str += c; - str += c; - if (remove && pos < table->length()) { - compare.remove(pos, 1); - table->remove(pos, 1); - } else { - compare.insert(pos, str); - table->insert(pos, str, charFormatIndex); - } - l += remove ? -1 : 2; - // if (table->text() != compare) { - // qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->text().latin1()); - // exit(12); - // } + bool remove = l && (rand() % 2); + int pos = rand() % (remove ? l : (l+1)); + QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); + QString str; + str += c; + str += c; + if (remove && pos < table->length()) { + compare.remove(pos, 1); + table->remove(pos, 1); + } else { + compare.insert(pos, str); + table->insert(pos, str, charFormatIndex); + } + l += remove ? -1 : 2; +// if (table->text() != compare) { +// qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->text().latin1()); +// exit(12); +// } } QVERIFY(table->plainText() == compare); } @@ -276,31 +276,31 @@ void tst_QTextPieceTable::removal4() QString compare; int l = 0; for (int i = 0; i < 20000; ++i) { - bool remove = l && (rand() % 2); - int pos = (l > 1) ? rand() % (remove ? l-1 : l) : 0; - QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); - QString str; - if (c != 'a') { - str += c; - str += c; - } else { - str = QChar(QChar::ParagraphSeparator); - } - if (remove && pos < table->length() - 1) { - compare.remove(pos, 1); - table->remove(pos, 1); - } else { - if (str[0] == QChar(QChar::ParagraphSeparator)) - table->insertBlock(pos, blockFormatIndex, charFormatIndex); - else - table->insert(pos, str, charFormatIndex); - compare.insert(pos, str); - } - l += remove ? -1 : 2; -// if (table->plainText() != compare) { -// qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->plainText().latin1()); -// exit(12); -// } + bool remove = l && (rand() % 2); + int pos = (l > 1) ? rand() % (remove ? l-1 : l) : 0; + QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); + QString str; + if (c != 'a') { + str += c; + str += c; + } else { + str = QChar(QChar::ParagraphSeparator); + } + if (remove && pos < table->length() - 1) { + compare.remove(pos, 1); + table->remove(pos, 1); + } else { + if (str[0] == QChar(QChar::ParagraphSeparator)) + table->insertBlock(pos, blockFormatIndex, charFormatIndex); + else + table->insert(pos, str, charFormatIndex); + compare.insert(pos, str); + } + l += remove ? -1 : 2; +// if (table->plainText() != compare) { +// qDebug("compare failed: i=%d (current char=%c) insert at %d\nexpected '%s'\ngot '%s'", i, (i % 26) + (i>25?'A':'a'), pos, compare.latin1(), table->plainText().latin1()); +// exit(12); +// } } QVERIFY(table->plainText() == compare); } @@ -490,27 +490,27 @@ void tst_QTextPieceTable::undoRedo11() QString compare; int l = 0; for (int i = 0; i < loops; ++i) { - bool remove = l && (rand() % 2); - int pos = (l > 1) ? rand() % (remove ? l-1 : l) : 0; - QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); - QString str; - str += c; - str += c; - if (remove) { - compare.remove(pos, 1); - table->remove(pos, 1); - } else { - compare.insert(pos, str); - table->insert(pos, str, charFormatIndex); - } - l += remove ? -1 : 2; + bool remove = l && (rand() % 2); + int pos = (l > 1) ? rand() % (remove ? l-1 : l) : 0; + QChar c((unsigned short)((i % 26) + (i>25?'A':'a'))); + QString str; + str += c; + str += c; + if (remove) { + compare.remove(pos, 1); + table->remove(pos, 1); + } else { + compare.insert(pos, str); + table->insert(pos, str, charFormatIndex); + } + l += remove ? -1 : 2; } QVERIFY(table->plainText() == compare); for (int i = 0; i < loops; ++i) - table->undo(); + table->undo(); QVERIFY(table->plainText() == QString("")); for (int i = 0; i < loops; ++i) - table->redo(); + table->redo(); QVERIFY(table->plainText() == compare); } -- cgit v1.2.3