Commit f54d65ca authored by Joao Oliveira's avatar Joao Oliveira Committed by Joao Oliveira

Changed util.printd to work with the default locale set on QLocale::setDefault...

Changed util.printd to work with the default locale set on QLocale::setDefault to allow consistent results in tests
parent e7b7f9bd
......@@ -41,6 +41,10 @@ void FormatTest::initTestCase()
Okular::SettingsCore::instance( QStringLiteral( "formattest" ) );
m_document = new Okular::Document( nullptr );
// Force consistent locale
QLocale locale( QStringLiteral( "en_US" ) );
QLocale::setDefault( locale );
const QString testFile = QStringLiteral( KDESRCDIR "data/formattest.pdf" );
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
......
......@@ -107,7 +107,9 @@ static KJSObject printd( KJSContext *context, void *,
arg( str[2] ).arg( str[3] ).arg( str[4] ).arg( str[5] ).arg( str[6] );
QDateTime date = locale.toDateTime( myStr, QStringLiteral( "MMM/d/yyyy H:m:s" ) );
return KJSString( date.toString( format ) );
QLocale defaultLocale;
return KJSString( defaultLocale.toString( date, format ) );
}
void JSUtil::initType( KJSContext *ctx )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment