|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #include <QtTest/QtTest> |
|
18 #include "tsserializeddataprovider.h" |
|
19 #include "t_tsmodel.h" |
|
20 #include "t_tsserializeddataprovider.h" |
|
21 |
|
22 void T_TsSerializedDataProvider::testModelDataChanged() |
|
23 { |
|
24 CTsSerializedDataProvider* provider(0); |
|
25 |
|
26 mNotifications = 0; |
|
27 provider = CTsSerializedDataProvider::NewL(*this); |
|
28 T_TsModel emptyModel(0); |
|
29 QVERIFY(0 == provider->Data().Length()); |
|
30 provider->dataChanged(emptyModel); |
|
31 QVERIFY(1 == mNotifications); |
|
32 QVERIFY(0 < provider->Data().Length()); |
|
33 delete provider; |
|
34 |
|
35 mNotifications = 0; |
|
36 provider = CTsSerializedDataProvider::NewL(*this); |
|
37 T_TsModel model(2); |
|
38 QVERIFY(0 == provider->Data().Length()); |
|
39 provider->dataChanged(model); |
|
40 QVERIFY(1 == mNotifications); |
|
41 QVERIFY(0 < provider->Data().Length()); |
|
42 delete provider; |
|
43 } |
|
44 |
|
45 void T_TsSerializedDataProvider::testItemDataChanged() |
|
46 { |
|
47 CTsSerializedDataProvider* provider(0); |
|
48 |
|
49 mNotifications = 0; |
|
50 provider = CTsSerializedDataProvider::NewL(*this); |
|
51 T_TsModel model(1); |
|
52 QVERIFY(0 == provider->Data().Length()); |
|
53 provider->dataChanged(model.itemL(0)); |
|
54 QVERIFY(0 == mNotifications); |
|
55 QVERIFY(0 == provider->Data().Length()); |
|
56 delete provider; |
|
57 } |
|
58 |
|
59 void T_TsSerializedDataProvider::DataChanged() |
|
60 { |
|
61 ++mNotifications; |
|
62 } |
|
63 |
|
64 QTEST_MAIN(T_TsSerializedDataProvider) |