Add progress item implementation
[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::item;
11 using namespace std;
12
13 namespace {
14
15 class ProgressItemTest : public ::testing::Test {
16  protected:
17   void SetUp() override {}
18   void TearDown() override {}
19 };
20
21 TEST_F(ProgressItemTest, SerializeDeserializeGetTitle) {
22   ProgressItem item(1.0, 10.0, 100.0);
23   Bundle b = item.Serialize();
24   ItemFactory factory;
25   shared_ptr<AbstractItem> gen_item = ItemInflator::Create(factory, b);
26   ASSERT_EQ(gen_item.get()->GetType(), item.GetType());
27
28   ProgressItem* gen_progress = static_cast<ProgressItem*>(gen_item.get());
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