[Kmymoney-devel] new plugin test failing
Alvaro Soliverez
asoliverez at kde.org
Tue Sep 14 11:59:41 CEST 2010
On Mon, Sep 13, 2010 at 9:06 PM, Alvaro Soliverez <asoliverez at kde.org> wrote:
> On Mon, Sep 13, 2010 at 8:46 PM, allan <aganderson at ukonline.co.uk> wrote:
>> On 13/09/10 17:46, Carlos Eduardo da Silva wrote:
>>> Hello,
>>>
>>> On 13-09-2010 02:04, Alvaro Soliverez wrote:
>>>> the test of the new plugin is failing in my build.
>>>
>>> The test is also failing in my build.
>>>
>>> The failed test is testDateConvert in the csvdatetest.cpp file, more
>>> specifically, when it tries to convert "25-December-2000".
>>>
>>> Regards,
>>> Carlos
>>
>> I now have all tests working in my new sandbox, and specifically
>> csvdatetest.cpp runs without error.
>>
>> That source line is :-
>>
>> QVERIFY(m_convert->convertDate(i18n("25-December-2000")) ==
>> QDate::fromString("25/12/2000", format));//e = "25-December-2000"
>>
>> I'm expecting the alphanumeric month to have been translated into the
>> local equivalent. Then,
>> QDate::fromString(dat, dateFormat);
>> converts the string 'dat' into a QDate() according to 'dateFormat'.
>>
>> To me, this suggests the translators have not yet become involved, which
>> perhaps is not surprising. Or, am I missing something?
>>
>> To Alvaro
>> Should I disable that sub-test, and others with an alpha month, for the
>> time being? I'm ignorant about timescales for translation.
>>
> Hello Allan,
> That string should be constructed with the QDate methods, and not rely
> on translators. Unless absolutely necessary, tests should not have
> i18n calls.
>
> Use QDate::longMonthName to build the string.
>
Here's an example how you could do it:
QVERIFY(m_convert->convertDate(QString("25-" +
QDate::longMonthName(12) + "-2000")) ==
QDate::fromString("25/12/2000", format));//e = "25-December-2000"
QVERIFY(m_convert->convertDate(QString("5-" +
QDate::shortMonthName(11) + "-1999")) ==
QDate::fromString("05/11/1999", format));//f = "5-Nov-1999"
I just noticed another i18n call: i18n("13-rubbishmonth-2000"). Change
that to QString. There's no need to translate that.
Sorry I missed this while on review.
Regards,
Alvaro
More information about the KMyMoney-devel
mailing list