From 9158fb708f412efcf25bbfb7410f7d1adebabef7 Mon Sep 17 00:00:00 2001 From: Praveen Arimbrathodiyil Date: Tue, 6 Jan 2009 00:58:35 -0800 Subject: epoch, earliestValidDate and latestValidDate is added to test cases and functions fixed. --- .../kdelibs/kdecore/date/.kcalendarsystemindic.cpp.swp | Bin 0 -> 16384 bytes .../kde/kdelibs/kdecore/date/kcalendarsystemindic.cpp | 7 ++++--- calendar/kde/kdelibs/kdecore/tests/kcalendartest.cpp | 12 ++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 calendar/kde/kdelibs/kdecore/date/.kcalendarsystemindic.cpp.swp (limited to 'calendar') diff --git a/calendar/kde/kdelibs/kdecore/date/.kcalendarsystemindic.cpp.swp b/calendar/kde/kdelibs/kdecore/date/.kcalendarsystemindic.cpp.swp new file mode 100644 index 0000000..11e34fd Binary files /dev/null and b/calendar/kde/kdelibs/kdecore/date/.kcalendarsystemindic.cpp.swp differ diff --git a/calendar/kde/kdelibs/kdecore/date/kcalendarsystemindic.cpp b/calendar/kde/kdelibs/kdecore/date/kcalendarsystemindic.cpp index fe2addf..9f88d74 100644 --- a/calendar/kde/kdelibs/kdecore/date/kcalendarsystemindic.cpp +++ b/calendar/kde/kdelibs/kdecore/date/kcalendarsystemindic.cpp @@ -107,12 +107,14 @@ QString KCalendarSystemIndic::calendarType() const QDate KCalendarSystemIndic::epoch() const { - return QDate::fromJulianDay( 1721426 ); + // Saka Era starts at 22 March 79 in Gregarian Calendar + // We get 23 March 79 if convert back from Julian day 1749994.5 :-( + return QDate::fromString( "00790322", "yyyyMMdd" ); } QDate KCalendarSystemIndic::earliestValidDate() const { - return QDate::fromJulianDay( 1 ); + return KCalendarSystem::earliestValidDate(); } QDate KCalendarSystemIndic::latestValidDate() const @@ -166,7 +168,6 @@ int KCalendarSystemIndic::year( const QDate &date ) const return saka_year; - return KCalendarSystem::year( date ); } int KCalendarSystemIndic::month( const QDate &date ) const diff --git a/calendar/kde/kdelibs/kdecore/tests/kcalendartest.cpp b/calendar/kde/kdelibs/kdecore/tests/kcalendartest.cpp index fc775b2..32d5a6a 100644 --- a/calendar/kde/kdelibs/kdecore/tests/kcalendartest.cpp +++ b/calendar/kde/kdelibs/kdecore/tests/kcalendartest.cpp @@ -308,14 +308,14 @@ void KCalendarTest::testJalaliBasic() void KCalendarTest::testIndicBasic() { - const KCalendarSystem *calendar = KCalendarSystem::create(QString( "jalali" )); + const KCalendarSystem *calendar = KCalendarSystem::create(QString( "indic" )); - QCOMPARE( calendar->calendarType(), QString("jalali") ); - QCOMPARE( KCalendarSystem::calendarLabel( QString("jalali") ), QString("Jalali") ); + QCOMPARE( calendar->calendarType(), QString("indic") ); + QCOMPARE( KCalendarSystem::calendarLabel( QString("indic") ), QString("Indic") ); - QCOMPARE( calendar->epoch(), QDate( 622, 3, 19 ) ); - QCOMPARE( calendar->earliestValidDate(), QDate( 622, 3, 19 ) ); - QCOMPARE( calendar->latestValidDate(), QDate( 10621, 3, 17 ) ); + QCOMPARE( calendar->epoch(), QDate( 79, 3, 22 ) ); + QCOMPARE( calendar->earliestValidDate(), QDate( 79, 3, 22 ) ); + QCOMPARE( calendar->latestValidDate(), QDate( 9999, 12, 31 ) ); testValid( calendar, 10000, 13, 32, QDate( 1, 1, 1 ) ); -- cgit