Skip to content

Commit

Permalink
chore(build): Builds is breaking because font rendering differs on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
bric3 committed Aug 3, 2022
1 parent 3fb8c47 commit d7a6300
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void exercise_saving_graph_to_image(@TempDir Path tempDir, TestInfo testInfo) {
dumpPng(image, testReportDir().resolve(testInfo.getDisplayName() + "-output.png"));
assertImageEquals(
testInfo.getDisplayName(),
readImage("/fg-ak-200x72.png"),
readImage(asset_fg_ak_200x72("png")),
image
);
}
Expand Down Expand Up @@ -118,7 +118,23 @@ void exercice_saving_by_passing_custom_graphics_eg_for_SVG_with_batik(TestInfo t
svgGraphics2D.stream(stringWriter, true);

Files.writeString(testReportDir().resolve(testInfo.getDisplayName() + "-output.svg"), stringWriter.getBuffer());
assertThat(stringWriter.toString()).isEqualTo(content("/fg-ak-200x72.svg"));
var type = "svg";
assertThat(stringWriter.toString()).isEqualTo(content(asset_fg_ak_200x72(type)));
}

private static String asset_fg_ak_200x72(String type) {
return "/fg-ak-200x72" + platform() +
"." + type;
}

private static String platform() {
var osName = System.getProperty("os.name");
if (osName.startsWith("Mac")) {
return "macOs";
} else if (osName.startsWith("Linux")) {
return Objects.equals(System.getenv("CI"), "true") ? "-gha-linux" : "linux";
}
return "";
}

private static String content(String name) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions fireplace-swing/src/test/resources/fg-ak-200x72-macOs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d7a6300

Please sign in to comment.