qadevOOo/runner/util/ValueChanger.java | 12 ++ qadevOOo/tests/java/ifc/awt/_XDateField.java | 20 +-- qadevOOo/tests/java/ifc/awt/_XTimeField.java | 20 +-- qadevOOo/tests/java/ifc/form/validation/_XValidatableFormComponent.java | 6 - qadevOOo/tests/java/mod/_forms/ODateModel.java | 2 toolkit/source/controls/unocontrolmodel.cxx | 28 +++++ xmlscript/source/xmldlg_imexp/exp_share.hxx | 4 xmlscript/source/xmldlg_imexp/imp_share.hxx | 6 + xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 12 +- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 56 ++++++++++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 12 +- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 38 ++++++ 12 files changed, 182 insertions(+), 34 deletions(-)
New commits: commit 5c8e68edee16aacdf1b4d2ffef867deb17ff5985 Author: Lionel Elie Mamane <[email protected]> Date: Mon Aug 5 19:18:20 2013 +0200 Adapt Dialog XML import/export code to: commit 8ee69b0ba13f74d1515fac71df92947eb6328ab1 fdo#67235 adapt form control code to time nanosecond API change, step 3. Change-Id: I57b549c9c1379154173bb50463171a60ce35ca0c diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx index 3b836de6..eb94eff 100644 --- a/xmlscript/source/xmldlg_imexp/exp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx @@ -137,8 +137,12 @@ public: OUString const & rPropName, OUString const & rAttrName ); void readImagePositionAttr( OUString const & rPropName, OUString const & rAttrName ); + void readDateAttr( + OUString const & rPropName, OUString const & rAttrName ); void readDateFormatAttr( OUString const & rPropName, OUString const & rAttrName ); + void readTimeAttr( + OUString const & rPropName, OUString const & rAttrName ); void readTimeFormatAttr( OUString const & rPropName, OUString const & rAttrName ); void readOrientationAttr( diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx index d82dffa..b92d5a7 100644 --- a/xmlscript/source/xmldlg_imexp/imp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx @@ -444,9 +444,15 @@ public: bool importImagePositionProperty( OUString const & rPropName, OUString const & rAttrName, css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); + bool importDateProperty( + OUString const & rPropName, OUString const & rAttrName, + css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); bool importDateFormatProperty( OUString const & rPropName, OUString const & rAttrName, css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); + bool importTimeProperty( + OUString const & rPropName, OUString const & rAttrName, + css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); bool importTimeFormatProperty( OUString const & rPropName, OUString const & rAttrName, css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index 9f8d881..2ff2208 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx @@ -738,9 +738,9 @@ void ElementDescriptor::readDateFieldModel( StyleBag * all_styles ) readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" ); readDateFormatAttr( "DateFormat", XMLNS_DIALOGS_PREFIX ":date-format" ); readBoolAttr( "DateShowCentury", XMLNS_DIALOGS_PREFIX ":show-century" ); - readLongAttr( "Date", XMLNS_DIALOGS_PREFIX ":value" ); - readLongAttr( "DateMin", XMLNS_DIALOGS_PREFIX ":value-min" ); - readLongAttr( "DateMax", XMLNS_DIALOGS_PREFIX ":value-max" ); + readDateAttr( "Date", XMLNS_DIALOGS_PREFIX ":value" ); + readDateAttr( "DateMin", XMLNS_DIALOGS_PREFIX ":value-min" ); + readDateAttr( "DateMax", XMLNS_DIALOGS_PREFIX ":value-max" ); readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" ); if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) )) readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ ); @@ -816,9 +816,9 @@ void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles ) readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" ); readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" ); readTimeFormatAttr( "TimeFormat", XMLNS_DIALOGS_PREFIX ":time-format" ); - readLongAttr( "Time", XMLNS_DIALOGS_PREFIX ":value" ); - readLongAttr( "TimeMin", XMLNS_DIALOGS_PREFIX ":value-min" ); - readLongAttr( "TimeMax", XMLNS_DIALOGS_PREFIX ":value-max" ); + readTimeAttr( "Time", XMLNS_DIALOGS_PREFIX ":value" ); + readTimeAttr( "TimeMin", XMLNS_DIALOGS_PREFIX ":value-min" ); + readTimeAttr( "TimeMax", XMLNS_DIALOGS_PREFIX ":value-max" ); readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" ); if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) )) readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ ); diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index cc17c7a..157d258 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -35,6 +35,10 @@ #include <com/sun/star/awt/LineEndFormat.hpp> #include <com/sun/star/awt/PushButtonType.hpp> #include <com/sun/star/awt/VisualEffect.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/Time.hpp> +#include <tools/date.hxx> +#include <tools/time.hxx> #include <com/sun/star/io/XPersistObject.hpp> @@ -594,6 +598,50 @@ void ElementDescriptor::readDateFormatAttr( OUString const & rPropName, OUString break; } } + else + OSL_FAIL( "### unexpected property type!" ); + } +} +//__________________________________________________________________________________________________ +void ElementDescriptor::readDateAttr( OUString const & rPropName, OUString const & rAttrName ) +{ + if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) + { + Any a( _xProps->getPropertyValue( rPropName ) ); + if (a.getValueTypeClass() == TypeClass_STRUCT && a.getValueType() == ::getCppuType( (util::Date*)0 )) + { + util::Date aUDate; + if (a >>= aUDate) + { + ::Date aTDate(aUDate); + addAttribute( rAttrName, OUString::valueOf( static_cast<sal_Int32>(aTDate.GetDate()) ) ); + } + else + OSL_FAIL( "### internal error" ); + } + else + OSL_FAIL( "### unexpected property type!" ); + } +} +//__________________________________________________________________________________________________ +void ElementDescriptor::readTimeAttr( OUString const & rPropName, OUString const & rAttrName ) +{ + if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) + { + Any a( _xProps->getPropertyValue( rPropName ) ); + if (a.getValueTypeClass() == TypeClass_STRUCT && a.getValueType() == ::getCppuType( (util::Time*)0 )) + { + util::Time aUTime; + if (a >>= aUTime) + { + ::Time aTTime(aUTime); + addAttribute( rAttrName, OUString::valueOf( aTTime.GetTime() / ::Time::nanoPerCenti ) ); + } + else + OSL_FAIL( "### internal error" ); + } + else + OSL_FAIL( "### unexpected property type!" ); } } //__________________________________________________________________________________________________ @@ -629,6 +677,8 @@ void ElementDescriptor::readTimeFormatAttr( OUString const & rPropName, OUString break; } } + else + OSL_FAIL( "### unexpected property type!" ); } } //__________________________________________________________________________________________________ @@ -655,6 +705,8 @@ void ElementDescriptor::readAlignAttr( OUString const & rPropName, OUString cons break; } } + else + OSL_FAIL( "### unexpected property type!" ); } } //__________________________________________________________________________________________________ @@ -683,6 +735,8 @@ void ElementDescriptor::readVerticalAlignAttr( OUString const & rPropName, OUStr break; } } + else + OSL_FAIL( "### unexpected property type!" ); } } //__________________________________________________________________________________________________ @@ -735,6 +789,8 @@ void ElementDescriptor::readImageAlignAttr( OUString const & rPropName, OUString break; } } + else + OSL_FAIL( "### unexpected property type!" ); } } //__________________________________________________________________________________________________ diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index 0e61b54..1f9b3e1 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -632,9 +632,9 @@ void TimeFieldElement::endElement() ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes ); ctx.importBooleanProperty("HideInactiveSelection","hide-inactive-selection", _xAttributes ); ctx.importTimeFormatProperty( "TimeFormat", "time-format", _xAttributes ); - ctx.importLongProperty( "Time", "value", _xAttributes ); - ctx.importLongProperty( "TimeMin", "value-min", _xAttributes ); - ctx.importLongProperty( "TimeMax", "value-max", _xAttributes ); + ctx.importTimeProperty( "Time", "value", _xAttributes ); + ctx.importTimeProperty( "TimeMin", "value-min", _xAttributes ); + ctx.importTimeProperty( "TimeMax", "value-max", _xAttributes ); ctx.importBooleanProperty( "Spin", "spin", _xAttributes ); if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes )) ctx.getControlModel()->setPropertyValue("Repeat", makeAny(true) ); @@ -749,9 +749,9 @@ void DateFieldElement::endElement() ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes ); ctx.importDateFormatProperty( "DateFormat", "date-format", _xAttributes ); ctx.importBooleanProperty( "DateShowCentury", "show-century", _xAttributes ); - ctx.importLongProperty( "Date", "value", _xAttributes ); - ctx.importLongProperty( "DateMin", "value-min", _xAttributes ); - ctx.importLongProperty( "DateMax", "value-max", _xAttributes ); + ctx.importDateProperty( "Date", "value", _xAttributes ); + ctx.importDateProperty( "DateMin", "value-min", _xAttributes ); + ctx.importDateProperty( "DateMax", "value-max", _xAttributes ); ctx.importBooleanProperty( "Spin", "spin", _xAttributes ); if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes )) ctx.getControlModel()->setPropertyValue( "Repeat", makeAny(true) ); diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index 754efaf..820dd9b 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -34,6 +34,10 @@ #include <com/sun/star/awt/PushButtonType.hpp> #include <com/sun/star/awt/VisualEffect.hpp> #include <com/sun/star/style/VerticalAlignment.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/Time.hpp> +#include <tools/date.hxx> +#include <tools/time.hxx> #include <com/sun/star/script/XScriptEventsSupplier.hpp> #include <com/sun/star/script/ScriptEventDescriptor.hpp> @@ -1195,6 +1199,40 @@ bool ImportContext::importDateFormatProperty( return false; } //__________________________________________________________________________________________________ +bool ImportContext::importTimeProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::input::XAttributes > const & xAttributes ) +{ + OUString aValue( + xAttributes->getValueByUidName( + _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); + if (!aValue.isEmpty()) + { + ::Time aTTime(toInt32( aValue ) * ::Time::nanoPerCenti); + util::Time aUTime(aTTime.GetUNOTime()); + _xControlModel->setPropertyValue( rPropName, makeAny( aUTime ) ); + return true; + } + return false; +} +//__________________________________________________________________________________________________ +bool ImportContext::importDateProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::input::XAttributes > const & xAttributes ) +{ + OUString aValue( + xAttributes->getValueByUidName( + _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); + if (!aValue.isEmpty()) + { + ::Date aTDate(toInt32( aValue )); + util::Date aUDate(aTDate.GetUNODate()); + _xControlModel->setPropertyValue( rPropName, makeAny( aUDate ) ); + return true; + } + return false; +} +//__________________________________________________________________________________________________ bool ImportContext::importTimeFormatProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::input::XAttributes > const & xAttributes ) commit 14094d3753f8b4aa10a48d0f788d915c33630077 Author: Stephan Bergmann <[email protected]> Date: Mon Aug 5 15:50:45 2013 +0200 Adapt UnoControlModel::read/write ...to 8ee69b0ba13f74d1515fac71df92947eb6328ab1 "fdo#67235 adapt form control code to time nanosecond API change, step 3." It is a bit unclear to me how exactly this code is used, so to be safe, just read and write in the old format (of using a single integer to represent a Date resp. Time) at least for now, loosing nanosecond precision and the UTC flag. Change-Id: Ib5148f750a420ad09366c79b68370ad0efd501f4 diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 0578e2c..782922b 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -627,6 +627,21 @@ void UnoControlModel::write( const ::com::sun::star::uno::Reference< ::com::sun: OutStream->writeBoolean( aFD.WordLineMode ); OutStream->writeShort( aFD.Type ); } + else if ( rType == cppu::UnoType<css::util::Date>::get() ) + { + css::util::Date d; + rValue >>= d; + OutStream->writeLong(d.Day + 100 * d.Month + 10000 * d.Year); + // YYYYMMDD + } + else if ( rType == cppu::UnoType<css::util::Time>::get() ) + { + css::util::Time t; + rValue >>= t; + OutStream->writeLong( + t.NanoSeconds / 1000000 + 100 * t.Seconds + + 10000 * t.Minutes + 1000000 * t.Hours); // HHMMSShh + } else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence< OUString>*)0 ) ) { ::com::sun::star::uno::Sequence< OUString> aSeq; @@ -829,6 +844,19 @@ void UnoControlModel::read( const ::com::sun::star::uno::Reference< ::com::sun:: aFD.Type = InStream->readShort(); aValue <<= aFD; } + else if ( *pType == cppu::UnoType<css::util::Date>::get() ) + { + sal_Int32 n = InStream->readLong(); // YYYYMMDD + aValue <<= css::util::Date( + n % 100, (n / 100) % 100, n / 10000); + } + else if ( *pType == cppu::UnoType<css::util::Time>::get() ) + { + sal_Int32 n = InStream->readLong(); // HHMMSShh + aValue <<= css::util::Time( + (n % 100) * 1000000, (n / 100) % 100, (n / 10000) % 100, + n / 1000000, false); + } else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence< OUString>*)0 ) ) { long nEntries = InStream->readLong(); commit e8059e4d37472c7db23e4522fcca0a48338b2f5e Author: Stephan Bergmann <[email protected]> Date: Mon Aug 5 11:51:23 2013 +0200 More little fixes for JunitTest_forms_unoapi ...needed since 8ee69b0ba13f74d1515fac71df92947eb6328ab1 "fdo#67235 adapt form control code to time nanosecond API change, step 3." Change-Id: If0fc8109d6da56c8e8df181ae0b35a4d9b34e767 diff --git a/qadevOOo/tests/java/ifc/form/validation/_XValidatableFormComponent.java b/qadevOOo/tests/java/ifc/form/validation/_XValidatableFormComponent.java index 1433a7a..3580a02 100644 --- a/qadevOOo/tests/java/ifc/form/validation/_XValidatableFormComponent.java +++ b/qadevOOo/tests/java/ifc/form/validation/_XValidatableFormComponent.java @@ -110,12 +110,16 @@ public class _XValidatableFormComponent extends MultiMethodTest if ( testPropsNames[i].equals("Value") - || testPropsNames[i].equals("Time") || testPropsNames[i].equals("EffectiveValue") ) { oldValue = new Integer(10); } + else if (testPropsNames[i].equals("Time")) + { + oldValue = new com.sun.star.util.Time( + 10, (short) 10, (short) 10, (short) 10, false); + } Object newValue = ValueChanger.changePValue(oldValue); gValues[i] = newValue; diff --git a/qadevOOo/tests/java/mod/_forms/ODateModel.java b/qadevOOo/tests/java/mod/_forms/ODateModel.java index f5c7445..79d24c1 100644 --- a/qadevOOo/tests/java/mod/_forms/ODateModel.java +++ b/qadevOOo/tests/java/mod/_forms/ODateModel.java @@ -140,7 +140,7 @@ public class ODateModel extends GenericModelTest { NamedValue Date = new NamedValue(); Date.Name = "Date"; - Date.Value = new Integer(DBTools.TST_DATE); + Date.Value = new com.sun.star.util.Date(); super.m_propertiesToSet.add(Date); super.m_LCShape_Type = "FixedText"; commit fb0a2199b6baf1166f05b2f19098bc40e677b540 Author: Stephan Bergmann <[email protected]> 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 586d0ad6f260a00365b1238ed69c98f488fa611a Author: Stephan Bergmann <[email protected]> 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()) ; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
