| 1 | /* |
| 2 | * Copyright (C) 2013 Canonical Ltd. |
| 3 | * |
| 4 | * Contact: Alberto Mardegan <[email protected]> |
| 5 | * |
| 6 | * This file is part of lomiri-online-accounts-ui |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License version 3, as published |
| 10 | * 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 General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "access-model.h"cxx . . $ `<file>/online-accounts-ui/src/access-model.h`/ |
| 22 | #include <online-accounts-common/debug.h>cxx . . $ `<file>/online-accounts-common/debug.h`/ |
| 23 | |
| 24 | #include <Accounts/Account> |
| 25 | #include <Accounts/Manager> |
| 26 | #include <Accounts/Service> |
| 27 | #include <QDebug> |
| 28 | #include <QDir> |
| 29 | #include <QQmlComponent> |
| 30 | #include <QQmlContext> |
| 31 | #include <QQmlEngine> |
| 32 | #include <QSignalSpy> |
| 33 | #include <QTest> |
| 34 | |
| 35 | using namespace OnlineAccountsUi; |
| 36 | |
| 37 | class AccessModelTestcxx . . $ AccessModelTest#: public QObjectcxx . . $ QObject# |
| 38 | { |
| 39 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 40 | |
| 41 | public: |
| 42 | AccessModelTestcxx . . $ AccessModelTest#AccessModelTest(49f6e7a06ebc5aa8).(); |
| 43 | |
| 44 | private Q_SLOTScxx . . $ `<external>/1208926524888476972/qobjectdefs.h:92:10`!: |
| 45 | void initTestCasecxx . . $ AccessModelTest#initTestCase(49f6e7a06ebc5aa8).(); |
| 46 | void testEmptycxx . . $ AccessModelTest#testEmpty(49f6e7a06ebc5aa8).(); |
| 47 | void testProxycxx . . $ AccessModelTest#testProxy(49f6e7a06ebc5aa8).(); |
| 48 | void testEnablingcxx . . $ AccessModelTest#testEnabling(49f6e7a06ebc5aa8).(); |
| 49 | |
| 50 | private: |
| 51 | void clearDbcxx . . $ AccessModelTest#clearDb(49f6e7a06ebc5aa8).(); |
| 52 | }; |
| 53 | |
| 54 | AccessModelTestcxx . . $ AccessModelTest#::AccessModelTestcxx . . $ AccessModelTest#AccessModelTest(49f6e7a06ebc5aa8).(): |
| 55 | QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(0) |
| 56 | { |
| 57 | setLoggingLevelcxx . . $ setLoggingLevel(d4f767463ce0a6b3).(2); |
| 58 | } |
| 59 | |
| 60 | void AccessModelTestcxx . . $ AccessModelTest#::clearDbcxx . . $ AccessModelTest#clearDb(49f6e7a06ebc5aa8).() |
| 61 | { |
| 62 | QDircxx . . $ QDir# dbrootcxx . . $ QDir#QDir(3520e46b33348bf6).(QStringcxx . . $ QString#::fromLatin1cxx . . $ QString#fromLatin1(4e15edac36d215be).(qgetenvcxx . . $ qgetenv(531409eeffcde449).("ACCOUNTS"))); |
| 63 | dbroot.removecxx . . $ QDir#remove(e1defb592416720d).("accounts.db"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 64 | } |
| 65 | |
| 66 | void AccessModelTestcxx . . $ AccessModelTest#::initTestCasecxx . . $ AccessModelTest#initTestCase(49f6e7a06ebc5aa8).() |
| 67 | { |
| 68 | qputenvcxx . . $ qputenv(d42e8231112a1b5b).("ACCOUNTS", TMP_DIRcxx . . $ `<built-in>:486:9`! "/"); |
| 69 | qputenvcxx . . $ qputenv(d42e8231112a1b5b).("AG_APPLICATIONS", TEST_DATA_DIRcxx . . $ `<built-in>:485:9`!); |
| 70 | qputenvcxx . . $ qputenv(d42e8231112a1b5b).("AG_SERVICES", TEST_DATA_DIRcxx . . $ `<built-in>:485:9`!); |
| 71 | qputenvcxx . . $ qputenv(d42e8231112a1b5b).("AG_SERVICE_TYPES", TEST_DATA_DIRcxx . . $ `<built-in>:485:9`!); |
| 72 | qputenvcxx . . $ qputenv(d42e8231112a1b5b).("AG_PROVIDERS", TEST_DATA_DIRcxx . . $ `<built-in>:485:9`!); |
| 73 | qputenvcxx . . $ qputenv(d42e8231112a1b5b).("XDG_DATA_HOME", TEST_DATA_DIRcxx . . $ `<built-in>:485:9`!); |
| 74 | |
| 75 | /* Environment may be set up for i.e. SSO.OnlineAccounts import */ |
| 76 | QStringcxx . . $ QString# newImportPath = QLatin1Stringcxx . . $ QString#QString(4641beeb24e75d60).(PLUGIN_PATHcxx . . $ `<built-in>:476:9`!); |
| 77 | QStringcxx . . $ QString# oldImportPath = qgetenvcxx . . $ QString#QString(45672f3c6961a244).("QML2_IMPORT_PATH"); |
| 78 | if (!oldImportPath.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { |
| 79 | newImportPath +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!(":") +cxx . . $ operator+(fab9b4f80031f353). oldImportPath; |
| 80 | } |
| 81 | qputenvcxx . . $ qputenv(d42e8231112a1b5b).("QML2_IMPORT_PATH", newImportPath.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()); |
| 82 | |
| 83 | clearDbcxx . . $ AccessModelTest#clearDb(49f6e7a06ebc5aa8).(); |
| 84 | } |
| 85 | |
| 86 | void AccessModelTestcxx . . $ AccessModelTest#::testEmptycxx . . $ AccessModelTest#testEmpty(49f6e7a06ebc5aa8).() |
| 87 | { |
| 88 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 89 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 90 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import SSO.OnlineAccounts 0.1\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 91 | "AccountServiceModel {\n" |
| 92 | " provider: \"cool\"\n" |
| 93 | " service: \"global\"\n" |
| 94 | "}", |
| 95 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 96 | QAbstractListModelcxx . . $ QAbstractListModel# *accountModel = |
| 97 | qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QAbstractListModelcxx . . $ QAbstractListModel#*>(component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).()); |
| 98 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(accountModel != 0); |
| 99 | |
| 100 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(accountModel->property("count").toInt(), 0); |
| 101 | |
| 102 | /* Create the access model */ |
| 103 | AccessModelcxx . . $ OnlineAccountsUi/AccessModel# *model = new AccessModelcxx . . $ OnlineAccountsUi/AccessModel#(this); |
| 104 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(model != 0); |
| 105 | |
| 106 | QSignalSpycxx . . $ QSignalSpy# countChangedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(model, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(countChanged())); |
| 107 | QSignalSpycxx . . $ QSignalSpy# rowsInsertedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(model, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(rowsInserted(const QModelIndex&,int,int))); |
| 108 | QSignalSpycxx . . $ QSignalSpy# rowsRemovedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(model, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(rowsRemoved(const QModelIndex&,int,int))); |
| 109 | |
| 110 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->applicationId(), QString()); |
| 111 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(model->accountModel() == 0); |
| 112 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 0); |
| 113 | |
| 114 | model->setAccountModelcxx . . $ OnlineAccountsUi/AccessModel#setAccountModel(c6e1f1e42522b780).(accountModel); |
| 115 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 0); |
| 116 | |
| 117 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(countChanged.count(), 0); |
| 118 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsInserted.count(), 0); |
| 119 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsRemoved.count(), 0); |
| 120 | |
| 121 | delete model; |
| 122 | delete accountModel; |
| 123 | } |
| 124 | |
| 125 | void AccessModelTestcxx . . $ AccessModelTest#::testProxycxx . . $ AccessModelTest#testProxy(49f6e7a06ebc5aa8).() |
| 126 | { |
| 127 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 128 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 129 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import SSO.OnlineAccounts 0.1\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 130 | "AccountServiceModel {\n" |
| 131 | " provider: \"cool\"\n" |
| 132 | " service: \"global\"\n" |
| 133 | "}", |
| 134 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 135 | QAbstractListModelcxx . . $ QAbstractListModel# *accountModel = |
| 136 | qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QAbstractListModelcxx . . $ QAbstractListModel#*>(component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).()); |
| 137 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(accountModel != 0); |
| 138 | |
| 139 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(accountModel->property("count").toInt(), 0); |
| 140 | |
| 141 | /* Create the access model */ |
| 142 | AccessModelcxx . . $ OnlineAccountsUi/AccessModel# *model = new AccessModelcxx . . $ OnlineAccountsUi/AccessModel#(this); |
| 143 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(model != 0); |
| 144 | |
| 145 | model->setAccountModelcxx . . $ OnlineAccountsUi/AccessModel#setAccountModel(c6e1f1e42522b780).(accountModel); |
| 146 | model->setApplicationIdcxx . . $ OnlineAccountsUi/AccessModel#setApplicationId(3520e46b33348bf6).("mailer"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 147 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 0); |
| 148 | |
| 149 | /* Now add and remove accounts, and see that the accessModel picks them up */ |
| 150 | QSignalSpycxx . . $ QSignalSpy# rowsInsertedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(model, |
| 151 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(rowsInserted(const QModelIndex&,int,int))); |
| 152 | QSignalSpycxx . . $ QSignalSpy# rowsRemovedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(model, |
| 153 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(rowsRemoved(const QModelIndex&,int,int))); |
| 154 | |
| 155 | Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager# *manager = new Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager#(this); |
| 156 | Accountscxx . . $ Accounts/::Accountcxx . . $ Accounts/Account# *account1 = manager->createAccountcxx . . $ Accounts/Manager#createAccount(c883e1f1d6ec9995).("cool"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 157 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(account1 != 0); |
| 158 | account1->setEnabledcxx . . $ Accounts/Account#setEnabled(b45ddcbc8423892c).(true); |
| 159 | account1->setDisplayNamecxx . . $ Accounts/Account#setDisplayName(3520e46b33348bf6).("CoolAccount"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 160 | account1->syncAndBlockcxx . . $ Accounts/Account#syncAndBlock(c9857a73d68e59ba).(); |
| 161 | |
| 162 | rowsInserted.waitcxx . . $ QSignalSpy#wait(83c267b20bac841a).(); |
| 163 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 1); |
| 164 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsInserted.count(), 1); |
| 165 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsRemoved.count(), 0); |
| 166 | rowsInserted.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 167 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->get(0, "displayName").toString(), QString("CoolAccount")); |
| 168 | |
| 169 | /* Create a second account */ |
| 170 | Accountscxx . . $ Accounts/::Accountcxx . . $ Accounts/Account# *account2 = manager->createAccountcxx . . $ Accounts/Manager#createAccount(c883e1f1d6ec9995).("cool"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 171 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(account2 != 0); |
| 172 | account2->setEnabledcxx . . $ Accounts/Account#setEnabled(b45ddcbc8423892c).(true); |
| 173 | account2->setDisplayNamecxx . . $ Accounts/Account#setDisplayName(3520e46b33348bf6).("UncoolAccount"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 174 | account2->syncAndBlockcxx . . $ Accounts/Account#syncAndBlock(c9857a73d68e59ba).(); |
| 175 | |
| 176 | rowsInserted.waitcxx . . $ QSignalSpy#wait(83c267b20bac841a).(); |
| 177 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 2); |
| 178 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsInserted.count(), 1); |
| 179 | int row = rowsInserted.atcxx . . $ QList#at(e2681f9bb6b2f357).(0).atcxx . . $ QList#at(e2681f9bb6b2f357).(1).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 180 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsRemoved.count(), 0); |
| 181 | rowsInserted.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 182 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->get(row, "displayName").toString(), QString("UncoolAccount")); |
| 183 | |
| 184 | /* Delete the first account */ |
| 185 | account1->removecxx . . $ Accounts/Account#remove(49f6e7a06ebc5aa8).(); |
| 186 | account1->syncAndBlockcxx . . $ Accounts/Account#syncAndBlock(c9857a73d68e59ba).(); |
| 187 | rowsRemoved.waitcxx . . $ QSignalSpy#wait(83c267b20bac841a).(); |
| 188 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 1); |
| 189 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsInserted.count(), 0); |
| 190 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsRemoved.count(), 1); |
| 191 | rowsRemoved.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 192 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->get(0, "displayName").toString(), QString("UncoolAccount")); |
| 193 | |
| 194 | /* Delete also the second account */ |
| 195 | account2->removecxx . . $ Accounts/Account#remove(49f6e7a06ebc5aa8).(); |
| 196 | account2->syncAndBlockcxx . . $ Accounts/Account#syncAndBlock(c9857a73d68e59ba).(); |
| 197 | rowsRemoved.waitcxx . . $ QSignalSpy#wait(83c267b20bac841a).(); |
| 198 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 0); |
| 199 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsInserted.count(), 0); |
| 200 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsRemoved.count(), 1); |
| 201 | rowsRemoved.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 202 | |
| 203 | delete model; |
| 204 | delete accountModel; |
| 205 | } |
| 206 | |
| 207 | void AccessModelTestcxx . . $ AccessModelTest#::testEnablingcxx . . $ AccessModelTest#testEnabling(49f6e7a06ebc5aa8).() |
| 208 | { |
| 209 | QQmlEnginecxx . . $ QQmlEngine# enginecxx . . $ QQmlEngine#QQmlEngine(749de1b6ae65bddd).; |
| 210 | QQmlComponentcxx . . $ QQmlComponent# componentcxx . . $ QQmlComponent#QQmlComponent(1ee7362edd1472d8).(&engine); |
| 211 | component.setDatacxx . . $ QQmlComponent#setData(5306e72aa2a49a1c).("import SSO.OnlineAccounts 0.1\n"cxx . . $ QByteArray#QByteArray(34d26762b42c433a). |
| 212 | "AccountServiceModel {\n" |
| 213 | " provider: \"cool\"\n" |
| 214 | " service: \"global\"\n" |
| 215 | "}", |
| 216 | QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()); |
| 217 | QAbstractListModelcxx . . $ QAbstractListModel# *accountModel = |
| 218 | qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QAbstractListModelcxx . . $ QAbstractListModel#*>(component.createcxx . . $ QQmlComponent#create(1adc5df52fdd8588).()); |
| 219 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(accountModel != 0); |
| 220 | |
| 221 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(accountModel->property("count").toInt(), 0); |
| 222 | |
| 223 | /* Create the access model */ |
| 224 | AccessModelcxx . . $ OnlineAccountsUi/AccessModel# *model = new AccessModelcxx . . $ OnlineAccountsUi/AccessModel#(this); |
| 225 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(model != 0); |
| 226 | |
| 227 | model->setAccountModelcxx . . $ OnlineAccountsUi/AccessModel#setAccountModel(c6e1f1e42522b780).(accountModel); |
| 228 | model->setApplicationIdcxx . . $ OnlineAccountsUi/AccessModel#setApplicationId(3520e46b33348bf6).("mailer"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 229 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 0); |
| 230 | |
| 231 | /* Now add two accounts, but verify that the model should expose only the |
| 232 | * one which has at least one service disabled */ |
| 233 | QSignalSpycxx . . $ QSignalSpy# rowsInsertedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(model, |
| 234 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(rowsInserted(const QModelIndex&,int,int))); |
| 235 | QSignalSpycxx . . $ QSignalSpy# rowsRemovedcxx . . $ QSignalSpy#QSignalSpy(593025bf41bda872).(model, |
| 236 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(rowsRemoved(const QModelIndex&,int,int))); |
| 237 | |
| 238 | Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager# *manager = new Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager#(this); |
| 239 | Accountscxx . . $ Accounts/::Servicecxx . . $ Accounts/Service# coolMail = manager->servicecxx . . $ Accounts/Manager#service(5286df8bfd80fbad).("coolmail"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 240 | Accountscxx . . $ Accounts/::Servicecxx . . $ Accounts/Service# coolShare = manager->servicecxx . . $ Accounts/Manager#service(5286df8bfd80fbad).("coolshare"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 241 | Accountscxx . . $ Accounts/::Accountcxx . . $ Accounts/Account# *account1 = manager->createAccountcxx . . $ Accounts/Manager#createAccount(c883e1f1d6ec9995).("cool"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 242 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(account1 != 0); |
| 243 | account1->setEnabledcxx . . $ Accounts/Account#setEnabled(b45ddcbc8423892c).(true); |
| 244 | account1->setDisplayNamecxx . . $ Accounts/Account#setDisplayName(3520e46b33348bf6).("CoolAccount"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 245 | account1->selectServicecxx . . $ Accounts/Account#selectService(3151c7fcce91492).(coolMail); |
| 246 | account1->setEnabledcxx . . $ Accounts/Account#setEnabled(b45ddcbc8423892c).(true); |
| 247 | account1->syncAndBlockcxx . . $ Accounts/Account#syncAndBlock(c9857a73d68e59ba).(); |
| 248 | |
| 249 | rowsInserted.waitcxx . . $ QSignalSpy#wait(83c267b20bac841a).(); |
| 250 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 1); |
| 251 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsInserted.count(), 1); |
| 252 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsRemoved.count(), 0); |
| 253 | rowsInserted.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 254 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->get(0, "displayName").toString(), QString("CoolAccount")); |
| 255 | |
| 256 | /* Create a second account, enable all of its services */ |
| 257 | Accountscxx . . $ Accounts/::Accountcxx . . $ Accounts/Account# *account2 = manager->createAccountcxx . . $ Accounts/Manager#createAccount(c883e1f1d6ec9995).("cool"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 258 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(account2 != 0); |
| 259 | account2->setEnabledcxx . . $ Accounts/Account#setEnabled(b45ddcbc8423892c).(true); |
| 260 | account2->setDisplayNamecxx . . $ Accounts/Account#setDisplayName(3520e46b33348bf6).("UncoolAccount"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 261 | account2->selectServicecxx . . $ Accounts/Account#selectService(3151c7fcce91492).(coolMail); |
| 262 | account2->setEnabledcxx . . $ Accounts/Account#setEnabled(b45ddcbc8423892c).(true); |
| 263 | account2->selectServicecxx . . $ Accounts/Account#selectService(3151c7fcce91492).(coolShare); |
| 264 | account2->setEnabledcxx . . $ Accounts/Account#setEnabled(b45ddcbc8423892c).(true); |
| 265 | account2->syncAndBlockcxx . . $ Accounts/Account#syncAndBlock(c9857a73d68e59ba).(); |
| 266 | |
| 267 | /* Verify that a row is *not* added */ |
| 268 | QTestcxx . . $ QTest/::qWaitcxx . . $ QTest/qWait(d4f767463ce0a6b3).(50); |
| 269 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(model->rowCount(), 1); |
| 270 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsInserted.count(), 0); |
| 271 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(rowsRemoved.count(), 0); |
| 272 | rowsInserted.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 273 | |
| 274 | delete model; |
| 275 | delete accountModel; |
| 276 | } |
| 277 | |
| 278 | QTEST_MAINcxx . . $ `<external>/4204159469433502174/qtest.h:508:9`!(AccessModelTest); |
| 279 | |
| 280 | #include "tst_access_model.moc"cxx . . $ `<file>/build/tests/online-accounts-ui/tst_access_model/tst_access_model_autogen/include/tst_access_model.moc`/ |