test Picture: Change file open of ifstream to binary(and readonly) type

When opening a file using ifstream, a different problem occurs for each platform.
To fix this, change to binary, readonly type.

refer to:
https://stackoverflow.com/questions/9817806/why-does-my-program-produce-different-results-on-windows-and-linux-about-file-r
This commit is contained in:
JunsuChoi 2021-10-28 12:07:49 +09:00 committed by Hermet Park
parent 370b9b08ec
commit a7f7cbd29a

View file

@ -129,7 +129,7 @@ TEST_CASE("Load PNG file from data", "[tvgPicture]")
REQUIRE(picture); REQUIRE(picture);
//Open file //Open file
ifstream file(TEST_DIR"/test.png"); ifstream file(TEST_DIR"/test.png", std::ios::in | std::ios::binary);
REQUIRE(file.is_open()); REQUIRE(file.is_open());
auto size = sizeof(uint32_t) * (1000*1000); auto size = sizeof(uint32_t) * (1000*1000);
auto data = (char*)malloc(size); auto data = (char*)malloc(size);
@ -170,7 +170,7 @@ TEST_CASE("Load JPG file from data", "[tvgPicture]")
REQUIRE(picture); REQUIRE(picture);
//Open file //Open file
ifstream file(TEST_DIR"/test.jpg"); ifstream file(TEST_DIR"/test.jpg", std::ios::in | std::ios::binary);
REQUIRE(file.is_open()); REQUIRE(file.is_open());
auto begin = file.tellg(); auto begin = file.tellg();
file.seekg(0, std::ios::end); file.seekg(0, std::ios::end);
@ -214,7 +214,7 @@ TEST_CASE("Load TVG file from data", "[tvgPicture]")
REQUIRE(picture); REQUIRE(picture);
//Open file //Open file
ifstream file(TEST_DIR"/tag.tvg"); ifstream file(TEST_DIR"/tag.tvg", std::ios::in | std::ios::binary);
REQUIRE(file.is_open()); REQUIRE(file.is_open());
auto begin = file.tellg(); auto begin = file.tellg();
file.seekg(0, std::ios::end); file.seekg(0, std::ios::end);