+}
+
+bool TestViewer::ColorScaleIsDisplayed()
+{
+ return context()->IsDisplayed( colorScale() );
+}
+
+void TestViewer::select( int theViewX, int theViewY )
+{
+ Handle(V3d_View) aView = myViewWindow->getViewPort()->getView();
+ context()->MoveTo( theViewX, theViewY, aView, true);
+ context()->Select(true);
+ // context()->CloseAllContexts();
+}
+
+QString GetLine( QFile& theFile, bool isUtf8 )
+{
+ QByteArray aLineData = theFile.readLine();
+ QString aLine;
+ if( isUtf8 )
+ aLine = QString::fromUtf8( aLineData );
+ else
+ aLine = aLineData;
+ return aLine;
+}
+
+bool TestViewer::areScriptsEqual( const QString& theBaseName,
+ bool isExpectedUtf8,
+ bool isActualUtf8,
+ int theLinesToOmit,
+ QString& theMsg )
+{
+ QString anExpectedRefFilePath = REF_DATA_PATH;
+ anExpectedRefFilePath += "/" + theBaseName;
+
+ QString anActualFilePath = TMP_DIR + "/" + theBaseName;
+
+ QFile anExpected( anExpectedRefFilePath );
+ QFile anActual( anActualFilePath );
+ if( !anExpected.open( QFile::ReadOnly | QFile::Text ) )
+ {
+ theMsg = "Expected file cannot be opened: " + anExpectedRefFilePath;
+ return false;
+ }
+
+ if( !anActual.open( QFile::ReadOnly | QFile::Text ) )
+ {
+ theMsg = "Actual file cannot be opened: " + anActualFilePath;
+ return false;
+ }
+
+ for( int i=0; i<theLinesToOmit; i++ )
+ anExpected.readLine();
+
+ bool isEqual = true;
+ int i = 1;
+ while( !anExpected.atEnd() && isEqual )
+ {
+ QString anExpectedLine = GetLine( anExpected, isExpectedUtf8 );
+ QString anActualLine = GetLine( anActual, isActualUtf8 );
+ isEqual = anExpectedLine == anActualLine;
+ if( !isEqual )
+ theMsg = QString( "line %1\nActual: %2\nExpected: %3" ).arg( i ).arg( anActualLine ).arg( anExpectedLine );
+ i++;
+ }
+
+ while( !anActual.atEnd() && isEqual )
+ {
+ QString anActualLine = GetLine( anActual, isActualUtf8 );
+ anActualLine = anActualLine.trimmed();
+ if( !anActualLine.isEmpty() )
+ isEqual = false;
+ }
+
+ anExpected.close();
+ anActual.close();
+
+ return isEqual;
+}
+
+void TestViewer::setKey( const QString& theKey )
+{
+ myKey = theKey;