Apache OpenOffice (AOO) Bugzilla – Issue 68819
API: i18n.CalendarImpl::com::sun::star::i18n::XCalendar
Last modified: 2013-07-30 02:42:37 UTC
while running and enhancing the UNO-API-Tests for StarOffice I stumble over a problem: Language: he, Country: IL, Variant: IL, Name: jewish xCalender.setValue(CalendarFieldIndex.MONTH, 2); short set = xCalneder.getValue(CalendarFieldIndex.MONTH); => failed for MONTH expected 2 gained 1 To reproduce this behavior just start your office with parameter "-accept=socket,host=0,port=8100;urp;" and call inside a solar shell: checkapi -o i18n.CalendarImpl::com::sun::star::i18n::XCalendar Note: since the childworkspace "qadev27" is not integrated please use this cws to execute the test. I have enhanced the test to display the failure.
fixed.
.
ready for QA.
while executing the test the office crashes
office crashes in i18n27
Fixed.
Hi Christoph, I have fixed the problem and rebuilt install set. Please try again. Thanks, Karl.
cn->khong: the following methods does not work: getValue() - PASSED.FAILED isValid() - PASSED.FAILED
khong->cn, I have modified your test cases in _XCalendar.java, and the test is passed. public void _getValue() { boolean res = true; requiredMethod("setValue()"); new=> oObj.setValue(CalendarFieldIndex.MONTH, newValue); short aValue = oObj.getValue(CalendarFieldIndex.MONTH); res &= (aValue == newValue); tRes.tested("getValue()", res); } newValue needs to be set before you can get it, requiredMethod("serValue()") seems not doing right thing. public void _isValid() { boolean res = true; new=> oObj.loadDefaultCalendar(installed_locales[0]); oObj.setValue(CalendarFieldIndex.MONTH, (short) 37); res &= !oObj.isValid(); oObj.setValue(CalendarFieldIndex.MONTH, (short) 10); res &= oObj.isValid(); tRes.tested("isValid()", res); } It looks like calendar is not loaded in this case, only set one field will not make calendar valid.
cn->khong: in the current i18n27 version the initial issue occure again. And as a result of this the getValue() and isValid() methods failed.
SBA: Set status back to NEW.
khong->cn, I have run your test on m186 without my fix for this issue, it got exact same same error, what do you mean it occured again?
khong->cn, I made wrong assumption of the test case _isValid(). The calendar is loaded, it is Arabic hijri calendar in this case. The problem is the case set MONTH to 37 first, which makes the calendar invalid. During calculation for hijri calendar, other fields, like day, year, are also re-calculated, and may contain invalid values, just resetting MONTH to 10 in next statement may not make the calendar valid. The calendar should be recovered between two test statements. public void _isValid() { boolean res = true; oObj.setValue(CalendarFieldIndex.MONTH, (short) 37); res &= !oObj.isValid(); new=> oObj.setDateTime(aOriginalDTime); oObj.setValue(CalendarFieldIndex.MONTH, (short) 10); res &= oObj.isValid(); tRes.tested("isValid()", res); }
BTW, when creating or loading a new calendar, the calendar is not initialized to 0, but today's date. getValue without setValue will get today's date, like 9 for this month Oct for CalendarFieldIndex.MONTH, not newValue (0) as you expected in the case _getValue().
cn->khong: 1.) in the current cws I get the initial error: That means: Language: he, Country: IL, Variant: IL, Name: jewish xCalender.setValue(CalendarFieldIndex.MONTH, 2); short set = xCalneder.getValue(CalendarFieldIndex.MONTH); => failed for MONTH expected 2 gained 1 2.) isValid(): in the past the test code works.
As communicated with 'cn' and 'sba' we'll remove this issue from CWS i18n27. The related overall code changes to the calendar source file are very small and effectively only remove a possible unwanted side effect. However, there is some yet unidentified behavior to be investigated for the Jewish calendar. The testcase script portion of method _setValue() 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++) { //log.println("Setting: " + names[k]+" to "+ valueSet[k]); oObj.setDateTime(0.0); short set = oObj.getValue(fields[k]); if (fields[k] == CalendarFieldIndex.MONTH) set = newValue; oObj.setValue(fields[k],set); short get = oObj.getValue(fields[k]); if (get != set) { error += "failed for "+names[k]+" expected "+ set+" gained "+get+" ; "; } } with newValue==2 leads to the condition (get != set) being fulfilled, which is strange enough.
Thanks, Eike. I could reproduce the problem. setDateTime(0.0) somehow makes jewish calendar invalid. I fixed a problem in initializing non-gregorian calendars in contructor, setDateTime seems another place has similar problem.
set target from 2.x to 3.x according to http://wiki.services.openoffice.org/wiki/Target_3x
Reset assignee on issues not touched by assignee in more than 1000 days.