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.
5 #include <gmock/gmock.h>
7 #include "notification-ex/progress_item.h"
8 #include "notification-ex/item_inflator.h"
10 using namespace notification;
11 using namespace notification::item;
16 class ProgressItemTest : public ::testing::Test {
18 void SetUp() override {}
19 void TearDown() override {}
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());
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());
33 ASSERT_EQ(gen_progress->GetMin(), 1.0);
34 ASSERT_EQ(gen_progress->GetCurrent(), 10.0);
35 ASSERT_EQ(gen_progress->GetMax(), 100.0);