00001 #include "JPEGTests.h"
00002
00003
00004 void
00005 JPEGTests::testLoader() {
00006 static string images[] = {
00007 "63",
00008 "63-1-subsampling",
00009 "63-floating",
00010 "63-high",
00011 "63-low",
00012 "63-progressive",
00013 "63-restart",
00014 "64",
00015 "comic-progressive",
00016 };
00017 static const int image_count = sizeof(images) / sizeof(*images);
00018
00019 static const string img_prefix("images/jpeg/");
00020 static const string img_suffix(".jpeg");
00021
00022 static const string ref_prefix("images/jpeg/ref/");
00023 static const string ref_suffix(".png");
00024
00025 for (int i = 0; i < image_count; ++i) {
00026 AssertImagesEqual(img_prefix + images[i] + img_suffix,
00027 ref_prefix + images[i] + ref_suffix);
00028 }
00029 }
00030
00031
00032 void
00033 JPEGTests::testIncomplete() {
00034 auto_ptr<Image> image(OpenImage("images/jpeg/jack-incomplete.jpeg"));
00035 CPPUNIT_ASSERT(image.get() != 0);
00036 }
00037
00038
00039 Test*
00040 JPEGTests::suite() {
00041 typedef TestCaller<JPEGTests> Caller;
00042
00043 TestSuite* suite = new TestSuite();
00044 suite->addTest(new Caller("JPEG Loader", &JPEGTests::testLoader));
00045 suite->addTest(new Caller("Incomplete JPEG", &JPEGTests::testIncomplete));
00046 return suite;
00047 }