Skip to content

Commit

Permalink
Add test for UTF-8 filenames on Linux (issue Bionus#2277)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Mar 25, 2021
1 parent a9206cf commit d0087cd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tests/src/functions-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ TEST_CASE("Functions")
utf8Long += utf8Part;
}
REQUIRE(fixFilenameLinux(utf8Long + "/image.jpg", "/home/test/") == QString(utf8Long + "/image.jpg"));
REQUIRE(fixFilenameLinux(utf8Long + ".jpg", "/home/test/") == QString(utf8Long + ".jpg"));


// 200 UTF-8 chars / 400 bytes is above the limit so should be cut
Expand All @@ -131,6 +132,12 @@ TEST_CASE("Functions")
REQUIRE(actual != QString(utf8Long + "/image.jpg"));
REQUIRE(actual.length() == 127 + 10);
REQUIRE(actual.toUtf8().size() == 254 + 10);

// Same test with the filename instead of dirname
const QString actualF = fixFilenameLinux(utf8Long + "-image.jpg", "/home/test/");
REQUIRE(actualF != QString(utf8Long + "-image.jpg"));
REQUIRE(actualF.length() == 129);
REQUIRE(actualF.toUtf8().size() == 254);
}
}
}
Expand Down

0 comments on commit d0087cd

Please sign in to comment.