tests: add null ptr check on DSWaylandTizenInputDeviceManager-test 61/241861/1
authorSung-Jin Park <sj76.park@samsung.com>
Wed, 19 Aug 2020 06:39:40 +0000 (15:39 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 20 Aug 2020 10:12:19 +0000 (19:12 +0900)
Change-Id: Iaa26b683c3ed9e7798ad82dd9aedf0e73921b643
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
tests/DSWaylandTizenInputDeviceManager-test.cpp

index 8776e1c..aa437c7 100644 (file)
@@ -38,18 +38,38 @@ public:
 TEST_F(DSWaylandTizenInputDeviceManagerTest, NewDSWaylandTizenInputDeviceManager)
 {
        DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
-       DSWaylandTizenInputDeviceManager *inputDeviceManager = new DSWaylandTizenInputDeviceManager(compositor);
-       delete inputDeviceManager;
-       DSWaylandCompositor::releaseInstance();
-       EXPECT_TRUE(true);
+       EXPECT_TRUE(compositor != nullptr);
+
+       if (compositor)
+       {
+               DSWaylandTizenInputDeviceManager *inputDeviceManager = new DSWaylandTizenInputDeviceManager(compositor);
+               EXPECT_TRUE(inputDeviceManager != nullptr);
+
+               if (inputDeviceManager)
+                       delete inputDeviceManager;
+
+               DSWaylandCompositor::releaseInstance();
+       }
 }
 
 TEST_F(DSWaylandTizenInputDeviceManagerTest, getTizenInputDevice)
 {
        DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
-       DSWaylandTizenInputDeviceManager *inputDeviceManager = new DSWaylandTizenInputDeviceManager(compositor);
-       EXPECT_TRUE(inputDeviceManager->getTizenInputDevice());
-       delete inputDeviceManager;
-       DSWaylandCompositor::releaseInstance();
+       EXPECT_TRUE(compositor != nullptr);
+
+       if (compositor)
+       {
+               DSWaylandTizenInputDeviceManager *inputDeviceManager = new DSWaylandTizenInputDeviceManager(compositor);
+               EXPECT_TRUE(inputDeviceManager != nullptr);
+
+               if (inputDeviceManager)
+               {
+                       EXPECT_TRUE(inputDeviceManager->getTizenInputDevice());
+
+                       delete inputDeviceManager;
+               }
+
+               DSWaylandCompositor::releaseInstance();
+       }
 }