Пример #1
0
void TestRTFAText::TestWrite_rtl()
{
	ComparisonContext cContext;
	RTFFileContext context;
	RTFatext_rtl textObject(&context);

	CTestOnlyRTFWriter fakeWriter(&context);

	textObject.m_iTok1 = tok_rtlrun;
	textObject.m_iTok2 = tok_ltrrun;
	
	textObject.m_iAf1 = 37;
	textObject.m_iAf2 = 27;
	
	textObject.m_b1sf = false;
	textObject.m_b2sf = false;
	
	textObject.Write(&fakeWriter);
	assertTest(fakeWriter.m_csBuf == "\\rtlch\\af37\\ltrch\\af27");
}
Пример #2
0
void KisPaintDeviceTest::testStore()
{

    const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
    KisPaintDeviceSP dev = new KisPaintDevice(cs);

    KoStore * readStore =
        KoStore::createStore(QString(FILES_DATA_DIR) + QDir::separator() + "store_test.kra", KoStore::Read);
    readStore->open("built image/layers/layer0");
    QVERIFY(dev->read(readStore->device()));
    readStore->close();
    delete readStore;

    QVERIFY(dev->exactBounds() == QRect(0, 0, 100, 100));

    KoStore * writeStore =
        KoStore::createStore(QString(FILES_OUTPUT_DIR) + QDir::separator() + "store_test_out.kra", KoStore::Write);
    KisFakePaintDeviceWriter fakeWriter(writeStore);
    writeStore->open("built image/layers/layer0");
    QVERIFY(dev->write(fakeWriter));
    writeStore->close();
    delete writeStore;

    KisPaintDeviceSP dev2 = new KisPaintDevice(cs);
    readStore =
        KoStore::createStore(QString(FILES_OUTPUT_DIR) + QDir::separator() + "store_test_out.kra", KoStore::Read);
    readStore->open("built image/layers/layer0");
    QVERIFY(dev2->read(readStore->device()));
    readStore->close();
    delete readStore;

    QVERIFY(dev2->exactBounds() == QRect(0, 0, 100, 100));

    QPoint pt;
    if (!TestUtil::comparePaintDevices(pt, dev, dev2)) {
        QFAIL(QString("Loading a saved image is not pixel perfect, first different pixel: %1,%2 ").arg(pt.x()).arg(pt.y()).toLatin1());
    }

}
Пример #3
0
void TestRTFAText::TestWrite_xxch()
{
	ComparisonContext cContext;
	RTFFileContext context;
	RTFatext_xxch textObject(&context);
	CTestOnlyRTFWriter fakeWriter(&context);

	textObject.m_iTok1 = tok_hich;
	textObject.m_iTok2 = tok_loch;
	textObject.m_iTok3 = tok_dbch;
	
	textObject.m_iAf1 = 37;
	textObject.m_iAf2 = 27;
	textObject.m_iAf3 = 17;
	
	textObject.m_b1sf = false;
	textObject.m_b2sf = false;
	textObject.m_b3sf = true;
	
	textObject.Write(&fakeWriter);
	assertTest(fakeWriter.m_csBuf == "\\hich\\af37\\loch\\af27\\dbch\\f17");
}