void TestFrameLayout::testCopyShapes()
{
    Helper helper;
    m_frames.clear();
    KWPage page = helper.pageManager->page(1);
    KWFrameLayout bfl(helper.pageManager, m_frames);
    connect(&bfl, SIGNAL(newFrameSet(KWFrameSet*)), this, SLOT(addFS(KWFrameSet*)));

    KWTextFrameSet *fs = bfl.getOrCreate(Words::OddPagesHeaderTextFrameSet, page);
    m_frames.append(fs);
    bfl.m_setup = false;

    helper.pageStyle.setHeaderPolicy(Words::HFTypeEvenOdd);

    KWTextFrame *tf = createFrame(QPointF(0,0), *fs);
    KWFrame *cf = createCopyFrame(QPointF(0,300), tf->shape(), *fs);
    QVERIFY(fs->frameCount()==2);
    //FIXME QVERIFY(bfl.hasFrameOn(fs, 1));
    delete tf->shape();

    QVERIFY(fs->frameCount()==1);
    //FIXME QVERIFY(!bfl.hasFrameOn(fs, 1));

    //now try and add a copyframe without crashing
    //sebsauer; it's not crashing but asserting at KWFrameLayout.cpp:750 now
    //bfl.createNewFramesForPage(1);
}
Exemple #2
0
void TestTextFrameSorting::testCopyAfterTextSorting()
{
    KWTextFrameSet tfs(0);
    KWTextFrame * frame1 = createFrame(QPointF(70, 1300), tfs);
    KWFrame * frame2 = createCopyFrame(QPointF(70, 100), frame1->shape(), tfs);
    KWTextFrame * frame3 = createFrame(QPointF(70, 2000), tfs);

    tfs.removeFrame(frame1);

    QCOMPARE(tfs.m_frames[0], frame2);
    QCOMPARE(tfs.m_frames[1], frame3);

    qSort(tfs.m_frames.begin(), tfs.m_frames.end(), KWTextFrameSet::sortTextFrames);

    QCOMPARE(tfs.m_frames[0], frame3);
    QCOMPARE(tfs.m_frames[1], frame2);
}