]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
tests for ECW files
authorisn <isn@opencascade.com>
Wed, 15 Nov 2017 18:43:15 +0000 (21:43 +0300)
committerisn <isn@opencascade.com>
Wed, 15 Nov 2017 18:43:15 +0000 (21:43 +0300)
src/HYDRO_tests/reference_data/CMakeLists.txt
src/HYDRO_tests/reference_data/linux/01-2009-0865-6525-LA93.ecw [new file with mode: 0644]
src/HYDRO_tests/reference_data/linux/01-2009-0865-6525-LA93.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/win32/01-2009-0865-6525-LA93.ecw [new file with mode: 0644]
src/HYDRO_tests/reference_data/win32/01-2009-0865-6525-LA93.png [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Image.cxx
src/HYDRO_tests/test_HYDROData_Image.h

index d7d2238f906bc968b340e4718aba8a08ea603921..abc9163ddeccee4cb1695eca51cab9f67fcfd8ca 100644 (file)
@@ -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 (file)
index 0000000..d7e7206
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 (file)
index 0000000..f357cac
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 (file)
index 0000000..d7e7206
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 (file)
index 0000000..f357cac
Binary files /dev/null and b/src/HYDRO_tests/reference_data/win32/01-2009-0865-6525-LA93.png differ
index 4ab09f269524937de54409ab8dda9318b543d2fd..2569fe608c12bdf348e770755a6555845136d1f4 100644 (file)
@@ -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;
index 36001373b508334643617470da0b0d105fb391e6..4ebd5b5c0e181ec08a752cfbebaf67d1a7d559c5 100644 (file)
@@ -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);