|
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 |
|
18 #include <QtTest/QtTest> |
|
19 #include <qservicemanager.h> |
|
20 #include "t_tsservicesproviderconfig.h" |
|
21 #include "tsservicesproviderconfig.h" |
|
22 |
|
23 const char serviceFile [] = ":/t_tsservicesproviderconfig.xml"; |
|
24 const char serviceName [] = "TsTestModelPlugin"; |
|
25 void T_TsServiceProviderConfig::testConfig() |
|
26 { |
|
27 CTsServiceProviderConfig *cfg(0); |
|
28 |
|
29 //test doesnt install any plugin. number of services can be equal 0 |
|
30 cfg = CTsServiceProviderConfig::NewLC(); |
|
31 QVERIFY(0 <= cfg->count()); |
|
32 QVERIFY(checkInterfaces(*cfg)); |
|
33 CleanupStack::PopAndDestroy(cfg); |
|
34 |
|
35 //test install test plugin. number of services has to be bigger then 0 |
|
36 QTM_NAMESPACE::QServiceManager manager; |
|
37 manager.addService(serviceFile); |
|
38 cfg = CTsServiceProviderConfig::NewLC(); |
|
39 QVERIFY(0 < cfg->count()); |
|
40 QVERIFY(checkInterfaces(*cfg)); |
|
41 CleanupStack::PopAndDestroy(cfg); |
|
42 manager.removeService(serviceName); |
|
43 } |
|
44 |
|
45 bool T_TsServiceProviderConfig::checkInterfaces(const CTsServiceProviderConfig & cfg) |
|
46 { |
|
47 bool retVal(true); |
|
48 for(int iter(0); iter < cfg.count() && retVal; ++iter) { |
|
49 QObject* ptr = cfg.loadL(iter); |
|
50 retVal = (0 != ptr); |
|
51 delete ptr; |
|
52 } |
|
53 return retVal; |
|
54 } |
|
55 |
|
56 QTEST_MAIN(T_TsServiceProviderConfig) |