Beispiel #1
0
void TestStoryText::insertPar()
{
    StoryText story;
    story.insertChars(0, QString("Hallo") + SpecialChars::PARSEP + QString("Welt"));
    QCOMPARE(story.length(), 10);
    QCOMPARE(story.nrOfParagraphs(), 2u);
    QCOMPARE(story.nrOfRuns(), 2u);
    for (int i =0; i <= story.nrOfParagraphs(); ++i)
        qDebug() << "par" << i << "offset" << story.startOfParagraph(i);
    QCOMPARE(story.text(0,10).length(), 10);
    QCOMPARE(story.text(0, story.length()), QString("Hallo") + SpecialChars::PARSEP + QString("Welt"));
}
Beispiel #2
0
void TestStoryText::initST()
{
    StoryText story;
    QCOMPARE(story.length(), 0);
    story.insertChars(0, "Hallo Welt");
    QCOMPARE(story.nrOfParagraphs(), 1u);
    QCOMPARE(story.nrOfRuns(), 1u);
}
Beispiel #3
0
void TestStoryText::removePars()
{
    StoryText story;
    story.insertChars(0,
                      QString("0123456789") + SpecialChars::PARSEP +
                      QString("abcdefghijklmnopqrstuvwxyz") + SpecialChars::PARSEP +
                      QString("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
    story.removeChars(5 + 26 + 1,  26 + 1);

    QCOMPARE(story.nrOfParagraphs(), 2u);
    QCOMPARE(story.text(0, story.length()),
             QString("0123456789") + SpecialChars::PARSEP + QString("abcdefghijklmnopqrstuVWXYZ"));
}