RFC: JMC-6329: UITest fails due to font changes in MBean Browser

Alex Macdonald almacdon at redhat.com
Thu Jan 10 20:04:31 UTC 2019


This one-liner patch [0] addresses issue JMC-6329 [1], in which a UI test
failure occurs when resizing fonts in the MBeanBrowserTabTest [2].

The test in question is "testValueFontSize()" [3], which essentially
verifies that a larger font (size 16) can be resized to a smaller one
(e.g., default font) for font height consistency. However, the font size
constant used in the test is hardcoded at 11 [4] which is a likely value
for many machines, but not all.

For example, when running the UI tests on my Linux desktop the test passes,
because my default font is size 11, but if I run the tests in a virtual
display (using something like vncserver), then my default font size is
actually 10 and I encounter a test failure that looks like:

expected:<1|Monospace|11.0|2|GTK|1|> but was:<1|Monospace|10.0|2|GTK|1>

To address this, I've changed the DEFAULT_FONT_HEIGHT [4] to instead use
the actual value of the default font height, retrieved by using
JFaceResources.getDefaultFont().getFontData()[0].getHeight(). This change
allows the tests to pass on my Linux machines, but I'm interested to see if
this will fix the issue on other platforms; the example in the bug report
shows that the FontData array differed in two places when run in Windows
(one difference in the font height, and another in the font style).




[0] http://cr.openjdk.java.net/~aptmac/JMC-6329/webrev.00/
[1] https://bugs.openjdk.java.net/browse/JMC-6329

More information about the jmc-dev mailing list