1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the Qt Mobility Components. |
7 ** This file is part of the Qt Mobility Components. |
8 ** |
8 ** |
64 void allConfigurations(); |
64 void allConfigurations(); |
65 void defaultConfiguration(); |
65 void defaultConfiguration(); |
66 void configurationFromIdentifier(); |
66 void configurationFromIdentifier(); |
67 |
67 |
68 private: |
68 private: |
69 #ifdef Q_WS_MAEMO_6 |
69 #if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) |
70 Maemo::IAPConf *iapconf; |
70 Maemo::IAPConf *iapconf; |
71 Maemo::IAPConf *iapconf2; |
71 Maemo::IAPConf *iapconf2; |
72 Maemo::IAPConf *gprsiap; |
72 Maemo::IAPConf *gprsiap; |
73 #define MAX_IAPS 50 |
73 #define MAX_IAPS 50 |
74 Maemo::IAPConf *iaps[MAX_IAPS]; |
74 Maemo::IAPConf *iaps[MAX_IAPS]; |
76 #endif |
76 #endif |
77 }; |
77 }; |
78 |
78 |
79 void tst_QNetworkConfigurationManager::initTestCase() |
79 void tst_QNetworkConfigurationManager::initTestCase() |
80 { |
80 { |
81 #ifdef Q_WS_MAEMO_6 |
81 #if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) |
82 iapconf = new Maemo::IAPConf("007"); |
82 iapconf = new Maemo::IAPConf("007"); |
83 iapconf->setValue("ipv4_type", "AUTO"); |
83 iapconf->setValue("ipv4_type", "AUTO"); |
84 iapconf->setValue("wlan_wepkey1", "connt"); |
84 iapconf->setValue("wlan_wepkey1", "connt"); |
85 iapconf->setValue("wlan_wepdefkey", 1); |
85 iapconf->setValue("wlan_wepdefkey", 1); |
86 iapconf->setValue("wlan_ssid", QByteArray("JamesBond")); |
86 iapconf->setValue("wlan_ssid", QByteArray("JamesBond")); |
283 |
283 |
284 QList<QNetworkConfiguration> configs = manager.allConfigurations(); |
284 QList<QNetworkConfiguration> configs = manager.allConfigurations(); |
285 QNetworkConfiguration defaultConfig = manager.defaultConfiguration(); |
285 QNetworkConfiguration defaultConfig = manager.defaultConfiguration(); |
286 |
286 |
287 bool confirm = configs.contains(defaultConfig); |
287 bool confirm = configs.contains(defaultConfig); |
288 bool isUserChoice = (defaultConfig.type() == QNetworkConfiguration::UserChoice); |
288 |
289 |
289 if (defaultConfig.type() != QNetworkConfiguration::UserChoice) { |
290 //user choice config is not part of allConfigurations() |
|
291 QVERIFY(isUserChoice != confirm); |
|
292 if (!isUserChoice) { |
|
293 QVERIFY(confirm || !defaultConfig.isValid()); |
290 QVERIFY(confirm || !defaultConfig.isValid()); |
294 QVERIFY(!(confirm && !defaultConfig.isValid())); |
291 QVERIFY(!(confirm && !defaultConfig.isValid())); |
295 } else { |
292 } else { |
|
293 QVERIFY(!confirm); // user choice config is not part of allConfigurations() |
296 QVERIFY(defaultConfig.isValid()); |
294 QVERIFY(defaultConfig.isValid()); |
297 QCOMPARE(defaultConfig.name(), QString("UserChoice")); |
295 QCOMPARE(defaultConfig.name(), QString("UserChoice")); |
298 QCOMPARE(defaultConfig.children().count(), 0); |
296 QCOMPARE(defaultConfig.children().count(), 0); |
299 QVERIFY(!defaultConfig.isRoamingAvailable()); |
297 QVERIFY(!defaultConfig.isRoamingAvailable()); |
300 QCOMPARE(defaultConfig.state(), QNetworkConfiguration::Discovered); |
298 QCOMPARE(defaultConfig.state(), QNetworkConfiguration::Discovered); |