qadevOOo/runner/util/utils.java | 7 qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java | 274 ++++------ qadevOOo/tests/java/ifc/i18n/_XCalendar.java | 59 -- qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java | 2 4 files changed, 167 insertions(+), 175 deletions(-)
New commits: commit 6f596fe57d2c557c09acc83d26c2ff30c556b53c Author: Noel Grandin <[email protected]> Date: Wed Oct 14 17:02:45 2015 +0200 cid#1326507 Resource leak Change-Id: If4bf5978fca921860d44421e17dd4f3d772d1c22 diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index 106f757..05b9852 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -571,8 +571,13 @@ public class utils { continue; } try { - new Socket("localhost", port); + Socket sock = new Socket("localhost", port); System.out.println(" -> socket: occupied port: " + port); + try { + sock.close(); + } catch (IOException ex) { + // ignore close exception + } } catch (IOException e) { System.out.println(" -> free port"); return port; commit 7007bc3134fa9446853d99f8b08637874875a2f6 Author: Noel Grandin <[email protected]> Date: Wed Oct 14 16:57:12 2015 +0200 cid#1326359 Nesting level does not match indentation Change-Id: Ic62811bbcb0d1365ee5623943273c834a614b895 diff --git a/qadevOOo/tests/java/ifc/i18n/_XCalendar.java b/qadevOOo/tests/java/ifc/i18n/_XCalendar.java index 6be1bbb..46a0b15 100644 --- a/qadevOOo/tests/java/ifc/i18n/_XCalendar.java +++ b/qadevOOo/tests/java/ifc/i18n/_XCalendar.java @@ -283,61 +283,52 @@ public class _XCalendar extends MultiMethodTest { * Has <b> OK </b> status if the method returns value, that's equal to * value set before. <p> */ - public void _setValue() { boolean res = true; - for (int i=0; i<installed_locales.length; i++) { + for (int i = 0; i < installed_locales.length; i++) { String error = ""; - String lang = "Language: "+installed_locales[i].Language + - ", Country: "+ installed_locales[i].Country + - ", Variant: "+ installed_locales[i].Variant + - ", Name: "+calendars[i][count[i]]; - String[] names = new String[]{"DAY_OF_MONTH", - "HOUR","MINUTE","SECOND","MILLISECOND", - "YEAR","MONTH"}; - oObj.loadCalendar(calendars[i][count[i]],installed_locales[i]); - short[] fields = new short[]{CalendarFieldIndex.DAY_OF_MONTH, - CalendarFieldIndex.HOUR, - CalendarFieldIndex.MINUTE, - CalendarFieldIndex.SECOND, - CalendarFieldIndex.MILLISECOND, - CalendarFieldIndex.YEAR, - CalendarFieldIndex.MONTH - }; - for (int k=0; k<fields.length;k++) { + String lang = "Language: " + installed_locales[i].Language + ", Country: " + installed_locales[i].Country + + ", Variant: " + installed_locales[i].Variant + ", Name: " + calendars[i][count[i]]; + String[] names = new String[] { "DAY_OF_MONTH", "HOUR", "MINUTE", "SECOND", "MILLISECOND", "YEAR", + "MONTH" }; + oObj.loadCalendar(calendars[i][count[i]], installed_locales[i]); + short[] fields = new short[] { CalendarFieldIndex.DAY_OF_MONTH, CalendarFieldIndex.HOUR, + CalendarFieldIndex.MINUTE, CalendarFieldIndex.SECOND, CalendarFieldIndex.MILLISECOND, + CalendarFieldIndex.YEAR, CalendarFieldIndex.MONTH }; + for (int k = 0; k < fields.length; k++) { oObj.setDateTime(0.0); // save the current values for debug purposes short[] oldValues = new short[fields.length]; - for (int n=0; n < oldValues.length; n++){ + for (int n = 0; n < oldValues.length; n++) { oldValues[n] = oObj.getValue(fields[n]); } short set = oObj.getValue(fields[k]); - if (fields[k] == CalendarFieldIndex.MONTH) set = newValue; - oObj.setValue(fields[k],set); + if (fields[k] == CalendarFieldIndex.MONTH) + set = newValue; + oObj.setValue(fields[k], set); short get = oObj.getValue(fields[k]); if (get != set) { if (debug) log.println("ERROR occurred: tried to set " + names[k] + " to value " + set); - log.println("list of values BEFORE set " + names[k] + " to value " + set + ":"); - for (int n=0; n < oldValues.length; n++){ - log.println(names[n] + ":" + oldValues[n]); - } - log.println("list of values AFTER set " + names[k] + " to value " + set + ":"); - for (int n=0; n < fields.length;n++){ - log.println(names[n] + ":" + oObj.getValue(fields[n])); - } - - error += "failed for "+names[k]+" expected "+ - set+" gained "+get+" ; \n"; + log.println("list of values BEFORE set " + names[k] + " to value " + set + ":"); + for (int n = 0; n < oldValues.length; n++) { + log.println(names[n] + ":" + oldValues[n]); + } + log.println("list of values AFTER set " + names[k] + " to value " + set + ":"); + for (int n = 0; n < fields.length; n++) { + log.println(names[n] + ":" + oObj.getValue(fields[n])); + } + + error += "failed for " + names[k] + " expected " + set + " gained " + get + " ; \n"; } } if (error.equals("")) { log.println(lang + " ... OK"); } else { - log.println("*** "+lang + " ... FAILED ***"); + log.println("*** " + lang + " ... FAILED ***"); log.println(error); } res &= (error.equals("")); commit a5ef59d4e0d5fcb3516834132940dd9f62ed855a Author: Noel Grandin <[email protected]> Date: Wed Oct 14 16:15:35 2015 +0200 cid#1326132 Logically dead code Change-Id: I4bab8a3fd8532865086d664062ce45ebdf4373f0 diff --git a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java index 58fe289..48bd9b2 100644 --- a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java +++ b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java @@ -209,170 +209,166 @@ public class _XAccessibleComponent extends MultiMethodTest { boolean result = true; XAccessibleComponent[] children = getChildrenComponents(); - if (children.length > 0) { - for (int i = 0; i < children.length; i++) { - Rectangle chBnd = children[i].getBounds(); - - if (chBnd.X == -1) { - continue; - } - - log.println("Checking child with bounds " + "(" + chBnd.X + - "," + chBnd.Y + "),(" + chBnd.Width + "," + - chBnd.Height + "): " + - util.AccessibilityTools.accessibleToString( - children[i])); + if (children.length == 0) { + log.println("There are no children supporting XAccessibleComponent"); + tRes.tested("getAccessibleAtPoint()", result); + return; + } - XAccessibleContext xAc = UnoRuntime.queryInterface( - XAccessibleContext.class, - children[i]); + for (int i = 0; i < children.length; i++) { + Rectangle chBnd = children[i].getBounds(); - boolean MightBeCovered = false; - boolean isShowing = xAc.getAccessibleStateSet() - .contains(com.sun.star.accessibility.AccessibleStateType.SHOWING); - log.println("\tStateType containsPoint SHOWING: " + - isShowing); + if (chBnd.X == -1) { + continue; + } - if (!isShowing) { - log.println("Child is invisible - OK"); + log.println("Checking child with bounds " + "(" + chBnd.X + + "," + chBnd.Y + "),(" + chBnd.Width + "," + + chBnd.Height + "): " + + util.AccessibilityTools.accessibleToString( + children[i])); + + XAccessibleContext xAc = UnoRuntime.queryInterface( + XAccessibleContext.class, + children[i]); + + boolean MightBeCovered = false; + boolean isShowing = xAc.getAccessibleStateSet() + .contains(com.sun.star.accessibility.AccessibleStateType.SHOWING); + log.println("\tStateType containsPoint SHOWING: " + + isShowing); + + if (!isShowing) { + log.println("Child is invisible - OK"); + continue; + } - continue; - } + log.println("finding the point which lies on the component"); - log.println("finding the point which lies on the component"); + int curX = chBnd.Width / 2; + int curY = chBnd.Height / 2; - int curX = chBnd.Width / 2; - int curY = chBnd.Height / 2; + while (!children[i].containsPoint(new Point(curX, curY)) && + (curX > 0) && (curY > 0)) { + curX--; + curY--; + } - while (!children[i].containsPoint(new Point(curX, curY)) && - (curX > 0) && (curY > 0)) { - curX--; - curY--; - } + if (curX == chBnd.Width) { + log.println("Couldn't find a point with containsPoint"); - if ((curX == chBnd.Width) && isShowing) { - log.println("Couldn't find a point with containsPoint"); + continue; + } - continue; - } + // trying the point laying on child + XAccessible xAcc = oObj.getAccessibleAtPoint( + new Point(chBnd.X + curX, + chBnd.Y + curY)); - // trying the point laying on child - XAccessible xAcc = oObj.getAccessibleAtPoint( - new Point(chBnd.X + curX, - chBnd.Y + curY)); + Point p = new Point(chBnd.X + curX,chBnd.X + curX); - Point p = new Point(chBnd.X + curX,chBnd.X + curX); + if (isCovered(p)) { + log.println( + "Child might be covered by another and can't be reached"); + MightBeCovered = true; + } - if (isCovered(p) && isShowing) { - log.println( - "Child might be covered by another and can't be reached"); - MightBeCovered = true; + KnownBounds.add(chBnd); + + if (xAcc == null) { + log.println("The child not found at point (" + + (chBnd.X + curX) + "," + (chBnd.Y + curY) + + ") - FAILED"); + + result = false; + } else { + XAccessible xAccCh = UnoRuntime.queryInterface( + XAccessible.class, + children[i]); + XAccessibleContext xAccC = UnoRuntime.queryInterface( + XAccessibleContext.class, + children[i]); + log.println("Child found at point (" + (chBnd.X + curX) + + "," + (chBnd.Y + curY) + ") - OK"); + + boolean res = false; + int expIndex; + String expName; + String expDesc; + + if (xAccCh != null) { + res = util.AccessibilityTools.equals(xAccCh, xAcc); + expIndex = xAccCh.getAccessibleContext() + .getAccessibleIndexInParent(); + expName = xAccCh.getAccessibleContext() + .getAccessibleName(); + expDesc = xAccCh.getAccessibleContext() + .getAccessibleDescription(); + } else { + res = xAccC.getAccessibleName() + .equals(xAcc.getAccessibleContext() + .getAccessibleName()); + expIndex = xAccC.getAccessibleIndexInParent(); + expName = xAccC.getAccessibleName(); + expDesc = xAccC.getAccessibleDescription(); } - KnownBounds.add(chBnd); + if (!res) { + int gotIndex = xAcc.getAccessibleContext() + .getAccessibleIndexInParent(); - if (xAcc == null) { - log.println("The child not found at point (" + - (chBnd.X + curX) + "," + (chBnd.Y + curY) + - ") - FAILED"); - - if (isShowing) { - result = false; - } else { - result &= true; - } - } else { - XAccessible xAccCh = UnoRuntime.queryInterface( - XAccessible.class, - children[i]); - XAccessibleContext xAccC = UnoRuntime.queryInterface( - XAccessibleContext.class, - children[i]); - log.println("Child found at point (" + (chBnd.X + curX) + - "," + (chBnd.Y + curY) + ") - OK"); - - boolean res = false; - int expIndex; - String expName; - String expDesc; - - if (xAccCh != null) { - res = util.AccessibilityTools.equals(xAccCh, xAcc); - expIndex = xAccCh.getAccessibleContext() - .getAccessibleIndexInParent(); - expName = xAccCh.getAccessibleContext() - .getAccessibleName(); - expDesc = xAccCh.getAccessibleContext() - .getAccessibleDescription(); + if (expIndex < gotIndex) { + log.println("The children found is not the same"); + log.println("The expected child " + expName); + log.print("is hidden behind the found Child "); + log.println(xAcc.getAccessibleContext() + .getAccessibleName() + " - OK"); } else { - res = xAccC.getAccessibleName() - .equals(xAcc.getAccessibleContext() - .getAccessibleName()); - expIndex = xAccC.getAccessibleIndexInParent(); - expName = xAccC.getAccessibleName(); - expDesc = xAccC.getAccessibleDescription(); - } - - if (!res) { - int gotIndex = xAcc.getAccessibleContext() - .getAccessibleIndexInParent(); - - if (expIndex < gotIndex) { - log.println("The children found is not the same"); - log.println("The expected child " + expName); - log.print("is hidden behind the found Child "); - log.println(xAcc.getAccessibleContext() - .getAccessibleName() + " - OK"); + log.println( + "The children found is not the same"); + log.println("Expected: " + expName); + log.println("Description: " + expDesc); + log.println("Found: " + + xAcc.getAccessibleContext() + .getAccessibleName()); + log.println("Description: " + + xAcc.getAccessibleContext() + .getAccessibleDescription()); + if (MightBeCovered) { + log.println("... Child is covered by another - OK"); } else { - log.println( - "The children found is not the same"); - log.println("Expected: " + expName); - log.println("Description: " + expDesc); - log.println("Found: " + - xAcc.getAccessibleContext() - .getAccessibleName()); - log.println("Description: " + - xAcc.getAccessibleContext() - .getAccessibleDescription()); - if (MightBeCovered) { - log.println("... Child is covered by another - OK"); - } else { - log.println("... FAILED"); - result = false; - } - + log.println("... FAILED"); + result = false; } + } } + } - // trying the point NOT laying on child - xAcc = oObj.getAccessibleAtPoint( - new Point(chBnd.X - 1, chBnd.Y - 1)); - - if (xAcc == null) { - log.println("No children found at point (" + - (chBnd.X - 1) + "," + (chBnd.Y - 1) + - ") - OK"); - result &= true; - } else { - XAccessible xAccCh = UnoRuntime.queryInterface( - XAccessible.class, - children[i]); - boolean res = util.AccessibilityTools.equals(xAccCh, xAcc); - - if (res) { - log.println("The same child found outside " + - "its bounds at (" + (chBnd.X - 1) + "," + - (chBnd.Y - 1) + ") - FAILED"); - result = false; - } + // trying the point NOT laying on child + xAcc = oObj.getAccessibleAtPoint( + new Point(chBnd.X - 1, chBnd.Y - 1)); + + if (xAcc == null) { + log.println("No children found at point (" + + (chBnd.X - 1) + "," + (chBnd.Y - 1) + + ") - OK"); + result &= true; + } else { + XAccessible xAccCh = UnoRuntime.queryInterface( + XAccessible.class, + children[i]); + boolean res = util.AccessibilityTools.equals(xAccCh, xAcc); + + if (res) { + log.println("The same child found outside " + + "its bounds at (" + (chBnd.X - 1) + "," + + (chBnd.Y - 1) + ") - FAILED"); + result = false; } } - } else { - log.println("There are no children supporting " + - "XAccessibleComponent"); } tRes.tested("getAccessibleAtPoint()", result); commit 11f40bfae492a7f2fff211699e7033ffdeb264e6 Author: Noel Grandin <[email protected]> Date: Wed Oct 14 16:09:56 2015 +0200 cid#1326900 IM: Questionable integer math Change-Id: I6f8de37216f0f9d015e17b0bf1f1b1c1492275cf diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java index 3a419cc..ea82731 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java @@ -251,7 +251,7 @@ public class ScDataPilotTableObj extends TestCase { fieldPropSet.setPropertyValue( "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.COLUMN); } - else if (i%2 == 1) + else { // odd number fields fieldPropSet.setPropertyValue( _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
