From e28d52387383d5b9b3554f364e885a20f4292d81 Mon Sep 17 00:00:00 2001 From: Luke Deller Date: Fri, 16 Sep 2016 23:49:24 +1000 Subject: Fix JUnit test case for AccessibleFixedText This test case was failing on platforms where the default font does not fit inside the default size of a fixed text control (hard coded to be 12px high in UnoFixedTextControl's constructor) - Adjust the test case to explicitly set the text control's size to its preferred size. - Re-enable this checking on Mac OS X, where it had been disabled in 2013 due to this issue Change-Id: I469a733f0a2719c60564d61c89bb64ab3ab622ba Reviewed-on: https://gerrit.libreoffice.org/28961 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- .../tests/java/ifc/accessibility/_XAccessibleText.java | 5 ----- qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java | 14 +++++++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java index 92082d34bc79..a28592c543a3 100644 --- a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java +++ b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java @@ -402,11 +402,6 @@ public class _XAccessibleText extends MultiMethodTest { log.println("Component rect: " + bounds.X + ", " + bounds.Y + ", " + bounds.Width + ", " + bounds.Height); - //TODO: For some reason that still needs to be investigated, - // the above test keeps failing on Mac OS X: - if (!System.getProperty("os.name").equals("Mac OS X")) { - res &= localres; - } } } } catch (com.sun.star.lang.IndexOutOfBoundsException e) { diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java index fc2aca6a36df..0fc71d679153 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java @@ -26,6 +26,8 @@ import com.sun.star.awt.XControlContainer; import com.sun.star.awt.XControlModel; import com.sun.star.awt.XFixedText; import com.sun.star.awt.XWindow; +import com.sun.star.awt.XLayoutConstrains; +import com.sun.star.awt.Size; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; @@ -109,6 +111,16 @@ public class AccessibleFixedText extends TestCase { XFixedText.class, txtControl); xFT.setText("FxedText"); + /* Set the text control to its preferred size, otherwise it + * defaults to the size hard coded in its constructor (100 x 12) */ + XLayoutConstrains xLCTxt = UnoRuntime.queryInterface( + XLayoutConstrains.class, txtControl); + Size textSize = xLCTxt.getPreferredSize(); + XWindow xWinTxt = UnoRuntime.queryInterface( + XWindow.class, txtControl); + xWinTxt.setPosSize(0, 0, textSize.Width, textSize.Height, + PosSize.SIZE); + XControlContainer ctrlCont = UnoRuntime.queryInterface( XControlContainer.class, dlgControl); @@ -173,4 +185,4 @@ public class AccessibleFixedText extends TestCase { log.println(" Closing dialog ... "); xWinDlg.dispose(); } -} \ No newline at end of file +} -- cgit