Skip to content

Commit 9143377

Browse files
author
Andy Goryachev
committedMar 26, 2025
8342565: [TestBug] StubTextLayout
Reviewed-by: mhanl, kcr
1 parent a550e5e commit 9143377

35 files changed

+888
-489
lines changed
 

‎modules/javafx.controls/src/test/addExports

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@
3434
--add-opens javafx.controls/javafx.scene.control=ALL-UNNAMED
3535
# compile additions
3636
--add-exports=javafx.graphics/com.sun.javafx.menu=ALL-UNNAMED
37+
--add-exports=javafx.graphics/com.sun.javafx.text=ALL-UNNAMED

‎modules/javafx.controls/src/test/java/test/javafx/scene/chart/LineChartTest.java

+39-26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -188,7 +188,7 @@ public void testPathInsideXAndInsideYBounds() {
188188
lineChart.getData().addAll(series1);
189189
pulse();
190190

191-
assertArrayEquals(convertSeriesDataToPoint2D(series1).toArray(), findDataPointsFromPathLine(lineChart).toArray());
191+
eq(series1, lineChart);
192192
}
193193

194194
@Test
@@ -210,7 +210,7 @@ public void testPathOutsideXBoundsWithDuplicateXAndHigherY() {
210210
new XYChart.Data<>(100d, 20d)
211211
);
212212

213-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
213+
eq(expectedSeries, lineChart);
214214
}
215215

216216
@Test
@@ -232,7 +232,7 @@ public void testPathOutsideXBoundsWithDuplicateXAndLowerY() {
232232
new XYChart.Data<>(100d, 20d)
233233
);
234234

235-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
235+
eq(expectedSeries, lineChart);
236236
}
237237

238238
@Test
@@ -255,7 +255,7 @@ public void testPathOutsideYBoundsWithDuplicateYAndHigherX() {
255255
new XYChart.Data<>(90d, 32d)
256256
);
257257

258-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
258+
eq(expectedSeries, lineChart);
259259
}
260260

261261
@Test
@@ -278,7 +278,7 @@ public void testPathOutsideYBoundsWithDuplicateYAndLowerX() {
278278
new XYChart.Data<>(90d, 40d)
279279
);
280280

281-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
281+
eq(expectedSeries, lineChart);
282282
}
283283

284284
@Test
@@ -300,7 +300,7 @@ public void testPathOutsideXAndYBoundsWithDuplicateXAndHigherY() {
300300
new XYChart.Data<>(95d, 35d)
301301
);
302302

303-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
303+
eq(expectedSeries, lineChart);
304304
}
305305

306306
@Test
@@ -322,7 +322,7 @@ public void testPathOutsideXAndYBoundsWithDuplicateXAndLowerY() {
322322
new XYChart.Data<>(95d, 40d)
323323
);
324324

325-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
325+
eq(expectedSeries, lineChart);
326326
}
327327

328328
@Test
@@ -344,7 +344,7 @@ public void testPathOutsideXAndYBoundsWithDuplicateYAndHigherX() {
344344
new XYChart.Data<>(95d, 32d)
345345
);
346346

347-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
347+
eq(expectedSeries, lineChart);
348348
}
349349

350350
@Test
@@ -366,7 +366,7 @@ public void testPathOutsideXAndYBoundsWithDuplicateYAndLowerX() {
366366
new XYChart.Data<>(95d, 40d)
367367
);
368368

369-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
369+
eq(expectedSeries, lineChart);
370370
}
371371

372372
@Test
@@ -390,7 +390,7 @@ public void testPathOutsideXLowerBoundsWithDuplicateXAndHigherYWithSortYAxis() {
390390
new XYChart.Data<>(80d, 10d)
391391
);
392392

393-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
393+
eq(expectedSeries, lineChart);
394394
}
395395

396396
@Test
@@ -414,7 +414,7 @@ public void testPathOutsideXUpperBoundsWithDuplicateXAndHigherYWithSortYAxis() {
414414
new XYChart.Data<>(80d, 10d)
415415
);
416416

417-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
417+
eq(expectedSeries, lineChart);
418418
}
419419

420420
@Test
@@ -438,7 +438,7 @@ public void testPathOutsideXLowerBoundsWithDuplicateXAndLowerYWithSortYAxis() {
438438
new XYChart.Data<>(80d, 10d)
439439
);
440440

441-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
441+
eq(expectedSeries, lineChart);
442442
}
443443

444444
@Test
@@ -462,7 +462,7 @@ public void testPathOutsideXUpperBoundsWithDuplicateXAndLowerYWithSortYAxis() {
462462
new XYChart.Data<>(80d, 10d)
463463
);
464464

465-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
465+
eq(expectedSeries, lineChart);
466466
}
467467

468468
@Test
@@ -485,7 +485,7 @@ public void testPathOutsideYLowerBoundsWithDuplicateYAndHigherXWithSortYAxis() {
485485
new XYChart.Data<>(80d, -10d)
486486
);
487487

488-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
488+
eq(expectedSeries, lineChart);
489489
}
490490

491491
@Test
@@ -508,7 +508,7 @@ public void testPathOutsideYUpperBoundsWithDuplicateYAndHigherXWithSortYAxis() {
508508
new XYChart.Data<>(80d, 10d)
509509
);
510510

511-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
511+
eq(expectedSeries, lineChart);
512512
}
513513

514514
@Test
@@ -530,7 +530,7 @@ public void testPathOutsideYLowerBoundsWithDuplicateYAndLowerXWithSortYAxis() {
530530
new XYChart.Data<>(80d, 10d),
531531
new XYChart.Data<>(80d, -10d)
532532
);
533-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
533+
eq(expectedSeries, lineChart);
534534
}
535535

536536
@Test
@@ -553,7 +553,7 @@ public void testPathOutsideYUpperBoundsWithDuplicateYAndLowerXWithSortYAxis() {
553553
new XYChart.Data<>(80d, 10d)
554554
);
555555

556-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
556+
eq(expectedSeries, lineChart);
557557
}
558558

559559
@Test
@@ -577,7 +577,7 @@ public void testPathOutsideXAndYLowerBoundsWithDuplicateXAndHigherYWithSortYAxis
577577
new XYChart.Data<>(95d, -10d)*/
578578
);
579579

580-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
580+
eq(expectedSeries, lineChart);
581581
}
582582

583583
@Test
@@ -600,7 +600,7 @@ public void testPathOutsideXAndYUpperBoundsWithDuplicateXAndHigherYWithSortYAxis
600600
new XYChart.Data<>(80d, 10d)
601601
);
602602

603-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
603+
eq(expectedSeries, lineChart);
604604
}
605605

606606
@Test
@@ -623,7 +623,7 @@ public void testPathOutsideXAndYLowerBoundsWithDuplicateXAndLowerYWithSortYAxis(
623623
new XYChart.Data<>(-10d, -10d)
624624
);
625625

626-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
626+
eq(expectedSeries, lineChart);
627627
}
628628

629629
@Test
@@ -646,7 +646,7 @@ public void testPathOutsideXAndYUpperBoundsWithDuplicateXAndLowerYWithSortYAxis(
646646
new XYChart.Data<>(80d, 10d)
647647
);
648648

649-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
649+
eq(expectedSeries, lineChart);
650650
}
651651

652652
@Test
@@ -669,7 +669,7 @@ public void testPathOutsideXAndYLowerBoundsWithDuplicateYAndHigherXWithSortYAxis
669669
new XYChart.Data<>(-15d, -10d)
670670
);
671671

672-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
672+
eq(expectedSeries, lineChart);
673673
}
674674

675675
@Test
@@ -692,7 +692,7 @@ public void testPathOutsideXAndYUpperBoundsWithDuplicateYAndHigherXWithSortYAxis
692692
new XYChart.Data<>(80d, 10d)
693693
);
694694

695-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
695+
eq(expectedSeries, lineChart);
696696
}
697697

698698
@Test
@@ -715,7 +715,7 @@ public void testPathOutsideXAndYLowerBoundsWithDuplicateYAndLowerXWithSortYAxis(
715715
new XYChart.Data<>(-10d, -10d)
716716
);
717717

718-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
718+
eq(expectedSeries, lineChart);
719719
}
720720

721721
@Test
@@ -738,7 +738,7 @@ public void testPathOutsideXAndYUpperBoundsWithDuplicateYAndLowerXWithSortYAxis(
738738
new XYChart.Data<>(80d, 10d)
739739
);
740740

741-
assertArrayEquals(convertSeriesDataToPoint2D(expectedSeries).toArray(), findDataPointsFromPathLine(lineChart).toArray());
741+
eq(expectedSeries, lineChart);
742742
}
743743

744744
//JDK-8283675
@@ -777,4 +777,17 @@ private List<Point2D> findDataPointsFromPathLine(LineChart<Number, Number> lineC
777777
.collect(Collectors.toList());
778778
return data.subList(0, data.size());
779779
}
780+
781+
private void eq(XYChart.Series<Number, Number> expected, LineChart<Number, Number> ch) {
782+
List<Point2D> exp = convertSeriesDataToPoint2D(expected);
783+
List<Point2D> res = findDataPointsFromPathLine(lineChart);
784+
785+
assertEquals(exp.size(), res.size());
786+
for (int i = 0; i < exp.size(); i++) {
787+
Point2D pe = exp.get(i);
788+
Point2D pr = res.get(i);
789+
assertEquals(pe.getX(), pr.getX(), 1e-9, "at index " + i + " expected=" + pe + " actual=" + pr);
790+
assertEquals(pe.getY(), pr.getY(), 1e-9, "at index " + i + " expected=" + pe + " actual=" + pr);
791+
}
792+
}
780793
}

‎modules/javafx.controls/src/test/java/test/javafx/scene/chart/StackedBarChartTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -113,7 +113,7 @@ public void testSeriesAdd() {
113113
// compute bounds for the first series
114114
String bounds = computeBoundsString((Region)childrenList.get(0), (Region)childrenList.get(1),
115115
(Region)childrenList.get(2));
116-
assertEquals("10 453 218 35 238 409 218 79 465 355 218 133 ", bounds);
116+
assertEquals("10 440 216 34 236 397 216 77 461 345 216 129 ", bounds);
117117

118118
// compute bounds for the second series
119119
// bounds = computeBoundsString((Region)childrenList.get(3), (Region)childrenList.get(4),

‎modules/javafx.controls/src/test/java/test/javafx/scene/control/AccordionTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -185,7 +185,7 @@ private void show() {
185185
0;
186186

187187
assertEquals(expectedPrefWidth, accordion.prefWidth(-1), 1e-100);
188-
assertEquals(60, accordion.prefHeight(-1), 1e-100);
188+
assertEquals(78, accordion.prefHeight(-1), 1e-100);
189189

190190
accordion.setExpandedPane(b);
191191
root.applyCss();
@@ -195,7 +195,7 @@ private void show() {
195195
assertEquals(expectedPrefWidth, accordion.prefWidth(-1), 1e-100);
196196

197197
final double expectedPrefHeight = PlatformImpl.isCaspian() ? 170 :
198-
PlatformImpl.isModena() ? 161 :
198+
PlatformImpl.isModena() ? 179 :
199199
0;
200200
assertEquals(expectedPrefHeight, accordion.prefHeight(-1), 1e-100);
201201
}

‎modules/javafx.controls/src/test/java/test/javafx/scene/control/ListViewKeyInputTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1817,9 +1817,9 @@ private boolean isAnchor(int index) {
18171817
keyboard.doKeyPress(KeyCode.PAGE_DOWN, KeyModifier.SHIFT);
18181818
final int leadSelectedIndex = sm.getSelectedIndex();
18191819
final int selectedIndicesCount = sm.getSelectedIndices().size();
1820-
assertEquals(6, leadSelectedIndex);
1821-
assertEquals(6, fm.getFocusedIndex());
1822-
assertEquals(7, selectedIndicesCount);
1820+
assertEquals(4, leadSelectedIndex);
1821+
assertEquals(4, fm.getFocusedIndex());
1822+
assertEquals(5, selectedIndicesCount);
18231823

18241824
keyboard.doKeyPress(KeyCode.PAGE_DOWN, KeyModifier.SHIFT);
18251825
assertEquals(leadSelectedIndex * 2, sm.getSelectedIndex());

0 commit comments

Comments
 (0)