2020-01-17 03:06:54 -06:00
|
|
|
|
|
|
|
|
2020-06-19 00:53:59 -05:00
|
|
|
namespace cvftest
|
|
|
|
{
|
2020-01-17 03:06:54 -06:00
|
|
|
//==================================================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==================================================================================================
|
|
|
|
class Utils
|
|
|
|
{
|
|
|
|
public:
|
2020-06-19 00:53:59 -05:00
|
|
|
static cvf::String getTestDataDir( const cvf::String& unitTestFolder )
|
2020-01-17 03:06:54 -06:00
|
|
|
{
|
|
|
|
#ifdef WIN32
|
2020-06-19 00:53:59 -05:00
|
|
|
std::string exe = std::string( testing::internal::GetArgvs()[0] );
|
2020-01-17 03:06:54 -06:00
|
|
|
#else
|
2020-06-19 00:53:59 -05:00
|
|
|
std::string dir = std::string( testing::internal::FilePath::GetCurrentDir().ToString() );
|
|
|
|
std::string exe = dir + std::string( "/" ) + std::string( testing::internal::GetArgvs()[0] );
|
2020-01-17 03:06:54 -06:00
|
|
|
#endif
|
2020-06-19 00:53:59 -05:00
|
|
|
std::string testPath = exe.substr( 0, exe.find( unitTestFolder.toStdString() ) ) + std::string( "TestData/" );
|
2020-01-17 03:06:54 -06:00
|
|
|
|
|
|
|
return testPath;
|
|
|
|
}
|
|
|
|
|
2020-06-19 00:53:59 -05:00
|
|
|
static cvf::String getGLSLDir( const cvf::String& unitTestFolder )
|
2020-01-17 03:06:54 -06:00
|
|
|
{
|
|
|
|
#ifdef WIN32
|
2020-06-19 00:53:59 -05:00
|
|
|
std::string exe = std::string( testing::internal::GetArgvs()[0] );
|
2020-01-17 03:06:54 -06:00
|
|
|
#else
|
2020-06-19 00:53:59 -05:00
|
|
|
std::string dir = std::string( testing::internal::FilePath::GetCurrentDir().ToString() );
|
|
|
|
std::string exe = dir + std::string( "/" ) + std::string( testing::internal::GetArgvs()[0] );
|
2020-01-17 03:06:54 -06:00
|
|
|
#endif
|
2020-06-19 00:53:59 -05:00
|
|
|
std::string glslPath = exe.substr( 0, exe.find( unitTestFolder.toStdString() ) ) +
|
|
|
|
std::string( "../LibRender/glsl/" );
|
2020-01-17 03:06:54 -06:00
|
|
|
|
|
|
|
return glslPath;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-06-19 00:53:59 -05:00
|
|
|
} // namespace cvftest
|