~ubuntu-branches/ubuntu/wily/qtdeclarative-opensource-src/wily-proposed

« back to all changes in this revision

Viewing changes to tests/auto/qml/qqmllocale/tst_qqmllocale.cpp

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo, Ricardo Salveti de Araujo, Timo Jyrinki
  • Date: 2014-06-19 02:39:21 UTC
  • mfrom: (0.1.18 experimental)
  • Revision ID: package-import@ubuntu.com-20140619023921-yb2oasnuetz9b0fc
Tags: 5.3.0-3ubuntu4
[ Ricardo Salveti de Araujo ]
* debian/control:
  - Updating dependencies as we now also have libqt5quickwidgets5-gles
* libqt5quickwidgets5.symbols: updating to allow gles variant

[ Timo Jyrinki ]
* Update libqt5quickparticles5.symbols from build logs

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
    void stringLocaleCompare_data();
118
118
    void stringLocaleCompare();
119
119
 
 
120
    void localeAsCppProperty();
120
121
private:
121
122
    void addPropertyData(const QString &l);
122
123
    QVariant getProperty(QObject *obj, const QString &locale, const QString &property);
931
932
 
932
933
void tst_qqmllocale::dateFromLocaleString()
933
934
{
934
 
    QSKIP("Needs fixes in our date time parser");
935
935
    QFETCH(QString, locale);
936
936
    QFETCH(QString, format);
937
937
 
976
976
 
977
977
void tst_qqmllocale::dateFromLocaleDateString()
978
978
{
979
 
    QSKIP("Needs fixes in our date time parser");
980
979
    QFETCH(QString, locale);
981
980
    QFETCH(QString, format);
982
981
 
1021
1020
 
1022
1021
void tst_qqmllocale::dateFromLocaleTimeString()
1023
1022
{
1024
 
    QSKIP("Needs fixes in our date time parser");
1025
1023
    QFETCH(QString, locale);
1026
1024
    QFETCH(QString, format);
1027
1025
 
1223
1221
    QCOMPARE(obj->property("comparison").toInt(), QString::localeAwareCompare(string1, string2));
1224
1222
}
1225
1223
 
 
1224
class Calendar : public QObject
 
1225
{
 
1226
    Q_OBJECT
 
1227
    Q_PROPERTY(QLocale locale READ locale WRITE setLocale)
 
1228
public:
 
1229
    Calendar() {
 
1230
    }
 
1231
 
 
1232
    QLocale locale() const {
 
1233
        return mLocale;
 
1234
    }
 
1235
 
 
1236
    void setLocale(const QLocale &locale) {
 
1237
        mLocale = locale;
 
1238
    }
 
1239
private:
 
1240
    QLocale mLocale;
 
1241
};
 
1242
 
 
1243
void tst_qqmllocale::localeAsCppProperty()
 
1244
{
 
1245
    QQmlComponent component(&engine);
 
1246
    qmlRegisterType<Calendar>("Test", 1, 0, "Calendar");
 
1247
    component.setData("import QtQml 2.2\nimport Test 1.0\nCalendar { locale: Qt.locale('en_GB'); property var testLocale }", QUrl());
 
1248
    QVERIFY(!component.isError());
 
1249
    QTRY_VERIFY(component.isReady());
 
1250
 
 
1251
    Calendar *item = qobject_cast<Calendar*>(component.create());
 
1252
    QCOMPARE(item->property("locale").toLocale().name(), QLatin1String("en_GB"));
 
1253
 
 
1254
    QVariant localeVariant(QLocale("nb_NO"));
 
1255
    item->setProperty("testLocale", localeVariant);
 
1256
    QCOMPARE(item->property("testLocale").toLocale().name(), QLatin1String("nb_NO"));
 
1257
}
 
1258
 
1226
1259
class DateFormatter : public QObject
1227
1260
{
1228
1261
    Q_OBJECT