MCPcopy Create free account
hub / github.com/KDE/okular / testPrintD_data

Method testPrintD_data

autotests/jsfunctionstest.cpp:462–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460};
461
462void JSFunctionsTest::testPrintD_data()
463{
464 // Force consistent locale
465 QLocale locale(QStringLiteral("en_US"));
466 QLocale::setDefault(locale);
467
468 QTest::addColumn<QString>("script");
469 QTest::addColumn<QString>("result");
470
471 QTest::newRow("mmyyy") << QStringLiteral(
472 "var date = new Date( 2010, 0, 5, 11, 10, 32, 1 );\
473 ret = app.alert( util.printd( \"mm\\\\yyyy\", date ) );")
474 << QStringLiteral("01\\2010");
475 QTest::newRow("myy") << QStringLiteral("ret = app.alert( util.printd( \"m\\\\yy\", date ) );") << QStringLiteral("1\\10");
476 QTest::newRow("ddmmHHMM") << QStringLiteral("ret = app.alert( util.printd( \"dd\\\\mm HH:MM\", date ) );") << QStringLiteral("05\\01 11:10");
477 QTest::newRow("ddmmHHMMss") << QStringLiteral("ret = app.alert( util.printd( \"dd\\\\mm HH:MM:ss\", date ) );") << QStringLiteral("05\\01 11:10:32");
478 QTest::newRow("yyyymmHHMMss") << QStringLiteral("ret = app.alert( util.printd( \"yyyy\\\\mm HH:MM:ss\", date ) );") << QStringLiteral("2010\\01 11:10:32");
479 QTest::newRow("0") << QStringLiteral("ret = app.alert( util.printd( 0, date ) );") << QStringLiteral("D:20100105111032");
480 QTest::newRow("1") << QStringLiteral("ret = app.alert( util.printd( 1, date ) );") << QStringLiteral("2010.01.05 11:10:32");
481
482 QDate date(2010, 1, 5);
483 QTest::newRow("2") << QStringLiteral("ret = app.alert( util.printd( 2, date ) );") << QString(date.toString(locale.dateFormat(QLocale::ShortFormat)) + QStringLiteral(" 11:10:32\u202FAM"));
484}
485
486void JSFunctionsTest::testPrintD()
487{

Callers

nothing calls this directly

Calls 2

toStringMethod · 0.80
QStringClass · 0.70

Tested by

no test coverage detected