| 1 | /* |
| 2 | * This file is part of OnlineAccountsModule |
| 3 | * |
| 4 | * Copyright (C) 2015 Canonical Ltd. |
| 5 | * |
| 6 | * Contact: Alberto Mardegan <[email protected]> |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU Lesser General Public License version 3, as |
| 10 | * published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of |
| 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 15 | * PURPOSE. See the GNU Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include <LomiriOnlineAccountsDaemon/dbus_constants.h>cxx . . $ `<file>/online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h`/ |
| 22 | #include <QDBusArgument> |
| 23 | #include <QDBusConnection> |
| 24 | #include <QJsonDocument> |
| 25 | #include <QJsonObject> |
| 26 | #include <QObject> |
| 27 | #include <QQmlComponent> |
| 28 | #include <QQmlEngine> |
| 29 | #include <QRegularExpression> |
| 30 | #include <QSignalSpy> |
| 31 | #include <QTest> |
| 32 | #include <libqtdbusmock/DBusMock.h> |
| 33 | |
| 34 | namespace QTestcxx . . $ QTest/ { |
| 35 | template<> |
| 36 | char *toStringcxx . . $ QTest/toString(40c3e2c6db4df9d1).(const QVariantMapcxx . . $ QVariantMap# &map) |
| 37 | { |
| 38 | QJsonDocumentcxx . . $ QJsonDocument# doccxx . . $ QJsonDocument#QJsonDocument(6b379e5d051a9fe4).(QJsonObjectcxx . . $ QJsonObject#::fromVariantMapcxx . . $ QJsonObject#fromVariantMap(3a49b2b7865f4928).(map)); |
| 39 | return qstrdupcxx . . $ qstrdup(a8b8e32347182212).(doc.toJsoncxx . . $ QJsonDocument#toJson(6b49539da79a45f0).(QJsonDocumentcxx . . $ QJsonDocument#::Compactcxx . . $ QJsonDocument#Compact.).datacxx . . $ QByteArray#data(41208ce6ca65dd58).()); |
| 40 | } |
| 41 | } // QTest namespace |
| 42 | |
| 43 | class ModuleTestcxx . . $ ModuleTest#: public QObjectcxx . . $ QObject# |
| 44 | { |
| 45 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 46 | |
| 47 | public: |
| 48 | ModuleTestcxx . . $ ModuleTest#ModuleTest(49f6e7a06ebc5aa8).(); |
| 49 | |
| 50 | OrgFreedesktopDBusMockInterfacecxx . . $ OrgFreedesktopDBusMockInterface# &mockedcxx . . $ ModuleTest#mocked(dab724501d1bb78f).() { |
| 51 | return m_mockcxx . . $ ModuleTest#m_mock..mockInterfacecxx . . $ QtDBusMock/DBusMock#mockInterface(546837d66f4b9bf4).(ONLINE_ACCOUNTS_MANAGER_SERVICE_NAMEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:25:9`!, |
| 52 | ONLINE_ACCOUNTS_MANAGER_PATHcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:27:9`!, |
| 53 | ONLINE_ACCOUNTS_MANAGER_INTERFACEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:28:9`!, |
| 54 | QDBusConnectioncxx . . $ QDBusConnection#::SessionBuscxx . . $ QDBusConnection#SessionBus.); |
| 55 | } |
| 56 | |
| 57 | void addMockedMethodcxx . . $ ModuleTest#addMockedMethod(6d8ce341bc76c5ea).(const QStringcxx . . $ QString# &name, |
| 58 | const QStringcxx . . $ QString# &in_sig, |
| 59 | const QStringcxx . . $ QString# &out_sig, |
| 60 | const QStringcxx . . $ QString# &code) |
| 61 | { |
| 62 | return mockedcxx . . $ ModuleTest#mocked(dab724501d1bb78f).().AddMethodcxx . . $ OrgFreedesktopDBusMockInterface#AddMethod(2b0fda1d68ce913d).(ONLINE_ACCOUNTS_MANAGER_INTERFACEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:28:9`!, |
| 63 | name, in_sig, out_sig, code).waitForFinishedcxx . . $ QDBusPendingCall#waitForFinished(49f6e7a06ebc5aa8).(); |
| 64 | } |
| 65 | |
| 66 | void addGetAccountsMethodcxx . . $ ModuleTest#addGetAccountsMethod(3520e46b33348bf6).(const QStringcxx . . $ QString# &code) { |
| 67 | addMockedMethodcxx . . $ ModuleTest#addMockedMethod(6d8ce341bc76c5ea).("GetAccounts"cxx . . $ QString#QString(85c52e162fed56f9)., "a{sv}"cxx . . $ QString#QString(85c52e162fed56f9)., "a(ua{sv})aa{sv}"cxx . . $ QString#QString(85c52e162fed56f9)., code); |
| 68 | } |
| 69 | |
| 70 | void emitAccountChangedcxx . . $ ModuleTest#emitAccountChanged(12ac1711c074ce7c).(const QStringcxx . . $ QString# &service, |
| 71 | uintcxx . . $ uint# accountId, |
| 72 | const QVariantMapcxx . . $ QVariantMap# &changes) |
| 73 | { |
| 74 | QVariantListcxx . . $ QVariantList# argscxx . . $ QList#QList(ced63f7c635d850d).; |
| 75 | args <<cxx . . $ QList#`operator<<`(309d1580d8f5dc58). servicecxx . . $ QVariant#QVariant(3520e46b33348bf6).; |
| 76 | QDBusArgumentcxx . . $ QDBusArgument# infocxx . . $ QDBusArgument#QDBusArgument(49f6e7a06ebc5aa8).; |
| 77 | info.beginStructurecxx . . $ QDBusArgument#beginStructure(49f6e7a06ebc5aa8).(); |
| 78 | info <<cxx . . $ QDBusArgument#`operator<<`(5af213fa923c97ec). accountId <<cxx . . $ `operator<<`(c2c2177b6126adc8). changes; |
| 79 | info.endStructurecxx . . $ QDBusArgument#endStructure(49f6e7a06ebc5aa8).(); |
| 80 | args <<cxx . . $ QList#`operator<<`(309d1580d8f5dc58). QVariantcxx . . $ QVariant#::fromValuecxx . . $ QVariant#fromValue(28ec88ac519b76da).(info); |
| 81 | mockedcxx . . $ ModuleTest#mocked(dab724501d1bb78f).().EmitSignalcxx . . $ OrgFreedesktopDBusMockInterface#EmitSignal(e9b8886b7dab6716).(ONLINE_ACCOUNTS_MANAGER_INTERFACEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:28:9`!, |
| 82 | "AccountChanged"cxx . . $ QString#QString(85c52e162fed56f9)., "s(ua{sv})"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 83 | args); |
| 84 | } |
| 85 | |
| 86 | QVariantcxx . . $ QVariant# getcxx . . $ ModuleTest#get(d014018e9b42c855).(const QAbstractListModelcxx . . $ QAbstractListModel# *model, int row, QStringcxx . . $ QString# roleName) |
| 87 | { |
| 88 | QHashcxx . . $ QHash#<int, QByteArraycxx . . $ QByteArray#> roleNames = model->roleNamescxx . . $ QAbstractItemModel#roleNames(404e830a028de8a7).(); |
| 89 | int role = roleNames.keycxx . . $ QHash#key(dd8c0696c30c0a31).(roleName.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).(), -1); |
| 90 | return model->datacxx . . $ QAbstractItemModel#data(69b5b18a001c0029).(model->indexcxx . . $ QAbstractListModel#index(37dbccf64c4e392).(row), role); |
| 91 | } |
| 92 | |
| 93 | private Q_SLOTScxx . . $ `<external>/1208926524888476972/qobjectdefs.h:92:10`!: |
| 94 | void initTestCasecxx . . $ ModuleTest#initTestCase(49f6e7a06ebc5aa8).(); |
| 95 | void cleanupcxx . . $ ModuleTest#cleanup(49f6e7a06ebc5aa8).(); |
| 96 | void testModuleImportcxx . . $ ModuleTest#testModuleImport(49f6e7a06ebc5aa8).(); |
| 97 | void testModelPropertiescxx . . $ ModuleTest#testModelProperties(49f6e7a06ebc5aa8).(); |
| 98 | void testServices_datacxx . . $ ModuleTest#testServices_data(49f6e7a06ebc5aa8).(); |
| 99 | void testServicescxx . . $ ModuleTest#testServices(49f6e7a06ebc5aa8).(); |
| 100 | void testModelRoles_datacxx . . $ ModuleTest#testModelRoles_data(49f6e7a06ebc5aa8).(); |
| 101 | void testModelRolescxx . . $ ModuleTest#testModelRoles(49f6e7a06ebc5aa8).(); |
| 102 | void testModelFilters_datacxx . . $ ModuleTest#testModelFilters_data(49f6e7a06ebc5aa8).(); |
| 103 | void testModelFilterscxx . . $ ModuleTest#testModelFilters(49f6e7a06ebc5aa8).(); |
| 104 | void testModelChangescxx . . $ ModuleTest#testModelChanges(49f6e7a06ebc5aa8).(); |
| 105 | void testModelRequestAccess_datacxx . . $ ModuleTest#testModelRequestAccess_data(49f6e7a06ebc5aa8).(); |
| 106 | void testModelRequestAccesscxx . . $ ModuleTest#testModelRequestAccess(49f6e7a06ebc5aa8).(); |
| 107 | void testAccountAuthentication_datacxx . . $ ModuleTest#testAccountAuthentication_data(49f6e7a06ebc5aa8).(); |
| 108 | void testAccountAuthenticationcxx . . $ ModuleTest#testAccountAuthentication(49f6e7a06ebc5aa8).(); |
| 109 | void testInitialization_datacxx . . $ ModuleTest#testInitialization_data(49f6e7a06ebc5aa8).(); |
| 110 | void testInitializationcxx . . $ ModuleTest#testInitialization(49f6e7a06ebc5aa8).(); |
| 111 | |
| 112 | private: |
| 113 | QtDBusTestcxx . . $ QtDBusTest/::DBusTestRunnercxx . . $ QtDBusTest/DBusTestRunner# m_dbuscxx . . $ ModuleTest#m_dbus.; |
| 114 | QtDBusMockcxx . . $ QtDBusMock/::DBusMockcxx . . $ QtDBusMock/DBusMock# m_mockcxx . . $ ModuleTest#m_mock.; |
| 115 | }; |
| 116 | |
| 117 | ModuleTestcxx . . $ ModuleTest#::ModuleTestcxx . . $ ModuleTest#ModuleTest(49f6e7a06ebc5aa8).(): |
| 118 | QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(), |
| 119 | m_mockcxx . . $ ModuleTest#m_mock.(m_dbuscxx . . $ ModuleTest#m_dbus.) |
| 120 | { |
| 121 | m_mockcxx . . $ ModuleTest#m_mock..registerCustomMockcxx . . $ QtDBusMock/DBusMock#registerCustomMock(51f840a30045282a).(ONLINE_ACCOUNTS_MANAGER_SERVICE_NAMEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:25:9`!, |
| 122 | ONLINE_ACCOUNTS_MANAGER_PATHcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:27:9`!, |
| 123 | ONLINE_ACCOUNTS_MANAGER_INTERFACEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:28:9`!, |
| 124 | QDBusConnectioncxx . . $ QDBusConnection#::SessionBuscxx . . $ QDBusConnection#SessionBus.); |
| 125 | m_dbuscxx . . $ ModuleTest#m_dbus..startServicescxx . . $ QtDBusTest/DBusTestRunner#startServices(49f6e7a06ebc5aa8).(); |
| 126 | } |
| 127 | |
| 128 | void ModuleTestcxx . . $ ModuleTest#::initTestCasecxx . . $ ModuleTest#initTestCase(49f6e7a06ebc5aa8).() |
| 129 | { |
| 130 | qputenvcxx . . $ qputenv(d42e8231112a1b5b).("QML2_IMPORT_PATH", TEST_QML_IMPORT_PATHcxx . . $ `<built-in>:483:9`!); |
| 131 | } |
| 132 | |
| 133 | void ModuleTestcxx . . $ ModuleTest#::cleanupcxx . . $ ModuleTest#cleanup(49f6e7a06ebc5aa8).() |
| 134 | { |
| 135 | /* Iterate the main loop in order to execute the delayed cleanup methods |
| 136 | * and avoid memory leaks. |
| 137 | */ |
| 138 | QTestcxx . . $ QTest/::qWaitcxx . . $ QTest/qWait(d4f767463ce0a6b3).(10); |
| 139 | } |
| 140 | |
| 141 | void ModuleTestcxx . . $ ModuleTest#::testModuleImportcxx . . $ ModuleTest#testModuleImport(49f6e7a06ebc5aa8).() |
| 142 | { |
| 143 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 144 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 145 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import Lomiri.OnlineAccounts 2.0\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 146 | "AccountModel {}", |
| 147 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 148 | QObjectcxx . . $ QObject# *object = component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).(); |
| 149 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object != 0); |
| 150 | delete object; |
| 151 | } |
| 152 | |
| 153 | void ModuleTestcxx . . $ ModuleTest#::testModelPropertiescxx . . $ ModuleTest#testModelProperties(49f6e7a06ebc5aa8).() |
| 154 | { |
| 155 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 156 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 157 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import Lomiri.OnlineAccounts 2.0\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 158 | "AccountModel {}", |
| 159 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 160 | QObjectcxx . . $ QObject# *object = component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).(); |
| 161 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object != 0); |
| 162 | |
| 163 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object->setProperty("applicationId", "foo")); |
| 164 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(object->property("applicationId").toString(), QString("foo")); |
| 165 | |
| 166 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object->setProperty("serviceId", "bar")); |
| 167 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(object->property("serviceId").toString(), QString("bar")); |
| 168 | |
| 169 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(object->property("ready").toBool(), false); |
| 170 | |
| 171 | delete object; |
| 172 | } |
| 173 | |
| 174 | void ModuleTestcxx . . $ ModuleTest#::testServices_datacxx . . $ ModuleTest#testServices_data(49f6e7a06ebc5aa8).() |
| 175 | { |
| 176 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringcxx . . $ QString#>("reply"); |
| 177 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QListcxx . . $ QList#<QVariantMapcxx . . $ QVariantMap#>>("expectedServices"); |
| 178 | |
| 179 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("no services") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 180 | "[]" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 181 | QListcxx . . $ QList#QList(ced63f7c635d850d).<QVariantMapcxx . . $ QVariantMap#> {}; |
| 182 | |
| 183 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("one service") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 184 | "[{" |
| 185 | "'" ONLINE_ACCOUNTS_INFO_KEY_SERVICE_IDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:32:9`! "': 'app_coolshare'," |
| 186 | "'" ONLINE_ACCOUNTS_INFO_KEY_DISPLAY_NAMEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:31:9`! "': 'Cool Share'," |
| 187 | "'" ONLINE_ACCOUNTS_INFO_KEY_ICON_SOURCEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:46:9`! "': 'image://theme/coolshare'," |
| 188 | "}]" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 189 | QListcxx . . $ QList#QList(b6da5b9a9f304025).<QVariantMapcxx . . $ QVariantMap#> { |
| 190 | { |
| 191 | { "serviceId", "app_coolshare" }, |
| 192 | { "displayName", "Cool Share" }, |
| 193 | { "iconSource", QUrlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb).("image://theme/coolshare"cxx . . $ QString#QString(85c52e162fed56f9).)}, |
| 194 | }, |
| 195 | }; |
| 196 | } |
| 197 | |
| 198 | void ModuleTestcxx . . $ ModuleTest#::testServicescxx . . $ ModuleTest#testServices(49f6e7a06ebc5aa8).() |
| 199 | { |
| 200 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QString, reply); |
| 201 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QList<QVariantMap>, expectedServices); |
| 202 | |
| 203 | addGetAccountsMethodcxx . . $ ModuleTest#addGetAccountsMethod(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("ret = ([], %1)").argcxx . . $ QString#arg(bc823072288cbbb5).(reply)); |
| 204 | |
| 205 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 206 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 207 | /* We could return the serviceList property directly, but that would be |
| 208 | * passing a OnlineAccounts::Service as QJSValue, which might not be a |
| 209 | * proof that every property is properly accessible from QML. Therefore, we |
| 210 | * explicitly run through the list and copy it as a new object. */ |
| 211 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import Lomiri.OnlineAccounts 2.0\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 212 | "AccountModel {\n" |
| 213 | " applicationId: \"foo\"\n" |
| 214 | " function getServices() {\n" |
| 215 | " var ret = [];\n" |
| 216 | " for (var i = 0; i < serviceList.length; i++) {\n" |
| 217 | " var s = serviceList[i];\n" |
| 218 | " var service = {};\n" |
| 219 | " for (var key in s) { service[key] = s[key]; }\n" |
| 220 | " ret.push(service);\n" |
| 221 | " }\n" |
| 222 | " return ret;\n" |
| 223 | " }\n" |
| 224 | "}", |
| 225 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 226 | QObjectcxx . . $ QObject# *object = component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).(); |
| 227 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object != 0); |
| 228 | QAbstractListModelcxx . . $ QAbstractListModel# *model = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QAbstractListModelcxx . . $ QAbstractListModel#*>(object); |
| 229 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(model != 0); |
| 230 | |
| 231 | QSignalSpycxx . . $ QSignalSpy# readycxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(object, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(isReadyChanged())); |
| 232 | ready.waitcxx . . $ QSignalSpy#wait(83c267b20bac841a).(); |
| 233 | |
| 234 | QVariantcxx . . $ QVariant# serviceListcxx . . $ QVariant#QVariant(ced63f7c635d850d).; |
| 235 | bool ok = QMetaObjectcxx . . $ QMetaObject#::invokeMethodcxx . . $ QMetaObject#invokeMethod(5202dd66995c277a).(object, "getServices", |
| 236 | Q_RETURN_ARGcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:280:9`!(QVariant, serviceList)); |
| 237 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(ok); |
| 238 | |
| 239 | QVariantListcxx . . $ QVariantList# serviceVariantList = serviceList.toListcxx . . $ QVariant#toList(a208304be85d9b76).(); |
| 240 | QListcxx . . $ QList#<QVariantMapcxx . . $ QVariantMap#> servicescxx . . $ QList#QList(ced63f7c635d850d).; |
| 241 | for (const QVariantcxx . . $ QVariant# &v: serviceVariantList) { |
| 242 | services.appendcxx . . $ QList#append(77d9f17553126ecb).(v.toMapcxx . . $ QVariant#toMap(87f780dbe64191c4).()); |
| 243 | } |
| 244 | |
| 245 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(services, expectedServices); |
| 246 | delete object; |
| 247 | } |
| 248 | |
| 249 | void ModuleTestcxx . . $ ModuleTest#::testModelRoles_datacxx . . $ ModuleTest#testModelRoles_data(49f6e7a06ebc5aa8).() |
| 250 | { |
| 251 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringcxx . . $ QString#>("accountData"); |
| 252 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringcxx . . $ QString#>("serviceData"); |
| 253 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringcxx . . $ QString#>("displayName"); |
| 254 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringcxx . . $ QString#>("serviceId"); |
| 255 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<int>("authenticationMethod"); |
| 256 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QVariantMapcxx . . $ QVariantMap#>("settings"); |
| 257 | |
| 258 | QVariantMapcxx . . $ QVariantMap# settingscxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 259 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("empty") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 260 | "{}" <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 261 | "" <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 262 | "" <<cxx . . $ `operator<<`(1c43a92f59c6a770). "" <<cxx . . $ `operator<<`(61fb880f51a53ddf). 0 <<cxx . . $ `operator<<`(61fb880f51a53ddf). settings; |
| 263 | |
| 264 | settings.insertcxx . . $ QMap#insert(929a1ed410fe8423).("Server"cxx . . $ QString#QString(85c52e162fed56f9)., "www.example.com"cxx . . $ QVariant#QVariant(85c52e162fed56f9).); |
| 265 | settings.insertcxx . . $ QMap#insert(929a1ed410fe8423).("Port"cxx . . $ QString#QString(85c52e162fed56f9)., "9900"cxx . . $ QVariant#QVariant(85c52e162fed56f9).); |
| 266 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("complete") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 267 | "{" |
| 268 | " '" ONLINE_ACCOUNTS_INFO_KEY_DISPLAY_NAMEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:31:9`! "': 'Tom'," |
| 269 | " '" ONLINE_ACCOUNTS_INFO_KEY_SERVICE_IDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:32:9`! "': 'cool'," |
| 270 | " '" ONLINE_ACCOUNTS_INFO_KEY_AUTH_METHODcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:33:9`! "': 2," |
| 271 | " '" ONLINE_ACCOUNTS_INFO_KEY_SETTINGScxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:39:9`! "Server': 'www.example.com'," |
| 272 | " '" ONLINE_ACCOUNTS_INFO_KEY_SETTINGScxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:39:9`! "Port': 9900," |
| 273 | "}" <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 274 | "{" |
| 275 | " '" ONLINE_ACCOUNTS_INFO_KEY_SERVICE_IDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:32:9`! "': 'cool'," |
| 276 | "}" <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 277 | "Tom" <<cxx . . $ `operator<<`(1c43a92f59c6a770). "cool" <<cxx . . $ `operator<<`(61fb880f51a53ddf). 2 <<cxx . . $ `operator<<`(61fb880f51a53ddf). settings; |
| 278 | } |
| 279 | |
| 280 | void ModuleTestcxx . . $ ModuleTest#::testModelRolescxx . . $ ModuleTest#testModelRoles(49f6e7a06ebc5aa8).() |
| 281 | { |
| 282 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QString, accountData); |
| 283 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QString, serviceData); |
| 284 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QString, displayName); |
| 285 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QString, serviceId); |
| 286 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(int, authenticationMethod); |
| 287 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QVariantMap, settings); |
| 288 | |
| 289 | addGetAccountsMethodcxx . . $ ModuleTest#addGetAccountsMethod(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("ret = ([(1, %1)], [%2])"). |
| 290 | argcxx . . $ QString#arg(bc823072288cbbb5).(accountData).argcxx . . $ QString#arg(bc823072288cbbb5).(serviceData)); |
| 291 | |
| 292 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 293 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 294 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import Lomiri.OnlineAccounts 2.0\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 295 | "AccountModel { applicationId: \"foo\" }", |
| 296 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 297 | QObjectcxx . . $ QObject# *object = component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).(); |
| 298 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object != 0); |
| 299 | QAbstractListModelcxx . . $ QAbstractListModel# *model = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QAbstractListModelcxx . . $ QAbstractListModel#*>(object); |
| 300 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(model != 0); |
| 301 | |
| 302 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(object->property("ready").toBool(), false); |
| 303 | QSignalSpycxx . . $ QSignalSpy# readycxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(object, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(isReadyChanged())); |
| 304 | |
| 305 | ready.waitcxx . . $ QSignalSpy#wait(83c267b20bac841a).(); |
| 306 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(object->property("ready").toBool(), true); |
| 307 | |
| 308 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 1); |
| 309 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->data(model->index(0), Qt::DisplayRole).toString(), |
| 310 | QString("%1 - %2").arg(displayName).arg(serviceId)); |
| 311 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(get(model, 0, "displayName").toString(), displayName); |
| 312 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(get(model, 0, "valid").toBool(), true); |
| 313 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(get(model, 0, "accountId").toInt(), 1); |
| 314 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(get(model, 0, "serviceId").toString(), serviceId); |
| 315 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(get(model, 0, "authenticationMethod").toInt(), |
| 316 | authenticationMethod); |
| 317 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(get(model, 0, "settings").toMap(), settings); |
| 318 | QObjectcxx . . $ QObject# *account = getcxx . . $ ModuleTest#get(d014018e9b42c855).(model, 0, "account"cxx . . $ QString#QString(85c52e162fed56f9).).valuecxx . . $ QVariant#value(8f5363d873dd4781).<QObjectcxx . . $ QObject#*>(); |
| 319 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(account != 0); |
| 320 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(account->metaObject()->className(), "OnlineAccountsModule::Account"); |
| 321 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(account, |
| 322 | model->property("accountList").value<QList<QObject*> >().first()); |
| 323 | |
| 324 | QJSValuecxx . . $ QJSValue# service = getcxx . . $ ModuleTest#get(d014018e9b42c855).(model, 0, "service"cxx . . $ QString#QString(85c52e162fed56f9).).valuecxx . . $ QVariant#value(8f5363d873dd4781).<QJSValuecxx . . $ QJSValue#>(); |
| 325 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(service.isObject()); |
| 326 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(service.property("serviceId").toString(), serviceId); |
| 327 | |
| 328 | delete object; |
| 329 | } |
| 330 | |
| 331 | void ModuleTestcxx . . $ ModuleTest#::testModelFilters_datacxx . . $ ModuleTest#testModelFilters_data(49f6e7a06ebc5aa8).() |
| 332 | { |
| 333 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringcxx . . $ QString#>("reply"); |
| 334 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringcxx . . $ QString#>("filters"); |
| 335 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QListcxx . . $ QList#<int> >("expectedIds"); |
| 336 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringListcxx . . $ QStringList#>("expectedDisplayNames"); |
| 337 | |
| 338 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("no accounts") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 339 | "[]" <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 340 | "" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 341 | QListcxx . . $ QList#QList(ced63f7c635d850d).<int>(); |
| 342 | |
| 343 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("one account, no service filter") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 344 | "[(1, {'displayName': 'Tom', 'serviceId': 'Foo' })]" <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 345 | "" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 346 | (QListcxx . . $ QList#QList(ced63f7c635d850d).<int>() <<cxx . . $ QList#`operator<<`(309d1580d8f5dc58). 1); |
| 347 | |
| 348 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("one account, with service filter") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 349 | "[(1, {'displayName': 'Tom', 'serviceId': 'Foo' })]" <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 350 | "serviceId: \"bar\"" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 351 | QListcxx . . $ QList#QList(ced63f7c635d850d).<int>(); |
| 352 | } |
| 353 | |
| 354 | void ModuleTestcxx . . $ ModuleTest#::testModelFilterscxx . . $ ModuleTest#testModelFilters(49f6e7a06ebc5aa8).() |
| 355 | { |
| 356 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QString, reply); |
| 357 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QString, filters); |
| 358 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QList<int>, expectedIds); |
| 359 | |
| 360 | addGetAccountsMethodcxx . . $ ModuleTest#addGetAccountsMethod(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("ret = (%1, [])").argcxx . . $ QString#arg(bc823072288cbbb5).(reply)); |
| 361 | |
| 362 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 363 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 364 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import Lomiri.OnlineAccounts 2.0\n" |
| 365 | "AccountModel {\n" |
| 366 | " applicationId: \"foo\";" +cxx . . $ operator+(c76e440e68d4afec). filters.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).() +cxx . . $ operator+(8f17b704cda0d21f). "\n" |
| 367 | "}", |
| 368 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 369 | QObjectcxx . . $ QObject# *object = component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).(); |
| 370 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object != 0); |
| 371 | QAbstractListModelcxx . . $ QAbstractListModel# *model = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QAbstractListModelcxx . . $ QAbstractListModel#*>(object); |
| 372 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(model != 0); |
| 373 | |
| 374 | QTRY_COMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:185:9`!(model->property("count").toInt(), expectedIds.count()); |
| 375 | |
| 376 | QListcxx . . $ QList#<int> idscxx . . $ QList#QList(ced63f7c635d850d).; |
| 377 | QStringListcxx . . $ QStringList# displayNamescxx . . $ QStringList#QStringList(ced63f7c635d850d).; |
| 378 | for (int i = 0; i < expectedIds.countcxx . . $ QList#count(455f465bc33b4cdf).(); i++) { |
| 379 | ids.appendcxx . . $ QList#append(77d9f17553126ecb).(getcxx . . $ ModuleTest#get(d014018e9b42c855).(model, i, "accountId"cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).()); |
| 380 | } |
| 381 | |
| 382 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(ids, expectedIds); |
| 383 | |
| 384 | delete object; |
| 385 | } |
| 386 | |
| 387 | void ModuleTestcxx . . $ ModuleTest#::testModelChangescxx . . $ ModuleTest#testModelChanges(49f6e7a06ebc5aa8).() |
| 388 | { |
| 389 | addGetAccountsMethodcxx . . $ ModuleTest#addGetAccountsMethod(3520e46b33348bf6).("ret = ([], [])"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 390 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 391 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 392 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import Lomiri.OnlineAccounts 2.0\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 393 | "AccountModel { applicationId: \"foo\" }", |
| 394 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 395 | QObjectcxx . . $ QObject# *object = component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).(); |
| 396 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object != 0); |
| 397 | QAbstractListModelcxx . . $ QAbstractListModel# *model = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QAbstractListModelcxx . . $ QAbstractListModel#*>(object); |
| 398 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(model != 0); |
| 399 | |
| 400 | QTRY_COMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:185:9`!(object->property("ready").toBool(), true); |
| 401 | |
| 402 | QSignalSpycxx . . $ QSignalSpy# countChangedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(model, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(countChanged())); |
| 403 | QSignalSpycxx . . $ QSignalSpy# dataChangedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(model, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(dataChanged(const QModelIndex&, |
| 404 | const QModelIndex&))); |
| 405 | |
| 406 | QVariantMapcxx . . $ QVariantMap# changescxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 407 | changes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(ONLINE_ACCOUNTS_INFO_KEY_CHANGE_TYPEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:40:9`!, |
| 408 | uintcxx . . $ QVariant#QVariant(cb2f890c2fdad230).(ONLINE_ACCOUNTS_INFO_CHANGE_ENABLEDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:41:11`!)); |
| 409 | changes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(ONLINE_ACCOUNTS_INFO_KEY_DISPLAY_NAMEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:31:9`!, "John"cxx . . $ QVariant#QVariant(85c52e162fed56f9).); |
| 410 | changes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(ONLINE_ACCOUNTS_INFO_KEY_SERVICE_IDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:32:9`!, "coolService"cxx . . $ QVariant#QVariant(85c52e162fed56f9).); |
| 411 | emitAccountChangedcxx . . $ ModuleTest#emitAccountChanged(12ac1711c074ce7c).("coolService"cxx . . $ QString#QString(85c52e162fed56f9)., 5, changes); |
| 412 | |
| 413 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(countChanged.wait()); |
| 414 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(countChanged.count(), 1); |
| 415 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(dataChanged.count(), 0); |
| 416 | QTRY_COMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:185:9`!(model->rowCount(), 1); |
| 417 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->property("accountList").value<QObjectList>().count(), 1); |
| 418 | |
| 419 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(get(model, 0, "displayName").toString(), QString("John")); |
| 420 | QObjectcxx . . $ QObject# *account = |
| 421 | model->propertycxx . . $ QObject#property(950ff6813be46b58).("accountList").valuecxx . . $ QVariant#value(8f5363d873dd4781).<QObjectListcxx . . $ QObjectList#>().firstcxx . . $ QList#first(19b2b6f17af048b).(); |
| 422 | QSignalSpycxx . . $ QSignalSpy# accountChangedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(account, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(accountChanged())); |
| 423 | QSignalSpycxx . . $ QSignalSpy# validChangedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(account, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(validChanged())); |
| 424 | |
| 425 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(account); |
| 426 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(account->property("valid").toBool()); |
| 427 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(account->property("displayName").toString(), QString("John")); |
| 428 | |
| 429 | countChanged.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 430 | |
| 431 | // Change the display name |
| 432 | changes.clearcxx . . $ QMap#clear(49f6e7a06ebc5aa8).(); |
| 433 | changes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(ONLINE_ACCOUNTS_INFO_KEY_CHANGE_TYPEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:40:9`!, |
| 434 | uintcxx . . $ QVariant#QVariant(cb2f890c2fdad230).(ONLINE_ACCOUNTS_INFO_CHANGE_UPDATEDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:43:11`!)); |
| 435 | changes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(ONLINE_ACCOUNTS_INFO_KEY_DISPLAY_NAMEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:31:9`!, "Bob"cxx . . $ QVariant#QVariant(85c52e162fed56f9).); |
| 436 | changes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(ONLINE_ACCOUNTS_INFO_KEY_SERVICE_IDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:32:9`!, "coolService"cxx . . $ QVariant#QVariant(85c52e162fed56f9).); |
| 437 | emitAccountChangedcxx . . $ ModuleTest#emitAccountChanged(12ac1711c074ce7c).("coolService"cxx . . $ QString#QString(85c52e162fed56f9)., 5, changes); |
| 438 | |
| 439 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(dataChanged.wait()); |
| 440 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(dataChanged.count(), 1); |
| 441 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(countChanged.count(), 0); |
| 442 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(accountChanged.count(), 1); |
| 443 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(validChanged.count(), 0); |
| 444 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(get(model, 0, "displayName").toString(), QString("Bob")); |
| 445 | |
| 446 | dataChanged.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 447 | accountChanged.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 448 | |
| 449 | // disable the account |
| 450 | changes.clearcxx . . $ QMap#clear(49f6e7a06ebc5aa8).(); |
| 451 | changes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(ONLINE_ACCOUNTS_INFO_KEY_CHANGE_TYPEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:40:9`!, |
| 452 | uintcxx . . $ QVariant#QVariant(cb2f890c2fdad230).(ONLINE_ACCOUNTS_INFO_CHANGE_DISABLEDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:42:11`!)); |
| 453 | changes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(ONLINE_ACCOUNTS_INFO_KEY_DISPLAY_NAMEcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:31:9`!, "Bob"cxx . . $ QVariant#QVariant(85c52e162fed56f9).); |
| 454 | changes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(ONLINE_ACCOUNTS_INFO_KEY_SERVICE_IDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:32:9`!, "coolService"cxx . . $ QVariant#QVariant(85c52e162fed56f9).); |
| 455 | emitAccountChangedcxx . . $ ModuleTest#emitAccountChanged(12ac1711c074ce7c).("coolService"cxx . . $ QString#QString(85c52e162fed56f9)., 5, changes); |
| 456 | |
| 457 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(countChanged.wait()); |
| 458 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(countChanged.count(), 1); |
| 459 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(accountChanged.count(), 0); |
| 460 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(validChanged.count(), 1); |
| 461 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 0); |
| 462 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->property("accountList").value<QObjectList>().count(), 0); |
| 463 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(account->property("valid").toBool(), false); |
| 464 | |
| 465 | delete object; |
| 466 | } |
| 467 | |
| 468 | void ModuleTestcxx . . $ ModuleTest#::testModelRequestAccess_datacxx . . $ ModuleTest#testModelRequestAccess_data(49f6e7a06ebc5aa8).() |
| 469 | { |
| 470 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringcxx . . $ QString#>("reply"); |
| 471 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QVariantMapcxx . . $ QVariantMap#>("expectedAccessReply"); |
| 472 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QVariantMapcxx . . $ QVariantMap#>("expectedAuthenticationData"); |
| 473 | |
| 474 | QVariantMapcxx . . $ QVariantMap# accessReplycxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 475 | QVariantMapcxx . . $ QVariantMap# authenticationDatacxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 476 | accessReply[cxx . . $ QMap#`operator[]`(bbd415b616967878)."errorCode"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). 4cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).; |
| 477 | accessReply[cxx . . $ QMap#`operator[]`(bbd415b616967878)."errorText"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "('org.foo.bar', 'not foobarized')"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 478 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("dbus error") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 479 | "raise dbus.exceptions.DBusException('org.foo.bar', 'not foobarized')" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 480 | accessReply <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 481 | authenticationData; |
| 482 | |
| 483 | accessReply.clearcxx . . $ QMap#clear(49f6e7a06ebc5aa8).(); |
| 484 | accessReply[cxx . . $ QMap#`operator[]`(bbd415b616967878)."accountDisplayName"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "Bob"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 485 | authenticationData.clearcxx . . $ QMap#clear(49f6e7a06ebc5aa8).(); |
| 486 | authenticationData.insertcxx . . $ QMap#insert(929a1ed410fe8423).("AccessToken"cxx . . $ QString#QString(85c52e162fed56f9)., "GoOn"cxx . . $ QVariant#QVariant(85c52e162fed56f9).); |
| 487 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("access granted") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 488 | "ret = ((1, {'displayName': 'Bob', 'serviceId': 'bar'}),{'AccessToken':'GoOn'})" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 489 | accessReply <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 490 | authenticationData; |
| 491 | } |
| 492 | |
| 493 | void ModuleTestcxx . . $ ModuleTest#::testModelRequestAccesscxx . . $ ModuleTest#testModelRequestAccess(49f6e7a06ebc5aa8).() |
| 494 | { |
| 495 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QString, reply); |
| 496 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QVariantMap, expectedAccessReply); |
| 497 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QVariantMap, expectedAuthenticationData); |
| 498 | |
| 499 | addGetAccountsMethodcxx . . $ ModuleTest#addGetAccountsMethod(3520e46b33348bf6).("ret = ([(1, {'displayName': 'Tom', 'serviceId': 'Foo' })], [])"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 500 | addMockedMethodcxx . . $ ModuleTest#addMockedMethod(6d8ce341bc76c5ea).("RequestAccess"cxx . . $ QString#QString(85c52e162fed56f9)., "sa{sv}"cxx . . $ QString#QString(85c52e162fed56f9)., "(ua{sv})a{sv}"cxx . . $ QString#QString(85c52e162fed56f9)., reply); |
| 501 | |
| 502 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 503 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 504 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import Lomiri.OnlineAccounts 2.0\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 505 | "AccountModel {\n" |
| 506 | " applicationId: \"foo\"\n" |
| 507 | "}", |
| 508 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 509 | QObjectcxx . . $ QObject# *object = component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).(); |
| 510 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object != 0); |
| 511 | QAbstractListModelcxx . . $ QAbstractListModel# *model = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QAbstractListModelcxx . . $ QAbstractListModel#*>(object); |
| 512 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(model != 0); |
| 513 | |
| 514 | QSignalSpycxx . . $ QSignalSpy# accessReplySpycxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(model, |
| 515 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(accessReply(const QVariantMap&,const QVariantMap&))); |
| 516 | |
| 517 | |
| 518 | QStringcxx . . $ QString# serviceId = "bar"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 519 | QVariantMapcxx . . $ QVariantMap# paramscxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 520 | bool ok = QMetaObjectcxx . . $ QMetaObject#::invokeMethodcxx . . $ QMetaObject#invokeMethod(becc4544fd282fbb).(model, "requestAccess", |
| 521 | Q_ARGcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:279:9`!(QString, serviceId), |
| 522 | Q_ARGcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:279:9`!(QVariantMap, params)); |
| 523 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(ok); |
| 524 | |
| 525 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(accessReplySpy.wait()); |
| 526 | QVariantMapcxx . . $ QVariantMap# accessReply = accessReplySpy.atcxx . . $ QList#at(e2681f9bb6b2f357).(0).atcxx . . $ QList#at(e2681f9bb6b2f357).(0).toMapcxx . . $ QVariant#toMap(87f780dbe64191c4).(); |
| 527 | QVariantMapcxx . . $ QVariantMap# authenticationData = accessReplySpy.atcxx . . $ QList#at(e2681f9bb6b2f357).(0).atcxx . . $ QList#at(e2681f9bb6b2f357).(1).toMapcxx . . $ QVariant#toMap(87f780dbe64191c4).(); |
| 528 | |
| 529 | if (expectedAccessReply.containscxx . . $ QMap#contains(8877ebe272b9620d).("accountDisplayName"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 530 | QObjectcxx . . $ QObject# *account = accessReply[cxx . . $ QMap#`operator[]`(bbd415b616967878)."account"cxx . . $ QString#QString(85c52e162fed56f9).].valuecxx . . $ QVariant#value(8f5363d873dd4781).<QObjectcxx . . $ QObject#*>(); |
| 531 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(account != 0); |
| 532 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(account->metaObject()->className(), |
| 533 | "OnlineAccountsModule::Account"); |
| 534 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(account->property("displayName").toString(), |
| 535 | expectedAccessReply["accountDisplayName"].toString()); |
| 536 | } else { |
| 537 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(accessReply, expectedAccessReply); |
| 538 | } |
| 539 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(authenticationData, expectedAuthenticationData); |
| 540 | |
| 541 | delete object; |
| 542 | } |
| 543 | |
| 544 | void ModuleTestcxx . . $ ModuleTest#::testAccountAuthentication_datacxx . . $ ModuleTest#testAccountAuthentication_data(49f6e7a06ebc5aa8).() |
| 545 | { |
| 546 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<int>("authMethod"); |
| 547 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringcxx . . $ QString#>("reply"); |
| 548 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QVariantMapcxx . . $ QVariantMap#>("params"); |
| 549 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QVariantMapcxx . . $ QVariantMap#>("expectedAuthenticationData"); |
| 550 | |
| 551 | QVariantMapcxx . . $ QVariantMap# paramscxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 552 | QVariantMapcxx . . $ QVariantMap# authenticationDatacxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 553 | |
| 554 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."errorCode"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). 4cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).; |
| 555 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."errorText"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "not foobarized"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 556 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("random dbus error") <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 557 | ONLINE_ACCOUNTS_AUTH_METHOD_OAUTH1cxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:35:11`! <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 558 | "raise dbus.exceptions.DBusException('not foobarized', name='org.foo.bar')" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 559 | params <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 560 | authenticationData; |
| 561 | |
| 562 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."errorCode"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). 1cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).; |
| 563 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."errorText"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "Not there"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 564 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("no account") <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 565 | ONLINE_ACCOUNTS_AUTH_METHOD_OAUTH1cxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:35:11`! <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 566 | "raise dbus.exceptions.DBusException('Not there'," |
| 567 | "name='" ONLINE_ACCOUNTS_ERROR_NO_ACCOUNTcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:50:9`! "')" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 568 | params <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 569 | authenticationData; |
| 570 | |
| 571 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."errorCode"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). 3cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).; |
| 572 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."errorText"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "Sorry"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 573 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("user canceled") <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 574 | ONLINE_ACCOUNTS_AUTH_METHOD_OAUTH1cxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:35:11`! <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 575 | "raise dbus.exceptions.DBusException('Sorry'," |
| 576 | "name='" ONLINE_ACCOUNTS_ERROR_USER_CANCELEDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:52:9`! "')" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 577 | params <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 578 | authenticationData; |
| 579 | |
| 580 | params[cxx . . $ QMap#`operator[]`(bbd415b616967878)."ConsumerKey"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "aaaa"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 581 | params[cxx . . $ QMap#`operator[]`(bbd415b616967878)."ConsumerSecret"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "bbb"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 582 | authenticationData =cxx . . $ QMap#`operator=`(9a30e17cbbb0999d). params; |
| 583 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."Token"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "a token"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 584 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."TokenSecret"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "a token secret"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 585 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."SignatureMethod"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "PLAIN"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 586 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("oauth 1.0") <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 587 | ONLINE_ACCOUNTS_AUTH_METHOD_OAUTH1cxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:35:11`! <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 588 | "ret = {" |
| 589 | " 'ConsumerKey': args[4]['ConsumerKey']," |
| 590 | " 'ConsumerSecret': args[4]['ConsumerSecret']," |
| 591 | " 'Token': 'a token'," |
| 592 | " 'TokenSecret': 'a token secret'," |
| 593 | " 'SignatureMethod': 'PLAIN'," |
| 594 | "}" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 595 | params <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 596 | authenticationData; |
| 597 | |
| 598 | params.clearcxx . . $ QMap#clear(49f6e7a06ebc5aa8).(); |
| 599 | authenticationData.clearcxx . . $ QMap#clear(49f6e7a06ebc5aa8).(); |
| 600 | params[cxx . . $ QMap#`operator[]`(bbd415b616967878)."ClientId"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "aaaa"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 601 | params[cxx . . $ QMap#`operator[]`(bbd415b616967878)."ClientSecret"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "bbb"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 602 | params[cxx . . $ QMap#`operator[]`(bbd415b616967878)."Scopes"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). (cxx . . $ QVariant#QVariant(631c0101495f0328).QStringListcxx . . $ QStringList#QStringList(ced63f7c635d850d).() <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "one"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "two"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 603 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."AccessToken"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "my token"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 604 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."ExpiresIn"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). 3600cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).; |
| 605 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."GrantedScopes"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). (cxx . . $ QVariant#QVariant(631c0101495f0328).QStringListcxx . . $ QStringList#QStringList(ced63f7c635d850d).() <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "one"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "two"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 606 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("oauth 2.0") <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 607 | ONLINE_ACCOUNTS_AUTH_METHOD_OAUTH2cxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:36:11`! <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 608 | "ret = {" |
| 609 | " 'AccessToken': 'my token'," |
| 610 | " 'ExpiresIn': 3600," |
| 611 | " 'GrantedScopes': args[4]['Scopes']," |
| 612 | "}" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 613 | params <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 614 | authenticationData; |
| 615 | |
| 616 | params.clearcxx . . $ QMap#clear(49f6e7a06ebc5aa8).(); |
| 617 | authenticationData.clearcxx . . $ QMap#clear(49f6e7a06ebc5aa8).(); |
| 618 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."Username"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "admin"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 619 | authenticationData[cxx . . $ QMap#`operator[]`(bbd415b616967878)."Password"cxx . . $ QString#QString(85c52e162fed56f9).] =cxx . . $ QVariant#`operator=`(79a68221451e88b7). "rootme"cxx . . $ QVariant#QVariant(85c52e162fed56f9).; |
| 620 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("password") <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 621 | ONLINE_ACCOUNTS_AUTH_METHOD_PASSWORDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:37:11`! <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 622 | "ret = {" |
| 623 | " 'Username': 'admin'," |
| 624 | " 'Password': 'rootme'," |
| 625 | "}" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 626 | params <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 627 | authenticationData; |
| 628 | } |
| 629 | |
| 630 | void ModuleTestcxx . . $ ModuleTest#::testAccountAuthenticationcxx . . $ ModuleTest#testAccountAuthentication(49f6e7a06ebc5aa8).() |
| 631 | { |
| 632 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(int, authMethod); |
| 633 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QString, reply); |
| 634 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QVariantMap, params); |
| 635 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QVariantMap, expectedAuthenticationData); |
| 636 | |
| 637 | addGetAccountsMethodcxx . . $ ModuleTest#addGetAccountsMethod(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("ret = ([(1, {" |
| 638 | " 'displayName': 'Bob'," |
| 639 | " 'serviceId': 'MyService0'," |
| 640 | " 'authMethod': %1," |
| 641 | "})], [])").argcxx . . $ QString#arg(64ab2ed17cc11715).(authMethod)); |
| 642 | addMockedMethodcxx . . $ ModuleTest#addMockedMethod(6d8ce341bc76c5ea).("Authenticate"cxx . . $ QString#QString(85c52e162fed56f9)., "usbba{sv}"cxx . . $ QString#QString(85c52e162fed56f9)., "a{sv}"cxx . . $ QString#QString(85c52e162fed56f9)., reply); |
| 643 | |
| 644 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 645 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 646 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import Lomiri.OnlineAccounts 2.0\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 647 | "AccountModel {\n" |
| 648 | " applicationId: \"foo\"\n" |
| 649 | "}", |
| 650 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 651 | QObjectcxx . . $ QObject# *object = component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).(); |
| 652 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object != 0); |
| 653 | QAbstractListModelcxx . . $ QAbstractListModel# *model = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QAbstractListModelcxx . . $ QAbstractListModel#*>(object); |
| 654 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(model != 0); |
| 655 | |
| 656 | QTRY_COMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:185:9`!(model->rowCount(), 1); |
| 657 | |
| 658 | QObjectcxx . . $ QObject# *account = |
| 659 | model->propertycxx . . $ QObject#property(950ff6813be46b58).("accountList").valuecxx . . $ QVariant#value(8f5363d873dd4781).<QObjectListcxx . . $ QObjectList#>().firstcxx . . $ QList#first(19b2b6f17af048b).(); |
| 660 | QSignalSpycxx . . $ QSignalSpy# authenticationReplycxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(account, |
| 661 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(authenticationReply(const QVariantMap&))); |
| 662 | |
| 663 | bool ok = QMetaObjectcxx . . $ QMetaObject#::invokeMethodcxx . . $ QMetaObject#invokeMethod(becc4544fd282fbb).(account, "authenticate", |
| 664 | Q_ARGcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:279:9`!(QVariantMap, params)); |
| 665 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(ok); |
| 666 | |
| 667 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(authenticationReply.wait()); |
| 668 | QVariantMapcxx . . $ QVariantMap# authenticationData = authenticationReply.atcxx . . $ QList#at(e2681f9bb6b2f357).(0).atcxx . . $ QList#at(e2681f9bb6b2f357).(0).toMapcxx . . $ QVariant#toMap(87f780dbe64191c4).(); |
| 669 | |
| 670 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(authenticationData, expectedAuthenticationData); |
| 671 | |
| 672 | delete object; |
| 673 | } |
| 674 | |
| 675 | void ModuleTestcxx . . $ ModuleTest#::testInitialization_datacxx . . $ ModuleTest#testInitialization_data(49f6e7a06ebc5aa8).() |
| 676 | { |
| 677 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<QStringcxx . . $ QString#>("appId"); |
| 678 | QTestcxx . . $ QTest/::addColumncxx . . $ QTest/addColumn(cfe4d590606f2f46).<bool>("errorExpected"); |
| 679 | |
| 680 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("empty APP_ID") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 681 | "" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 682 | true; |
| 683 | |
| 684 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("invalid APP_ID") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 685 | "" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 686 | true; |
| 687 | |
| 688 | QTestcxx . . $ QTest/::newRowcxx . . $ QTest/newRow(71534bb7a360de38).("valid APP_ID") <<cxx . . $ `operator<<`(1c43a92f59c6a770). |
| 689 | "my.package_app_0.2" <<cxx . . $ `operator<<`(61fb880f51a53ddf). |
| 690 | false; |
| 691 | } |
| 692 | |
| 693 | void ModuleTestcxx . . $ ModuleTest#::testInitializationcxx . . $ ModuleTest#testInitialization(49f6e7a06ebc5aa8).() |
| 694 | { |
| 695 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(QString, appId); |
| 696 | QFETCHcxx . . $ `<external>/8602788698586413231/qtestcase.h:201:9`!(bool, errorExpected); |
| 697 | |
| 698 | qputenvcxx . . $ qputenv(d42e8231112a1b5b).("APP_ID", appId.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()); |
| 699 | |
| 700 | if (errorExpected) { |
| 701 | QTestcxx . . $ QTest/::ignoreMessagecxx . . $ QTest/ignoreMessage(f69cfd74466c3965).(QtWarningMsgcxx . . $ QtWarningMsg., |
| 702 | QRegularExpressioncxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).("Lomiri.OnlineAccounts:.*"cxx . . $ QString#QString(85c52e162fed56f9).)); |
| 703 | } |
| 704 | |
| 705 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 706 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 707 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import Lomiri.OnlineAccounts 2.0\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 708 | "AccountModel {}", |
| 709 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 710 | QObjectcxx . . $ QObject# *object = component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).(); |
| 711 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(object != 0); |
| 712 | |
| 713 | if (!errorExpected) { |
| 714 | /* We just want to check that invoking this method won't cause a crash */ |
| 715 | QStringcxx . . $ QString# serviceId = "bar"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 716 | QVariantMapcxx . . $ QVariantMap# paramscxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 717 | bool ok = QMetaObjectcxx . . $ QMetaObject#::invokeMethodcxx . . $ QMetaObject#invokeMethod(becc4544fd282fbb).(object, "requestAccess", |
| 718 | Q_ARGcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:279:9`!(QString, serviceId), |
| 719 | Q_ARGcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:279:9`!(QVariantMap, params)); |
| 720 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(ok); |
| 721 | } |
| 722 | delete object; |
| 723 | } |
| 724 | |
| 725 | QTEST_MAINcxx . . $ `<external>/4204159469433502174/qtest.h:508:9`!(ModuleTest) |
| 726 | #include "tst_qml_module.moc"cxx . . $ `<file>/build/tests/online-accounts/qml_module/tst_qml_module_autogen/include/tst_qml_module.moc`/ |