Changed util.printd to work with the default locale set on QLocale::setDefault to allow consistent results in tests

remotes/origin/more-conventional-sidebar
João Netto 7 years ago committed by Joao Oliveira
parent e7b7f9bd48
commit f54d65ca86
  1. 4
      autotests/formattest.cpp
  2. 4
      core/script/kjs_util.cpp

@ -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 )

Loading…
Cancel
Save