cmmanager/connection_settings_shim/tsrc/ut/testcmmgrshim.cpp
changeset 46 95d45f234cf3
parent 23 7ec726f93df1
--- a/cmmanager/connection_settings_shim/tsrc/ut/testcmmgrshim.cpp	Thu May 27 13:17:01 2010 +0300
+++ b/cmmanager/connection_settings_shim/tsrc/ut/testcmmgrshim.cpp	Wed Jun 23 18:39:24 2010 +0300
@@ -1063,6 +1063,63 @@
     delete dest;
 }
 
+/**
+ * Test case for setting and getting icon from CM Manager
+ * -Creates a legacy WLAN connection method (i.e. does not belong to
+ *  any destination).
+ * -Sets & Gets Icon
+ * -Creates destination
+ * -Sets & Gets Icon
+ * -Deletes the connection method. 
+ */
+void TestCmMgrShim::tcIconOperations()
+{
+    // Create the connection method
+    CmConnectionMethodShim *cm = mCmManagerShim->createConnectionMethod(
+        CMManagerShim::BearerTypeWlan);
+    QVERIFY(cm != NULL);
+    
+    // Update to CommsDat
+    cm->update();
+    
+    // Create a new destination
+    CmDestinationShim *dest;
+    dest = mCmManagerShim->createDestination("TestDestination");
+    QVERIFY(dest != NULL);
+       
+    // Update to CommsDat
+    dest->update();
+
+    // Set icon
+    QString testString("TestIconName");
+    cm->setIcon(testString);
+    
+    // Update to CommsDat
+    cm->update();
+    
+    // Set icon
+    dest->setIcon(testString);
+    
+    // Update to CommsDat
+    dest->update();
+     
+    // Check icon
+    QString resultString = cm->getIcon();
+    QCOMPARE(resultString, testString);
+
+    // Check destination icon
+    QString resultDestString = dest->getIcon();
+    QCOMPARE(resultDestString, testString);
+
+    // Delete the connection method
+    cm->deleteConnectionMethod();
+    delete cm;
+    
+    // Delete the destination
+    dest->deleteDestination();
+    delete dest;
+}
+
 // -----------------------------------------------------------------------------
 // SUB TEST CASES
 // -----------------------------------------------------------------------------