2
* Copyright 2016 Canonical Ltd.
4
* This file is part of messaging-app.
6
* messaging-app is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* messaging-app is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
import Ubuntu.Test 0.1
22
import Ubuntu.Telephony 0.1
23
import Ubuntu.History 0.1
34
function findMessagingChild(name)
42
property string accountId: "ofono/ofono/account0"
43
property var emergencyNumbers: [ "444", "555"]
44
property int type: AccountEntry.PhoneAccount
45
property string displayName: "SIM 1"
46
property bool connected: true
47
property bool emergencyCallsAvailable: true
48
property bool active: true
49
property string networkName: "Network name"
50
property bool simLocked: false
51
property var addressableVCardFields: ["tel"]
56
property var activeAccounts: [testAccount]
57
property alias accounts: telepathyHelper.activeAccounts
58
property QtObject defaultMessagingAccount: null
59
function registerChannelObserver() {}
60
function unregisterChannelObserver() {}
61
function accountForId(accountId) {
62
for (var i in accounts) {
63
if (accounts[i].accountId == accountId) {
73
signal messageSent(string accountId, var participantIds, string text, var attachments, var properties)
74
function acknowledgeMessage(recipients, messageId, accountId) {
75
chatManager.messageAcknowledged(recipients, messageId, accountId)
77
function sendMessage(accountId, participantIds, text, attachments, properties) {
78
chatManager.messageSent(accountId, participantIds, text, attachments, properties)
81
function chatEntryForParticipants(accountId, participantIds) {
89
property string i18nDirectory: ""
90
source: '../../src/qml/messaging-app.qml'
96
signalName: "messageSent"
105
// we reimplement the function here and add a special
106
// case to deal with a null child without failing
107
function findChild(obj,objectName) {
108
var childs = new Array(0);
110
while (childs.length > 0) {
111
// this is the special case
116
if (childs[0].objectName == objectName) {
119
for (var i in childs[0].children) {
120
childs.push(childs[0].children[i])
133
function test_messageSentViaOnlySim() {
134
mainViewLoader.active = false
135
mainViewLoader.active = true
137
tryCompare(mainViewLoader.item, 'applicationActive', true)
139
mainViewLoader.item.startNewMessage()
140
waitForRendering(mainViewLoader.item)
142
var messagesView = findChild(mainViewLoader, "messagesPage")
143
var textArea = findChild(messagesView, "messageTextArea")
144
var contactSearchInput = findChild(messagesView, "contactSearchInput")
145
var sendButton = findChild(messagesView, "sendButton")
146
contactSearchInput.text = "123"
147
textArea.text = "test text"
148
// on vivid mouseClick() does not work here
150
tryCompare(messageSentSpy, 'count', 1)
151
tryCompare(testAccount, 'accountId', messageSentSpy.signalArguments[0][0])