aDoc->Close();
}
+void test_HYDROData_Image::test_static_loadECW()
+{
+ QImage ecwImage;
+ HYDROData_Image::ECW_FileInfo* ECWInfo = new HYDROData_Image::ECW_FileInfo;
+ QString refECWPath = REF_DATA_PATH + "/01-2009-0865-6525-LA93.ecw";
+ QString refPNGPath = REF_DATA_PATH + "/01-2009-0865-6525-LA93.png";
+ //
+ CPPUNIT_ASSERT ( HYDROData_Image::OpenECW(refECWPath.toLatin1().data(), ecwImage, ECWInfo) );
+ CPPUNIT_ASSERT_EQUAL (10000, ECWInfo->myXSize);
+ CPPUNIT_ASSERT_EQUAL (10000, ECWInfo->myYSize);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (0.5, ECWInfo->myCellIncrementX, 0.0001);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (-0.5, ECWInfo->myCellIncrementY, 0.0001);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (865000, ECWInfo->myOriginX, 0.0001);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (6525000, ECWInfo->myOriginY, 0.0001);
+ QImage pngImage(refPNGPath);
+ CPPUNIT_ASSERT( ecwImage == pngImage);
+}
+
+void test_HYDROData_Image::test_loadECW()
+{
+ QImage ecwImage;
+ QString refECWPath = REF_DATA_PATH + "/01-2009-0865-6525-LA93.ecw";
+ QString refPNGPath = REF_DATA_PATH + "/01-2009-0865-6525-LA93.png";
+ //
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+ Handle(HYDROData_Image) ecwHImage = Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
+ //
+ CPPUNIT_ASSERT (ecwHImage->LoadImageECW(refECWPath));
+ QImage pngImage(refPNGPath);
+ CPPUNIT_ASSERT( ecwHImage->Image() == pngImage);
+}
+
+
void test_HYDROData_Image::testDiff()
{
QImage im1, im2;
CPPUNIT_TEST(testReferences);
CPPUNIT_TEST(testCopy);
CPPUNIT_TEST(testDiff);
+ CPPUNIT_TEST(test_static_loadECW);
+ CPPUNIT_TEST(test_loadECW);
CPPUNIT_TEST_SUITE_END();
private:
// checks the image properties copy/paste
void testCopy();
void testDiff();
+
+ // checks if content of reference png file and ecw file is the same
+ void test_static_loadECW();
+ void test_loadECW();
};
CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Image);