TEST(doubleDecorator, CodecLibrary)
{
    setUp();

    std::ifstream inFile("basic.bmp", std::ios::binary);
    CHECK_EQUAL(0, !inFile);
    
    HBitmapDecoder decoder = theCodecLibrary->createDecoder(inFile);
    HBitmapIterator iterator = decoder->createIterator();
    
    CHECK(iterator.get());
    CHECK_EQUAL(100, iterator->getBitmapHeight());
    CHECK_EQUAL(100, iterator->getBitmapWidth());

    HBitmapIterator colorInvertIterator(new ColorInversionDecorator(iterator));
    HBitmapIterator darkenColorInvertIterator(new BrightnessDecorator(colorInvertIterator, -50));

    HBitmapEncoder encoder = theCodecLibrary->createEncoder(msBmp, darkenColorInvertIterator);
        
    std::ofstream outFile("output_darkInverted.bmp", std::ios::binary);
    encoder->encodeToStream(outFile);
    // TODO: file compare input/output

    tearDown();
}
예제 #2
0
TEST(BitmapSizeTest, BitmapIterator)
{
	std::ifstream bitmapStream("basic.bmp", std::ios::binary);
	CHECK(bitmapStream.is_open());

	WindowsBitmapDecoder decoder(bitmapStream);
	HBitmapIterator bitmapIter = decoder.createIterator();

	CHECK_EQUAL(100, bitmapIter->getBitmapWidth());
	CHECK_EQUAL(100, bitmapIter->getBitmapHeight());
}
TEST(windowsBitmapDecodeEncode, CodecLibrary)
{
    setUp();

    std::ifstream inFile("basic.bmp", std::ios::binary);
    CHECK_EQUAL(0, !inFile);
    
    HBitmapDecoder decoder = theCodecLibrary->createDecoder(inFile);
    HBitmapIterator iterator = decoder->createIterator();
    
    CHECK(iterator.get());
    CHECK_EQUAL(100, iterator->getBitmapHeight());
    CHECK_EQUAL(100, iterator->getBitmapWidth());

    HBitmapEncoder encoder = theCodecLibrary->createEncoder(msBmp, iterator);

    std::ofstream outFile("output_basicCopy.bmp", std::ios::binary);
    encoder->encodeToStream(outFile);
    // TODO: file compare input/output

    tearDown();
}