예제 #1
0
int test_date(int argc, char *argv[]) {

        char *goodInput = NULL;
        char *diffInput = NULL;
        PKIX_UInt32 actualMinorVersion;
        PKIX_UInt32 j = 0;

        PKIX_TEST_STD_VARS();

        startTests("Date");

        PKIX_TEST_EXPECT_NO_ERROR(
            PKIX_PL_NssContext_Create(0, PKIX_FALSE, NULL, &plContext));

        goodInput = "040329134847Z";
        diffInput = "050329135847Z";
        testDate(goodInput, diffInput);

cleanup:

        PKIX_Shutdown(plContext);

        PKIX_TEST_RETURN();

        endTests("Date");

        return (0);
}
예제 #2
0
//Throw the dialog to input the expense information
void Tracker::addexpensewindow()
{ 
    addExpenseWindow = new addExpenseDialog(); // Be sure to destroy you window somewhere
    addExpenseWindow->setMaximumSize(300,250);
    addExpenseWindow->setMinimumSize(300,250);
    addExpenseWindow->setWindowTitle("Add Expense Item on This Day");
    //******Add labels******//
    for(unsigned i = 0; i < expenseLabels->size(); i++){
        addExpenseWindow->categoryBox->addItem(tr((*expenseLabels)[i].c_str()));
    }
    //addExpenseWindow->categoryBox->addItem(tr("Add new label..."));
    //***if save***//
    if(addExpenseWindow->exec() == QDialog::Accepted){
        //***check if new label***//
        unsigned i;
        for(i = 0; i < expenseLabels->size(); i++){
            if(addExpenseWindow->expenseLabel.toStdString() == (*expenseLabels)[i]){
                break;
            }
        }
        if(i == expenseLabels->size()){
            expenseLabels->push_back(addExpenseWindow->expenseLabel.toStdString());
        }
        //*************************//
        date testDate(calendar->selectedDate().year(),calendar->selectedDate().month(),calendar->selectedDate().day());
        item toAdd(addExpenseWindow->expensename.toStdString(), addExpenseWindow->expenseamount, testDate, addExpenseWindow->expenseLabel.toStdString());
        //std::cout<<toAdd.getName().c_str()<<" "<<toAdd.getAmount()<<" "<<toAdd.getLabel().c_str()<<" "<<toAdd.getDate().month<<"/"<<toAdd.getDate().day<<"/"<<toAdd.getDate().year<<std::endl;
        expenseItems->push_back(toAdd);
        //std::cout<<"clicked SAVE"<<std::endl;
        selectedDateChanged();
    }
    //***if not save***//
    else{
        //std::cout<<"clicked CANCLE"<<std::endl;
    }
    double ratioValue = report_sum_M(QDate::currentDate().month(),QDate::currentDate().year(),expenseItems)/budgetAmount;
    if(ratioValue < 1){
       ratio->setValue(100*ratioValue);
    }
    else ratio->setValue(100);
}
예제 #3
0
//Throw the dialog to input the income information
void Tracker::addincomewindow()
{
    addIncomeWindow = new addIncomeDialog(); // Be sure to destroy you window somewhere
    addIncomeWindow->setMaximumSize(300,250);
    addIncomeWindow->setMinimumSize(300,250);
    addIncomeWindow->setWindowTitle("Add Income Item on This Day");
    //******Add labels******//
    for(unsigned i = 0; i < incomeLabels->size(); i++){
        addIncomeWindow->categoryBox->addItem(tr((*incomeLabels)[i].c_str()));
    }
    //addIncomeWindow->categoryBox->addItem(tr("Add new label..."));
    //***if save***//
    if(addIncomeWindow->exec() == QDialog::Accepted){
        //***check if new label***//
        unsigned i;
        for(i = 0; i < incomeLabels->size(); i++){
            if(addIncomeWindow->incomeLabel.toStdString() == (*incomeLabels)[i]){
                break;
            }
        }
        if(i == incomeLabels->size()){
            incomeLabels->push_back(addIncomeWindow->incomeLabel.toStdString());
        }
        //*************************//
        date testDate(calendar->selectedDate().year(),calendar->selectedDate().month(),calendar->selectedDate().day());
        item toAdd(addIncomeWindow->incomename.toStdString(), addIncomeWindow->incomeamount, testDate, addIncomeWindow->incomeLabel.toStdString());
        //std::cout<<toAdd.getName().c_str()<<" "<<toAdd.getAmount()<<" "<<toAdd.getLabel().c_str()<<" "<<toAdd.getDate().month<<"/"<<toAdd.getDate().day<<"/"<<toAdd.getDate().year<<std::endl;
        incomeItems->push_back(toAdd);
        //std::cout<<"clicked SAVE"<<std::endl;
        selectedDateChanged();
    }
    //***if not save***//
    else{
        //std::cout<<"clicked CANCLE"<<std::endl;
    }
}
void CConvertToRfc1123FormTest::DoTestsL()
{
    TInt ii;

    for (ii=0; ii< KInvalidTimeNumTests; ++ii)
    {
        TInternetDate date;
        TRAPD( error, date.SetDateL(KInvalidTimeTestCases[ii]));
        if (error && error != KErrCorrupt)
        {
            User::LeaveIfError(error);
        }
    }

    for (ii=0; ii < KNumberDEF126191TestCases; ++ii)
    {
        TInternetDate internetDate;
        _LIT(KTest, "Test for fix DEF126191 - Case: ");
        TInternetDateOffsetTestCase tc = KDEF126191TestCases[ii];
        TBuf<512> testName;
        testName.Append(KTest);
        TPtrC8 testDate( tc.iTextInput );
        TBuf<150> bufTestDate;
        bufTestDate.Copy(testDate);
        testName.Append(bufTestDate);
        _LIT(KTestExpected, "\n \t \t \t \t And Expected Result is: ");
        testName.Append(KTestExpected);
        TPtrC8 expectedTestDate( tc.iExpectedOutput );
        TBuf<150> bufExpectedTestDate;
        bufExpectedTestDate.Copy(expectedTestDate);
        testName.Append(bufExpectedTestDate);

        iTestHarness->StartTestL(testName);
        TInt err = 0;
        internetDate.SetDateL(tc.iTextInput);
        TDateTime parsedDate = internetDate.DateTime();
        TInternetDate ConvertparsedDate(parsedDate);
        HBufC8* textDate = ConvertparsedDate.InternetDateTimeL(TInternetDate::ERfc1123Format);
        CleanupStack::PushL(textDate);

        TBuf8 <50> KExpcted;
        KExpcted.Copy(tc.iExpectedOutput);
        if(textDate->CompareF(KExpcted) != 0)
        {
            err = KErrBadDescriptor;
        }
        CleanupStack::PopAndDestroy(textDate);
        iTestHarness->EndTest(err);
    }

    for (ii=0; ii< KNumberRfc1123GMTTzTestCases; ++ii)
    {
        TInternetDateTestCase tc = KRfc1123GMTTzTestCases[ii];
        TDateTime time(tc.iYear, tc.iMonth, tc.iDay, tc.iHour, tc.iMin, tc.iSecond, 0);
        TPtrC8 expected(tc.iTextFormat);
        ConvertTestL(time, expected);
    }

    for (ii=0; ii< KNumberINC090613TestCases; ++ii)
    {
        TInternetDate date;
        _LIT(KTest, "Test for fix INC090613 - Case: ");
        TBuf<256> testname;
        testname.Append(KTest);
        TPtrC8 testdate(KINC090613TestCases[ii]);
        TBuf<150> buftestdate;
        buftestdate.Copy(testdate);
        testname.Append(buftestdate);


        iTestHarness->StartTestL(testname);
        TRAPD(err,date.SetDateL(KINC090613TestCases[ii]));
        iTestHarness->EndTest(err);
        User::LeaveIfError(err);
    }
    for (ii=0; ii< KNumberINC107382TestCases; ++ii)
    {
        TInternetDate date;
        _LIT(KTest, "Test for fix INC107382 - Case: ");
        TBuf<256> testname;
        testname.Append(KTest);
        TPtrC8 testdate(KINC107382TestCases[ii]);
        TBuf<150> buftestdate;
        buftestdate.Copy(testdate);
        testname.Append(buftestdate);


        iTestHarness->StartTestL(testname);
        TRAPD(err,date.SetDateL(KINC107382TestCases[ii]));
        iTestHarness->EndTest(err);
        User::LeaveIfError(err);
    }

    for (ii=0; ii< KInvalidDescriptorToIntTests; ++ii)
    {
        _LIT(KTest, "Test for fix DEF138868 - Case: ");
        TBuf<256> testname;
        testname.Append(KTest);
        TPtrC8 testInput(KInvalidDesToIntTestCases[ii]);
        TBuf<150> buftestInput;
        buftestInput.Copy(testInput);
        testname.Append(buftestInput);

        iTestHarness->StartTestL(testname);
        TInt err=0;
        InetProtTextUtils::ConvertDescriptorToInt(KInvalidDesToIntTestCases[ii], err);
        iTestHarness->EndTest(err);
        User::LeaveIfError(err);
    }

}
예제 #5
0
void tst_QOrganizerItemDetails::rsvp()
{
    QOrganizerEventRsvp rsvp;
    QOrganizerItem oi;

    QVERIFY(rsvp.isEmpty());
    QVERIFY(rsvp.organizerName().isEmpty());
    QVERIFY(rsvp.organizerEmail().isEmpty());
    QVERIFY(rsvp.responseDate().isNull());
    QVERIFY(!rsvp.responseDate().isValid());
    QVERIFY(rsvp.responseDeadline().isNull());
    QVERIFY(!rsvp.responseDeadline().isValid());
    QVERIFY(rsvp.participationRole() == 0);
    QVERIFY(rsvp.participationStatus() == 0);
    QVERIFY(rsvp.responseRequirement() == 0);

    rsvp.setOrganizerName("Donald Duck");
    QVERIFY(rsvp.organizerName() == QString("Donald Duck"));
    rsvp.setOrganizerEmail("*****@*****.**");
    QVERIFY(rsvp.organizerEmail() == QString("*****@*****.**"));
    QDate testDate(2010, 10, 10);
    rsvp.setResponseDate(testDate);
    QVERIFY(!rsvp.responseDate().isNull());
    QVERIFY(rsvp.responseDate().isValid());
    QCOMPARE(testDate, rsvp.responseDate());
    rsvp.setResponseDeadline(testDate);
    QVERIFY(!rsvp.responseDeadline().isNull());
    QVERIFY(rsvp.responseDeadline().isValid());
    QCOMPARE(testDate, rsvp.responseDeadline());
    rsvp.setParticipationRole(QOrganizerEventAttendee::RoleOrganizer);
    QVERIFY(rsvp.participationRole() == QOrganizerEventAttendee::RoleOrganizer);
    rsvp.setParticipationStatus(QOrganizerEventAttendee::StatusAccepted);
    QVERIFY(rsvp.participationStatus() == QOrganizerEventAttendee::StatusAccepted);
    rsvp.setResponseRequirement(QOrganizerEventRsvp::ResponseRequired);
    QVERIFY(rsvp.responseRequirement() == QOrganizerEventRsvp::ResponseRequired);

    // add
    QCOMPARE(0, oi.details(QOrganizerItemDetail::TypeEventRsvp).size());
    QVERIFY(oi.saveDetail(&rsvp));
    QCOMPARE(1, oi.details(QOrganizerItemDetail::TypeEventRsvp).size());
    QVERIFY(rsvp == oi.detail(QOrganizerItemDetail::TypeEventRsvp));

    // update
    rsvp.setOrganizerName("Mickey Mouse");
    rsvp.setOrganizerEmail("*****@*****.**");
    QDate testDate2(2011, 11, 11);
    rsvp.setResponseDate(testDate2);
    rsvp.setResponseDeadline(testDate2);
    rsvp.setParticipationRole(QOrganizerEventAttendee::RoleChairperson);
    rsvp.setParticipationStatus(QOrganizerEventAttendee::StatusDelegated);
    rsvp.setResponseRequirement(QOrganizerEventRsvp::ResponseNotRequired);
    QVERIFY(oi.detail(QOrganizerItemDetail::TypeEventRsvp) != rsvp);
    QVERIFY(oi.saveDetail(&rsvp));
    QCOMPARE(1, oi.details(QOrganizerItemDetail::TypeEventRsvp).size());
    QVERIFY(oi.detail(QOrganizerItemDetail::TypeEventRsvp) == rsvp);

    // add another rsvp - not supported by all the backends
    QOrganizerEventRsvp rsvp2;
    rsvp2.setOrganizerName("Goofy");
    QVERIFY(oi.saveDetail(&rsvp2));
    QCOMPARE(2, oi.details(QOrganizerItemDetail::TypeEventRsvp).size());

    // remove
    QVERIFY(oi.removeDetail(&rsvp2));
    QCOMPARE(1, oi.details(QOrganizerItemDetail::TypeEventRsvp).size());
    QVERIFY(oi.removeDetail(&rsvp));
    QCOMPARE(0, oi.details(QOrganizerItemDetail::TypeEventRsvp).size());
}
예제 #6
0
void KDateTimeFormatterTest::testFormatDateTimePosix()
{
    KGlobal::locale()->setLanguage(QStringList("en_US"));
    KGlobal::locale()->setCalendarSystem(KLocale::QDateCalendar);
    KGlobal::locale()->setDateFormatShort("%y-%m-%d");

    KDateTimeFormatter formatter;

    //Test default settings
    KDateTime testDate(QDate(2005, 10, 20));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"), QString("2005"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"), QString("20"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"), QString("05"));
    QCOMPARE(formatter.formatDateTime(testDate, "%m"), QString("10"));
    QCOMPARE(formatter.formatDateTime(testDate, "%n"), QString("10"));
    QCOMPARE(formatter.formatDateTime(testDate, "%d"), QString("20"));
    QCOMPARE(formatter.formatDateTime(testDate, "%e"), QString("20"));
    QCOMPARE(formatter.formatDateTime(testDate, "%B"), QString("October"));
    QCOMPARE(formatter.formatDateTime(testDate, "%b"), QString("Oct"));
    QCOMPARE(formatter.formatDateTime(testDate, "%h"), QString("Oct"));
    QCOMPARE(formatter.formatDateTime(testDate, "%A"), QString("Thursday"));
    QCOMPARE(formatter.formatDateTime(testDate, "%a"), QString("Thu"));
    QCOMPARE(formatter.formatDateTime(testDate, "%j"), QString("293"));
    QCOMPARE(formatter.formatDateTime(testDate, "%V"), QString("42"));
    QCOMPARE(formatter.formatDateTime(testDate, "%G"), QString("2005"));
    QCOMPARE(formatter.formatDateTime(testDate, "%g"), QString("05"));
    QCOMPARE(formatter.formatDateTime(testDate, "%u"), QString("4"));
    QCOMPARE(formatter.formatDateTime(testDate, "%D"), QString("10/20/05"));
    QCOMPARE(formatter.formatDateTime(testDate, "%F"), QString("2005-10-20"));
    QCOMPARE(formatter.formatDateTime(testDate, "%x"), QString("05-10-20"));
    QCOMPARE(formatter.formatDateTime(testDate, "%%"), QString("%"));
    QCOMPARE(formatter.formatDateTime(testDate, "%t"), QString("\t"));

    QCOMPARE(formatter.formatDateTime(testDate, "-%Y-%C-%y-%m-%n-%d-%e-%B-%b-%h-%A-%a-%j-%V-%G-%g-%u:%D:%F:%x:%%-%t-"),
             QString("-2005-20-05-10-10-20-20-October-Oct-Oct-Thursday-Thu-293-42-2005-05-4:10/20/05:2005-10-20:05-10-20:%-\t-"));

    //Test the minimum widths are respected
    QCOMPARE(formatter.formatDateTime(testDate, "%1Y"),  QString("2005"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1C"),  QString("20"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1y"),  QString("05"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1m"),  QString("10"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1n"),  QString("10"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1d"),  QString("20"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1e"),  QString("20"));
    QCOMPARE(formatter.formatDateTime(testDate, "%01B"), QString("October"));
    QCOMPARE(formatter.formatDateTime(testDate, "%01b"), QString("Oct"));
    QCOMPARE(formatter.formatDateTime(testDate, "%01h"), QString("Oct"));
    QCOMPARE(formatter.formatDateTime(testDate, "%01A"), QString("Thursday"));
    QCOMPARE(formatter.formatDateTime(testDate, "%01a"), QString("Thu"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1j"),  QString("293"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1V"),  QString("42"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1G"),  QString("2005"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1g"),  QString("05"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1u"),  QString("4"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1D"),  QString("10/20/05"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1F"),  QString("2005-10-20"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1x"),  QString("05-10-20"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1%"),  QString("%"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1t"),  QString("\t"));

    testDate.setDate(QDate(2005, 1, 2));

    //Test various padding options with minimum width
    QCOMPARE(formatter.formatDateTime(testDate, "%"),     QString(""));
    QCOMPARE(formatter.formatDateTime(testDate, "%m"),    QString("01"));
    QCOMPARE(formatter.formatDateTime(testDate, "%n"),    QString("1"));
    QCOMPARE(formatter.formatDateTime(testDate, "%d"),    QString("02"));
    QCOMPARE(formatter.formatDateTime(testDate, "%e"),    QString("2"));
    QCOMPARE(formatter.formatDateTime(testDate, "%j"),    QString("002"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_m"),   QString(" 1"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_n"),   QString("1"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_d"),   QString(" 2"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_e"),   QString("2"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_j"),   QString("  2"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-m"),   QString("1"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-n"),   QString("1"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-d"),   QString("2"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-e"),   QString("2"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-j"),   QString("2"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0m"),   QString("01"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0n"),   QString("1"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0d"),   QString("02"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0e"),   QString("2"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0j"),   QString("002"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-_j"),  QString("  2"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_-j"),  QString("2"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-_0j"), QString("002"));

    //Test various padding options with width override
    QCOMPARE(formatter.formatDateTime(testDate, "%1m"),   QString("01"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-05m"), QString("00001"));
    QCOMPARE(formatter.formatDateTime(testDate, "%10m"),  QString("0000000001"));
    QCOMPARE(formatter.formatDateTime(testDate, "%15m"),  QString("000000000000001"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-5m"),  QString("1"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_5m"),  QString("    1"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_15m"), QString("              1"));
    QCOMPARE(formatter.formatDateTime(testDate, "%1B"),   QString("January"));
    QCOMPARE(formatter.formatDateTime(testDate, "%15B"),  QString("        January"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-15B"), QString("January"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_15B"), QString("        January"));
    QCOMPARE(formatter.formatDateTime(testDate, "%015B"), QString("00000000January"));

    //Test week number in previous year
    QCOMPARE(formatter.formatDateTime(testDate, "%V"), QString("53"));
    QCOMPARE(formatter.formatDateTime(testDate, "%G"), QString("2004"));
    QCOMPARE(formatter.formatDateTime(testDate, "%g"), QString("04"));

    //test case overrides
    QCOMPARE(formatter.formatDateTime(testDate, "%B"),  QString("January"));
    QCOMPARE(formatter.formatDateTime(testDate, "%^B"), QString("JANUARY"));
    QCOMPARE(formatter.formatDateTime(testDate, "%#B"), QString("JANUARY"));
    QCOMPARE(formatter.formatDateTime(testDate, "%m"),  QString("01"));
    QCOMPARE(formatter.formatDateTime(testDate, "%^m"), QString("01"));
    QCOMPARE(formatter.formatDateTime(testDate, "%#m"), QString("01"));

    //Test various year options

    testDate.setDate(QDate(789, 1, 1));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"),  QString("0789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"),  QString("07"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"),  QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-Y"), QString("789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-C"), QString("7"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-y"), QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_Y"), QString(" 789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_C"), QString(" 7"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_y"), QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0Y"), QString("0789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0C"), QString("07"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0y"), QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EC"), QString("AD"));
    QCOMPARE(formatter.formatDateTime(testDate, "%Ey"), QString("789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EY"), QString("789 AD"));

    testDate.setDate(QDate(709, 1, 1));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"),  QString("0709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"),  QString("07"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"),  QString("09"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-Y"), QString("709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-C"), QString("7"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-y"), QString("9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_Y"), QString(" 709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_C"), QString(" 7"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_y"), QString(" 9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0Y"), QString("0709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0C"), QString("07"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0y"), QString("09"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EC"), QString("AD"));
    QCOMPARE(formatter.formatDateTime(testDate, "%Ey"), QString("709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EY"), QString("709 AD"));

    testDate.setDate(QDate(89, 1, 1));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"),  QString("0089"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"),  QString("00"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"),  QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-Y"), QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-C"), QString("0"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-y"), QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_Y"), QString("  89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_C"), QString(" 0"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_y"), QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0Y"), QString("0089"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0C"), QString("00"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0y"), QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EC"), QString("AD"));
    QCOMPARE(formatter.formatDateTime(testDate, "%Ey"), QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EY"), QString("89 AD"));

    testDate.setDate(QDate(9, 1, 1));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"),  QString("0009"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"),  QString("00"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"),  QString("09"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-Y"), QString("9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-C"), QString("0"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-y"), QString("9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_Y"), QString("   9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_C"), QString(" 0"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_y"), QString(" 9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0Y"), QString("0009"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0C"), QString("00"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0y"), QString("09"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EC"), QString("AD"));
    QCOMPARE(formatter.formatDateTime(testDate, "%Ey"), QString("9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EY"), QString("9 AD"));

    testDate.setDate(QDate(-9, 1, 1));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"),  QString("-0009"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"),  QString("-00"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"),  QString("-09"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-Y"), QString("-9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-C"), QString("-0"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-y"), QString("-9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_Y"), QString("  -9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_C"), QString("-0"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_y"), QString("-9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0Y"), QString("-0009"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0C"), QString("-00"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0y"), QString("-09"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EC"), QString("BC"));
    QCOMPARE(formatter.formatDateTime(testDate, "%Ey"), QString("9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EY"), QString("9 BC"));

    testDate.setDate(QDate(-89, 1, 1));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"),  QString("-0089"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"),  QString("-00"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"),  QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-Y"), QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-C"), QString("-0"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-y"), QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_Y"), QString(" -89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_C"), QString("-0"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_y"), QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0Y"), QString("-0089"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0C"), QString("-00"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0y"), QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EC"), QString("BC"));
    QCOMPARE(formatter.formatDateTime(testDate, "%Ey"), QString("89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EY"), QString("89 BC"));

    testDate.setDate(QDate(-789, 1, 1));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"),  QString("-0789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"),  QString("-07"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"),  QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-Y"), QString("-789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-C"), QString("-7"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-y"), QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_Y"), QString("-789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_C"), QString("-7"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_y"), QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0Y"), QString("-0789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0C"), QString("-07"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0y"), QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EC"), QString("BC"));
    QCOMPARE(formatter.formatDateTime(testDate, "%Ey"), QString("789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EY"), QString("789 BC"));

    testDate.setDate(QDate(-709, 1, 1));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"),  QString("-0709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"),  QString("-07"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"),  QString("-09"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-Y"), QString("-709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-C"), QString("-7"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-y"), QString("-9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_Y"), QString("-709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_C"), QString("-7"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_y"), QString("-9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0Y"), QString("-0709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0C"), QString("-07"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0y"), QString("-09"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EC"), QString("BC"));
    QCOMPARE(formatter.formatDateTime(testDate, "%Ey"), QString("709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EY"), QString("709 BC"));

    testDate.setDate(QDate(-1789, 1, 1));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"),  QString("-1789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"),  QString("-17"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"),  QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-Y"), QString("-1789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-C"), QString("-17"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-y"), QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_Y"), QString("-1789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_C"), QString("-17"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_y"), QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0Y"), QString("-1789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0C"), QString("-17"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0y"), QString("-89"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EC"), QString("BC"));
    QCOMPARE(formatter.formatDateTime(testDate, "%Ey"), QString("1789"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EY"), QString("1789 BC"));

    testDate.setDate(QDate(-1709, 1, 1));
    QCOMPARE(formatter.formatDateTime(testDate, "%Y"),  QString("-1709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%C"),  QString("-17"));
    QCOMPARE(formatter.formatDateTime(testDate, "%y"),  QString("-09"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-Y"), QString("-1709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-C"), QString("-17"));
    QCOMPARE(formatter.formatDateTime(testDate, "%-y"), QString("-9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_Y"), QString("-1709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_C"), QString("-17"));
    QCOMPARE(formatter.formatDateTime(testDate, "%_y"), QString("-9"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0Y"), QString("-1709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0C"), QString("-17"));
    QCOMPARE(formatter.formatDateTime(testDate, "%0y"), QString("-09"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EC"), QString("BC"));
    QCOMPARE(formatter.formatDateTime(testDate, "%Ey"), QString("1709"));
    QCOMPARE(formatter.formatDateTime(testDate, "%EY"), QString("1709 BC"));
    /*
        // Test POSIX format
        testDate.setDate( QDate( 2010, 1, 2 ) );
        QCOMPARE( formatter.formatDateTime( testDate, "%Y-%n-%d", KLocale::KdeFormat ),   QString( "2010-1-02" ) );
        QCOMPARE( formatter.formatDateTime( testDate, "%Y-%n-%d", KLocale::PosixFormat ), QString( "2010-\n-02" ) );
        QCOMPARE( formatter.formatDateTime( testDate, "%e", KLocale::KdeFormat ),   QString( "2" ) );
        QCOMPARE( formatter.formatDateTime( testDate, "%e", KLocale::PosixFormat ), QString( " 2" ) );
    */
}