Improve unit TCs
[platform/core/api/notification.git] / unittest / src / test_progress_item.cc
1 // Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
4
5 #include <gmock/gmock.h>
6
7 #include "notification-ex/progress_item.h"
8 #include "notification-ex/item_inflator.h"
9
10 using namespace notification;
11 using namespace notification::item;
12 using namespace std;
13
14 namespace {
15
16 class ProgressItemTest : public ::testing::Test {
17  protected:
18   void SetUp() override {}
19   void TearDown() override {}
20 };
21
22 TEST_F(ProgressItemTest, SerializeDeserializeGetTitle) {
23   ProgressItem item(1.0, 10.0, 100.0);
24   Bundle b = item.Serialize();
25   shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
26   ASSERT_EQ(gen_item->GetType(), item.GetType());
27
28   auto gen_progress = std::static_pointer_cast<ProgressItem>(gen_item);
29   ASSERT_EQ(item.GetCurrent(), gen_progress->GetCurrent());
30   ASSERT_EQ(item.GetMin(), gen_progress->GetMin());
31   ASSERT_EQ(item.GetMax(), gen_progress->GetMax());
32
33   ASSERT_EQ(gen_progress->GetMin(), 1.0);
34   ASSERT_EQ(gen_progress->GetCurrent(), 10.0);
35   ASSERT_EQ(gen_progress->GetMax(), 100.0);
36 }
37
38 }  // namespace