From: isn Date: Wed, 15 Nov 2017 18:43:15 +0000 (+0300) Subject: tests for ECW files X-Git-Tag: v2.1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ab6494e3b4bb6b309e89ce605d9c09aa202009c3;p=modules%2Fhydro.git tests for ECW files --- diff --git a/src/HYDRO_tests/reference_data/CMakeLists.txt b/src/HYDRO_tests/reference_data/CMakeLists.txt index d7d2238f..abc9163d 100644 --- a/src/HYDRO_tests/reference_data/CMakeLists.txt +++ b/src/HYDRO_tests/reference_data/CMakeLists.txt @@ -21,6 +21,8 @@ SET(REFERENCE_DATA + 01-2009-0865-6525-LA93.ecw + 01-2009-0865-6525-LA93.png Channel.png CLC06.cst CLC06-cut_1.dbf diff --git a/src/HYDRO_tests/reference_data/linux/01-2009-0865-6525-LA93.ecw b/src/HYDRO_tests/reference_data/linux/01-2009-0865-6525-LA93.ecw new file mode 100644 index 00000000..d7e7206c Binary files /dev/null and b/src/HYDRO_tests/reference_data/linux/01-2009-0865-6525-LA93.ecw differ diff --git a/src/HYDRO_tests/reference_data/linux/01-2009-0865-6525-LA93.png b/src/HYDRO_tests/reference_data/linux/01-2009-0865-6525-LA93.png new file mode 100644 index 00000000..f357cacd Binary files /dev/null and b/src/HYDRO_tests/reference_data/linux/01-2009-0865-6525-LA93.png differ diff --git a/src/HYDRO_tests/reference_data/win32/01-2009-0865-6525-LA93.ecw b/src/HYDRO_tests/reference_data/win32/01-2009-0865-6525-LA93.ecw new file mode 100644 index 00000000..d7e7206c Binary files /dev/null and b/src/HYDRO_tests/reference_data/win32/01-2009-0865-6525-LA93.ecw differ diff --git a/src/HYDRO_tests/reference_data/win32/01-2009-0865-6525-LA93.png b/src/HYDRO_tests/reference_data/win32/01-2009-0865-6525-LA93.png new file mode 100644 index 00000000..f357cacd Binary files /dev/null and b/src/HYDRO_tests/reference_data/win32/01-2009-0865-6525-LA93.png differ diff --git a/src/HYDRO_tests/test_HYDROData_Image.cxx b/src/HYDRO_tests/test_HYDROData_Image.cxx index 4ab09f26..2569fe60 100644 --- a/src/HYDRO_tests/test_HYDROData_Image.cxx +++ b/src/HYDRO_tests/test_HYDROData_Image.cxx @@ -169,6 +169,39 @@ void test_HYDROData_Image::testCopy() 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; diff --git a/src/HYDRO_tests/test_HYDROData_Image.h b/src/HYDRO_tests/test_HYDROData_Image.h index 36001373..4ebd5b5c 100644 --- a/src/HYDRO_tests/test_HYDROData_Image.h +++ b/src/HYDRO_tests/test_HYDROData_Image.h @@ -25,6 +25,8 @@ class test_HYDROData_Image : public CppUnit::TestFixture { CPPUNIT_TEST(testReferences); CPPUNIT_TEST(testCopy); CPPUNIT_TEST(testDiff); + CPPUNIT_TEST(test_static_loadECW); + CPPUNIT_TEST(test_loadECW); CPPUNIT_TEST_SUITE_END(); private: @@ -47,6 +49,10 @@ public: // 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);