X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDRO_tests%2Ftest_HYDROGUI_BathymetryPrs.cxx;h=99c2ea2ed31680e5243801b6fd39d876a9e23c81;hb=3bece499e83cc9ca95536228c7f6740030e9d5d8;hp=39b7b9c9bbff892787b687f9805cc34de215e825;hpb=d89b531334d90aa48861e4ffb51f44852829554d;p=modules%2Fhydro.git diff --git a/src/HYDRO_tests/test_HYDROGUI_BathymetryPrs.cxx b/src/HYDRO_tests/test_HYDROGUI_BathymetryPrs.cxx index 39b7b9c9..99c2ea2e 100644 --- a/src/HYDRO_tests/test_HYDROGUI_BathymetryPrs.cxx +++ b/src/HYDRO_tests/test_HYDROGUI_BathymetryPrs.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,7 @@ void test_HYDROGUI_BathymetryPrs::createBathPrs() { myBathPrs = new HYDROGUI_ShapeBathymetry( 0, TestViewer::context(), myBath ); myBathPrs->Build(); + myBathPrs->getAISObjects()[0]->SetAutoHilight( Standard_False ); double min, max; myBathPrs->GetRange( min, max ); @@ -58,19 +60,18 @@ void test_HYDROGUI_BathymetryPrs::updateColors() myBathPrs->UpdateWithColorScale( TestViewer::colorScale() ); } - void test_HYDROGUI_BathymetryPrs::test_presentation() { - TestViewer::eraseAll( true ); - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); - + TestViewer::eraseAll( true, true ); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); + importTestBath( aDoc ); TestViewer::showColorScale( false ); createBathPrs(); updateColors(); - Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObject(); + Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObjects()[0]; CPPUNIT_ASSERT( !bprs.IsNull() ); TestViewer::show( bprs, 0, 0, true, "bathy_prs" ); @@ -78,7 +79,7 @@ void test_HYDROGUI_BathymetryPrs::test_presentation() //QTest::qWait( 50000 ); aDoc->Close(); - TestViewer::eraseAll( true ); + TestViewer::eraseAll( true, true ); } void select( int x1, int y1, int x2, int y2 ) @@ -93,7 +94,8 @@ void select( int x1, int y1, int x2, int y2 ) void test_HYDROGUI_BathymetryPrs::test_selection() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + TestViewer::eraseAll( true, true ); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); importTestBath( aDoc ); TestViewer::showColorScale( false ); @@ -101,7 +103,7 @@ void test_HYDROGUI_BathymetryPrs::test_selection() createBathPrs(); updateColors(); - Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObject(); + Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObjects()[0]; CPPUNIT_ASSERT( !bprs.IsNull() ); TestViewer::show( bprs, 0, 1, true, "bathy_prs" ); @@ -111,15 +113,20 @@ void test_HYDROGUI_BathymetryPrs::test_selection() TestViewer::setKey( "bathy_selection" ); CPPUNIT_ASSERT_IMAGES + select( 5, 5, 6, 6 ); + TestViewer::setKey( "bathy_prs" ); + CPPUNIT_ASSERT_IMAGES + //QTest::qWait( 50000 ); aDoc->Close(); - TestViewer::eraseAll( true ); + TestViewer::eraseAll( true, true ); } void test_HYDROGUI_BathymetryPrs::test_rescale_by_selection() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + TestViewer::eraseAll( true, true ); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); importTestBath( aDoc ); TestViewer::showColorScale( false ); @@ -127,7 +134,7 @@ void test_HYDROGUI_BathymetryPrs::test_rescale_by_selection() createBathPrs(); updateColors(); - Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObject(); + Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObjects()[0]; CPPUNIT_ASSERT( !bprs.IsNull() ); TestViewer::show( bprs, 0, 1, true, "bathy_prs" ); @@ -138,9 +145,11 @@ void test_HYDROGUI_BathymetryPrs::test_rescale_by_selection() myBathPrs->RescaleBySelection(); updateColors(); // In HYDRO GUI it should be done by displayer + //QTest::qWait( 50000 ); + double min, max; myBathPrs->GetRange( min, max ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 177.78, min, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 175.56, min, EPS ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 182.70, max, EPS ); TestViewer::colorScale()->GetRange( min, max ); @@ -170,12 +179,13 @@ void test_HYDROGUI_BathymetryPrs::test_rescale_by_selection() //QTest::qWait( 50000 ); aDoc->Close(); - TestViewer::eraseAll( true ); + TestViewer::eraseAll( true, true ); } void test_HYDROGUI_BathymetryPrs::test_rescale_by_visible() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + TestViewer::eraseAll( true, true ); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); importTestBath( aDoc ); TestViewer::showColorScale( false ); @@ -183,7 +193,7 @@ void test_HYDROGUI_BathymetryPrs::test_rescale_by_visible() createBathPrs(); updateColors(); - Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObject(); + Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObjects()[0]; CPPUNIT_ASSERT( !bprs.IsNull() ); TestViewer::show( bprs, 0, 1, true, "bathy_prs" ); @@ -215,11 +225,14 @@ void test_HYDROGUI_BathymetryPrs::test_rescale_by_visible() CPPUNIT_ASSERT_IMAGES; //QTest::qWait( 50000 ); + aDoc->Close(); + TestViewer::eraseAll( true, true ); } void test_HYDROGUI_BathymetryPrs::test_text_presentation() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + TestViewer::eraseAll( true, true ); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); importTestBath( aDoc ); TestViewer::showColorScale( false ); @@ -227,7 +240,7 @@ void test_HYDROGUI_BathymetryPrs::test_text_presentation() createBathPrs(); updateColors(); - Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObject(); + Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObjects()[0]; CPPUNIT_ASSERT( !bprs.IsNull() ); TestViewer::show( bprs, 0, 1, true, "bathy_prs" ); @@ -245,15 +258,32 @@ void test_HYDROGUI_BathymetryPrs::test_text_presentation() TestViewer::setKey( "bathy_text_labels" ); CPPUNIT_ASSERT_IMAGES; + // Disable text labels + myBathPrs->TextLabels( false ); + vp->fitAll(); + qApp->processEvents(); + TestViewer::setKey( "bathy_prs" ); + CPPUNIT_ASSERT_IMAGES; + + // Special case: flag=false + non-empty selection + select( x1, y1, x2, y2 ); + myBathPrs->TextLabels( false ); + vp->fitAll(); + qApp->processEvents(); + TestViewer::setKey( "bathy_prs" ); + CPPUNIT_ASSERT_IMAGES; + + //QTest::qWait( 50000 ); aDoc->Close(); - TestViewer::eraseAll( true ); + TestViewer::eraseAll( true, true ); } void test_HYDROGUI_BathymetryPrs::test_rescale_default() { - Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + TestViewer::eraseAll( true, true ); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); importTestBath( aDoc ); TestViewer::showColorScale( false ); @@ -261,7 +291,7 @@ void test_HYDROGUI_BathymetryPrs::test_rescale_default() createBathPrs(); updateColors(); - Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObject(); + Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObjects()[0]; CPPUNIT_ASSERT( !bprs.IsNull() ); TestViewer::show( bprs, 0, 1, true, "bathy_prs" ); @@ -304,5 +334,35 @@ void test_HYDROGUI_BathymetryPrs::test_rescale_default() //QTest::qWait( 50000 ); aDoc->Close(); - TestViewer::eraseAll( true ); + TestViewer::eraseAll( true, true ); +} + +void test_HYDROGUI_BathymetryPrs::test_fit_on_selected() +{ + TestViewer::eraseAll( true, true ); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); + + importTestBath( aDoc ); + TestViewer::showColorScale( false ); + + createBathPrs(); + updateColors(); + + Handle(AIS_InteractiveObject) bprs = myBathPrs->getAISObjects()[0]; + CPPUNIT_ASSERT( !bprs.IsNull() ); + + TestViewer::show( bprs, 0, 1, true, "bathy_prs" ); + CPPUNIT_ASSERT_IMAGES; + + // Fit selected points on bathymetry + int x1 = 100, y1 = 50, x2 = 250, y2 = 200; + select( x1, y1, x2, y2 ); + TestViewer::viewWindow()->onFitSelection(); + TestViewer::setKey( "bathy_prs_fit_selected" ); + CPPUNIT_ASSERT_IMAGES; + + //QTest::qWait( 50000 ); + + aDoc->Close(); + TestViewer::eraseAll( true, true ); }