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

Stephan Bergmann sbergman at redhat.com
Mon Aug 5 02:19:48 PDT 2013


 qadevOOo/runner/util/ValueChanger.java       |   12 ++++++++++++
 qadevOOo/tests/java/ifc/awt/_XDateField.java |   20 ++++++++++----------
 qadevOOo/tests/java/ifc/awt/_XTimeField.java |   20 ++++++++++----------
 3 files changed, 32 insertions(+), 20 deletions(-)

New commits:
commit 7dff8a91f9f8b2366d2e6bb18e50d7a25f3b9f72
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Aug 5 11:13:40 2013 +0200

    Add cases for css.uno.Date/Time to ValueChanger
    
    ...needed since 8ee69b0ba13f74d1515fac71df92947eb6328ab1 "fdo#67235 adapt
    form control code to time nanosecond API change, step 3."
    
    Change-Id: Id561151ac4b57b972761ec19f0e8943b8d25a54f

diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
index 6e18ee8..8df2fee 100644
--- a/qadevOOo/runner/util/ValueChanger.java
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -806,6 +806,12 @@ public class ValueChanger {
         newVal.Value = changePValue(((PropertyValue)oldValue).Value);
         newValue = newVal;
     } else
+    if (oldValue instanceof com.sun.star.util.Date) {
+        com.sun.star.util.Date oldD = (com.sun.star.util.Date) oldValue;
+        com.sun.star.util.Date newD = new com.sun.star.util.Date();
+        newD.Day = (short) (oldD.Day+(short) 1);
+        newValue = newD;
+    } else
     if (oldValue instanceof com.sun.star.util.DateTime) {
         com.sun.star.util.DateTime oldDT = (com.sun.star.util.DateTime) oldValue;
         com.sun.star.util.DateTime newDT = new com.sun.star.util.DateTime();
@@ -813,6 +819,12 @@ public class ValueChanger {
         newDT.Hours = (short) (oldDT.Hours+(short) 1);
         newValue = newDT;
     } else
+    if (oldValue instanceof com.sun.star.util.Time) {
+        com.sun.star.util.Time oldT = (com.sun.star.util.Time) oldValue;
+        com.sun.star.util.Time newT = new com.sun.star.util.Time();
+        newT.Hours = (short) (oldT.Hours+(short) 1);
+        newValue = newT;
+    } 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();
commit 5b0ac8149d574058b6218fc4badd587d4fb6d87b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Aug 5 10:49:15 2013 +0200

    Fix uses of Java == on css.uno.Date/Time
    
    ...introduced with 8ee69b0ba13f74d1515fac71df92947eb6328ab1 "fdo#67235 adapt
    form control code to time nanosecond API change, step 3."
    
    Change-Id: Ifdd449715ce0be602b7bc2d304d503385195eb66

diff --git a/qadevOOo/tests/java/ifc/awt/_XDateField.java b/qadevOOo/tests/java/ifc/awt/_XDateField.java
index c57106b..f54fa70 100644
--- a/qadevOOo/tests/java/ifc/awt/_XDateField.java
+++ b/qadevOOo/tests/java/ifc/awt/_XDateField.java
@@ -68,8 +68,8 @@ public class _XDateField extends MultiMethodTest {
 
         boolean result = true ;
         oObj.setDate(new Date((short)1, (short)1, (short)1900)) ;
-
-        result = oObj.getDate() == new Date((short)1, (short)1, (short)1900); ;
+        Date date = oObj.getDate();
+        result = date.Day == 1 && date.Month == 1 && date.Year == 1900;
 
         if (! result ) {
             System.out.println("getDate: " + oObj.getDate() + " , expected 1900-01-01");
@@ -102,8 +102,8 @@ public class _XDateField extends MultiMethodTest {
 
         boolean result = true ;
         oObj.setMin(new Date((short)5, (short)2, (short)1963));
-
-        result = oObj.getMin() == new Date((short)5, (short)2, (short)1963);
+        Date date = oObj.getMin();
+        result = date.Day == 5 && date.Month == 2 && date.Year == 1963;
 
         tRes.tested("setMin()", result) ;
     }
@@ -132,8 +132,8 @@ public class _XDateField extends MultiMethodTest {
 
         boolean result = true ;
         oObj.setMax(new Date((short)18, (short)9, (short)2117)) ;
-
-        result = oObj.getMax() == new Date((short)18, (short)9, (short)2117) ;
+        Date date = oObj.getMax();
+        result = date.Day == 18 && date.Month == 9 && date.Year == 2117;
 
         tRes.tested("setMax()", result) ;
     }
@@ -162,8 +162,8 @@ public class _XDateField extends MultiMethodTest {
 
         boolean result = true ;
         oObj.setFirst(new Date((short)7, (short)12, (short)1972)) ;
-
-        result = oObj.getFirst() == new Date((short)7, (short)12, (short)1972) ;
+        Date date = oObj.getFirst();
+        result = date.Day == 7 && date.Month == 12 && date.Year == 1972;
 
         if (!result) {
             log.println("Set to " + 5118 + " but returned " + oObj.getFirst()) ;
@@ -198,8 +198,8 @@ public class _XDateField extends MultiMethodTest {
 
         boolean result = true ;
         oObj.setLast(new Date((short)23, (short)8, (short)2053)) ;
-
-        result = oObj.getLast() == new Date((short)23, (short)8, (short)2053) ;
+        Date date = oObj.getLast();
+        result = date.Day == 23 && date.Month == 8 && date.Year == 2053;
 
         if (!result) {
             log.println("Set to 2053-08-23 but returned " + oObj.getLast()) ;
diff --git a/qadevOOo/tests/java/ifc/awt/_XTimeField.java b/qadevOOo/tests/java/ifc/awt/_XTimeField.java
index 955b56d..5a7641a 100644
--- a/qadevOOo/tests/java/ifc/awt/_XTimeField.java
+++ b/qadevOOo/tests/java/ifc/awt/_XTimeField.java
@@ -64,8 +64,8 @@ public class _XTimeField extends MultiMethodTest {
 
         boolean result = true ;
         oObj.setTime(new Time(0, (short)0, (short)15, (short)11, false));
-
-        result = oObj.getTime() == new Time(0, (short)0, (short)15, (short)11, false) ;
+        Time time = oObj.getTime();
+        result = time.NanoSeconds == 0 && time.Seconds == 0 && time.Minutes == 15 && time.Hours == 11 && !time.IsUTC;
 
         if (! result ) {
             System.out.println("Getting " + oObj.getTime() + " expected 11:15");
@@ -98,8 +98,8 @@ public class _XTimeField extends MultiMethodTest {
 
         boolean result = true ;
         oObj.setMin(new Time(0, (short)14, (short)18, (short)6, false));
-
-        result = oObj.getMin() == new Time(0, (short)14, (short)18, (short)6, false) ;
+        Time time = oObj.getMin();
+        result = time.NanoSeconds == 0 && time.Seconds == 14 && time.Minutes == 18 && time.Hours == 6 && !time.IsUTC;
 
         tRes.tested("setMin()", result) ;
     }
@@ -128,8 +128,8 @@ public class _XTimeField extends MultiMethodTest {
 
         boolean result = true ;
         oObj.setMax(new Time(855447, (short)31, (short)23, (short)22, false)) ;
-
-        result = oObj.getMax() == new Time(855447, (short)31, (short)23, (short)22, false) ;
+        Time time = oObj.getMax();
+        result = time.NanoSeconds == 855447 && time.Seconds == 31 && time.Minutes == 23 && time.Hours == 22 && !time.IsUTC;
 
         tRes.tested("setMax()", result) ;
     }
@@ -158,8 +158,8 @@ public class _XTimeField extends MultiMethodTest {
 
         boolean result = true ;
         oObj.setFirst(new Time(0, (short)0, (short)30, (short)7, false)) ;
-
-        result = oObj.getFirst() == new Time(0, (short)0, (short)30, (short)7, false);
+        Time time = oObj.getFirst();
+        result = time.NanoSeconds == 0 && time.Seconds == 0 && time.Minutes == 30 && time.Hours == 7 && !time.IsUTC;
 
         if (!result) {
             log.println("Set to 07:30 but returned " + oObj.getFirst()) ;
@@ -194,8 +194,8 @@ public class _XTimeField extends MultiMethodTest {
 
         boolean result = true ;
         oObj.setLast(new Time(500000, (short)31, (short)30, (short)18, false)) ;
-
-        result = oObj.getLast() == new Time(500000, (short)31, (short)30, (short)18, false);
+        Time time = oObj.getLast();
+        result = time.NanoSeconds == 500000 && time.Seconds == 31 && time.Minutes == 30 && time.Hours == 18 && !time.IsUTC;
 
         if (!result) {
             log.println("Set to 18:30:31.5 but returned " + oObj.getLast()) ;


More information about the Libreoffice-commits mailing list