From a7f7cbd29a0f15fddafcc077cbf778ad68ad9926 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Thu, 28 Oct 2021 12:07:49 +0900 Subject: [PATCH] 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 --- test/testPicture.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/testPicture.cpp b/test/testPicture.cpp index 358d63df..677489a3 100644 --- a/test/testPicture.cpp +++ b/test/testPicture.cpp @@ -129,7 +129,7 @@ TEST_CASE("Load PNG file from data", "[tvgPicture]") REQUIRE(picture); //Open file - ifstream file(TEST_DIR"/test.png"); + ifstream file(TEST_DIR"/test.png", std::ios::in | std::ios::binary); REQUIRE(file.is_open()); auto size = sizeof(uint32_t) * (1000*1000); auto data = (char*)malloc(size); @@ -170,7 +170,7 @@ TEST_CASE("Load JPG file from data", "[tvgPicture]") REQUIRE(picture); //Open file - ifstream file(TEST_DIR"/test.jpg"); + ifstream file(TEST_DIR"/test.jpg", std::ios::in | std::ios::binary); REQUIRE(file.is_open()); auto begin = file.tellg(); file.seekg(0, std::ios::end); @@ -214,7 +214,7 @@ TEST_CASE("Load TVG file from data", "[tvgPicture]") REQUIRE(picture); //Open file - ifstream file(TEST_DIR"/tag.tvg"); + ifstream file(TEST_DIR"/tag.tvg", std::ios::in | std::ios::binary); REQUIRE(file.is_open()); auto begin = file.tellg(); file.seekg(0, std::ios::end);