2
* Copyright 2013 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
import Ubuntu.Test 1.0
20
import Ubuntu.Components 1.2
35
name: "AlarmModelStressTest"
40
signalName: "modelReset"
44
property string testAlarmMessage: "test_"
46
function createAlarm(pattern, idx) {
48
testAlarm.message = pattern + idx;
50
dt.setMinutes(dt.getMinutes() + 10);
52
modelSpy.signalName = "rowsInserted";
57
function clearTestAlarms(pattern) {
59
modelSpy.signalName = "rowsRemoved";
60
while (i < model.count) {
61
var alarm = model.get(i);
62
// this will fail if get() returns NULL
63
if (alarm.message.indexOf(pattern) == 0) {
74
// need to create a huge amount of alarms then cleanone part of it
75
function initTestCase() {
76
for (var i = 0; i < 20; i++) {
77
createAlarm(testAlarmMessage, i)
79
for (var i = 0; i < 40; i++) {
80
createAlarm("testAlarm_", i)
83
function cleanupTestCase() {
84
clearTestAlarms(testAlarmMessage);
87
function test_remove_alarms()
89
clearTestAlarms("testAlarm_");