[Libreoffice-commits] core.git: 4 commits - qadevOOo/runner

Stephan Bergmann sbergman at redhat.com
Thu Oct 22 03:53:52 PDT 2015


 qadevOOo/runner/lib/MultiPropertyTest.java |   62 ++++++++++++++++++-----------
 qadevOOo/runner/util/ValueChanger.java     |   10 +++-
 2 files changed, 47 insertions(+), 25 deletions(-)

New commits:
commit e971c88efcacc8b34c76c2de431d6cf9b4b6506f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Oct 22 12:47:12 2015 +0200

    Fix the test for resValue != oldValue
    
    When the property type is e.g. a UNO sequence or struct type, !equals would
    trivially be always true (as the UNO bridge creates fresh instances of such
    value types on the fly), masking failures where the tested code didn't change
    the property value at all.
    
    And one such masked failure was
    sw.CharacterStyle::com::sun::star::style::CharacterProperties in
    JunitTest_sw_unoapi_1 not changing any of the CharLeft/Right/Bottom/TopBorder
    properties, as SvxBorderLine::GuessLinesWidths
    (editeng/source/items/borderline.cxx) appears to only work properly if nStyle is
    DOUBLE, so work around that for now by explicitly setting that BorderLineStyle
    in the ValueChanger for BorderLine2.
    
    Change-Id: If9536822c5db04cbd01e6d760b5b63da04c4cf5b

diff --git a/qadevOOo/runner/lib/MultiPropertyTest.java b/qadevOOo/runner/lib/MultiPropertyTest.java
index ac17634..38bf2cc 100644
--- a/qadevOOo/runner/lib/MultiPropertyTest.java
+++ b/qadevOOo/runner/lib/MultiPropertyTest.java
@@ -408,7 +408,7 @@ public class MultiPropertyTest extends MultiMethodTest
                         }
                         if (resValue != null)
                         {
-                            if ((!compare(resValue, oldValue)) || (!resValue.equals(oldValue)))
+                            if (!compare(resValue, oldValue))
                             {
                                 log.println("But it has changed.");
                                 tRes.tested(propName, true);
diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
index 7a803b0..008b982 100644
--- a/qadevOOo/runner/util/ValueChanger.java
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -612,6 +612,10 @@ public class ValueChanger {
             _newValue.InnerLineWidth += 2;
             _newValue.LineDistance += 2;
             _newValue.OuterLineWidth += 3;
+            if (_newValue instanceof com.sun.star.table.BorderLine2) {
+                ((com.sun.star.table.BorderLine2) _newValue).LineStyle
+                    = com.sun.star.table.BorderLineStyle.DOUBLE;
+            }
             newValue = _newValue;
         } else if (oldValue instanceof com.sun.star.text.XTextColumns) {
             com.sun.star.text.XTextColumns _newValue = (com.sun.star.text.XTextColumns) oldValue;
commit 0fee8f241bd4c5e032e92e10619bc405cb5a5daf
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Oct 22 12:40:43 2015 +0200

    Change TableColumnSeparator in a way that makes it successfully pass...
    
    ...lcl_SetTableSeparators (sw/source/core/unocore/unotbl.cxx) when trying to
    change the TableColumnSeparators property of
    sw.SwXTextTable::com::sun::star::text::TextTable in JunitTest_sw_unoapi_4
    
    Change-Id: I314e3f08eae0b1df6d5c60340e33f34477daf76e

diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
index f901a59..7a803b0 100644
--- a/qadevOOo/runner/util/ValueChanger.java
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -892,8 +892,8 @@ public class ValueChanger {
         } else if (oldValue instanceof com.sun.star.text.TableColumnSeparator) {
             com.sun.star.text.TableColumnSeparator oldTCS = (com.sun.star.text.TableColumnSeparator) oldValue;
             com.sun.star.text.TableColumnSeparator newTCS = new com.sun.star.text.TableColumnSeparator();
-            newTCS.IsVisible = !(oldTCS.IsVisible);
-            newTCS.Position = (short) (oldTCS.Position + (short) 1);
+            newTCS.IsVisible = oldTCS.IsVisible;
+            newTCS.Position = (short) (oldTCS.Position - 1);
             newValue = newTCS;
         } else if (oldValue instanceof com.sun.star.drawing.HomogenMatrix3) {
             com.sun.star.drawing.HomogenMatrix3 oldHM = (com.sun.star.drawing.HomogenMatrix3) oldValue;
commit c546fbca07b0085f569d72f21ed0b43e4c49e50c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Oct 22 12:39:54 2015 +0200

    Print content of arrays and UNO structs
    
    Change-Id: Ib585408c26e14b83e896861c2793ff3229dba7d1

diff --git a/qadevOOo/runner/lib/MultiPropertyTest.java b/qadevOOo/runner/lib/MultiPropertyTest.java
index 57a82ff..ac17634 100644
--- a/qadevOOo/runner/lib/MultiPropertyTest.java
+++ b/qadevOOo/runner/lib/MultiPropertyTest.java
@@ -28,7 +28,10 @@ import com.sun.star.lang.IllegalArgumentException;
 import com.sun.star.lang.WrappedTargetException;
 import com.sun.star.uno.UnoRuntime;
 
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 
 import util.ValueChanger;
 import util.ValueComparer;
@@ -570,6 +573,39 @@ public class MultiPropertyTest extends MultiMethodTest
      */
     protected String toString(Object obj)
     {
-        return obj == null ? "null" : obj.toString();
+        if (obj == null) {
+            return "null";
+        }
+        StringBuilder s = new StringBuilder(obj.toString());
+        if (obj.getClass().isArray()) {
+            int n = Array.getLength(obj);
+            s.append('[').append(n).append("]{");
+            for (int i = 0; i != n; ++i) {
+                if (i != 0) {
+                    s.append(", ");
+                }
+                s.append(toString(Array.get(obj, i)));
+            }
+            s.append('}');
+        } else if (ValueChanger.isStructure(obj)) {
+            s.append('{');
+            Field[] fields = obj.getClass().getFields();
+            boolean first = true;
+            for (int i = 0; i != fields.length; ++i) {
+                if ((fields[i].getModifiers() & Modifier.STATIC) == 0) {
+                    if (!first) {
+                        s.append(", ");
+                    }
+                    first = false;
+                    try {
+                        s.append(toString(fields[i].get(obj)));
+                    } catch (IllegalAccessException e) {
+                        throw new RuntimeException("unexpected " + e, e);
+                    }
+                }
+            }
+            s.append('}');
+        }
+        return s.toString();
     }
 }
diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
index 14e10f9..f901a59 100644
--- a/qadevOOo/runner/util/ValueChanger.java
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -1036,7 +1036,7 @@ public class ValueChanger {
      *            the value to be checked.
      * @return <code>true</code> if the value is assumed to be a structure.
      */
-    private static boolean isStructure(Object val) {
+    public static boolean isStructure(Object val) {
         boolean result = true;
 
         Class<?> clazz = val.getClass();
commit eda5f1fca8a8a1ed5c98bb6d7486283cccb08b37
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Oct 22 12:37:48 2015 +0200

    A "workaround to CodeWarrior's compiler bug" is probably not needed anymore
    
    Change-Id: I84cb3bb1e3fa42a7b96286f317aa0fb4e8ada8f3

diff --git a/qadevOOo/runner/lib/MultiPropertyTest.java b/qadevOOo/runner/lib/MultiPropertyTest.java
index cbf8f5d..57a82ff 100644
--- a/qadevOOo/runner/lib/MultiPropertyTest.java
+++ b/qadevOOo/runner/lib/MultiPropertyTest.java
@@ -466,7 +466,7 @@ public class MultiPropertyTest extends MultiMethodTest
          */
         protected boolean compare(Object obj1, Object obj2)
         {
-            return callCompare(obj1, obj2);
+            return MultiPropertyTest.this.compare(obj1, obj2);
         }
 
         /**
@@ -476,7 +476,7 @@ public class MultiPropertyTest extends MultiMethodTest
          */
         protected String toString(Object obj)
         {
-            return callToString(obj);
+            return MultiPropertyTest.this.toString(obj);
         }
     }
 
@@ -557,15 +557,6 @@ public class MultiPropertyTest extends MultiMethodTest
     }
 
     /**
-     * The method just calls compare. This is a workaround to CodeWarrior's
-     * compiler bug.
-     */
-    private boolean callCompare(Object obj1, Object obj2)
-    {
-        return compare(obj1, obj2);
-    }
-
-    /**
      * Compares two object. In the implementation calls obj1.equals(obj2).
      */
     protected boolean compare(Object obj1, Object obj2)
@@ -574,15 +565,6 @@ public class MultiPropertyTest extends MultiMethodTest
     }
 
     /**
-     * The method just calls toString. This is a workaround to
-     * CodeWarrior's compiler bug.
-     */
-    private String callToString(Object obj)
-    {
-        return toString(obj);
-    }
-
-    /**
      * Gets string representation of the obj. In the implementation
      * returns obj.toString().
      */


More information about the Libreoffice-commits mailing list