| 46 | |
| 47 | template <class LocalFileFormat, class LocalCachedFile> |
| 48 | OCIO_SHARED_PTR<LocalCachedFile> LoadTestFile( |
| 49 | const std::string & fileName, std::ios_base::openmode mode) |
| 50 | { |
| 51 | const std::string filePath(GetTestFilesDir() + "/" + fileName); |
| 52 | |
| 53 | // Open the filePath |
| 54 | std::ifstream filestream; |
| 55 | Platform::OpenInputFileStream(filestream, filePath.c_str(), mode); |
| 56 | |
| 57 | if (!filestream.is_open()) |
| 58 | { |
| 59 | throw Exception("Error opening test file."); |
| 60 | } |
| 61 | |
| 62 | std::string root, extension, name; |
| 63 | pystring::os::path::splitext(root, extension, filePath); |
| 64 | |
| 65 | // Read file |
| 66 | LocalFileFormat tester; |
| 67 | OCIO_SHARED_PTR<CachedFile> cachedFile = tester.read(filestream, filePath, INTERP_DEFAULT); |
| 68 | |
| 69 | filestream.close(); |
| 70 | |
| 71 | return DynamicPtrCast<LocalCachedFile>(cachedFile); |
| 72 | } |
| 73 | |
| 74 | // Relative comparison: check if the difference between value and expected |
| 75 | // relative to (divided by) expected does not exceed the eps. A minimum |
nothing calls this directly
no test coverage detected