On Wed, 3 Feb 2021 17:08:17 GMT, Jeanette Winzenburg <faste...@openjdk.org> wrote:
>> wondering about the system test - what stands in the way to add a simple >> "normal" unit test? > >> >> >> wondering about the system test - what stands in the way to add a simple >> "normal" unit test? > > looks like there might be a bug in StubFontLoader that makes a normal unit > test fail w/out the fix: Axis uses a Text field (measure) for measuring size > requirements for the tick labels - its font has no nativeFont set in the stub > context such that all fields of the bounds of text are always 0, consequently > the change in autoRange never kicks in. Hacking around with explicitly > setting a tickLabelFont gives us a test that fails before and passes after > the fix: > > @Test > public void testRotatedStandAlone() { > Pane root = new Pane(); > Scene scene = new Scene(root); > Stage stage = new Stage(); > stage.setScene(scene); > CategoryAxis xAxis = new > CategoryAxis(FXCollections.observableArrayList(categories)); > // hack around stubFontLoader bug (?feature) > xAxis.setTickLabelFont(new Font(8)); > BarChart<String, Number> chart = new BarChart<>(xAxis, new > NumberAxis()); > chart.setPrefWidth(400); > root.getChildren().add(chart); > stage.show(); > assertEquals(90, xAxis.getTickLabelRotation(), 0.1); > } > > Question is why the stubFontLoader fails: its load implementation looks like > it should always set the nativeFont fiel to a fitting test font, but it > doesn't if the name is a plain "Amble" (vs. a more specialized like "Amble > Regular"). @kleopatra @kevinrushforth Are the system tests that I have provided sufficient for this PR to move forward or do they need to be rewritten as unit tests? ------------- PR: https://git.openjdk.java.net/jfx/pull/342