2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <gtest/gtest.h>
18 #include <gmock/gmock.h>
20 #include "notification-ex/entry_item.h"
21 #include "notification-ex/item_inflator.h"
23 using namespace notification;
24 using namespace notification::item;
28 class EntryItemTest : public ::testing::Test {
30 virtual void SetUp() {}
31 virtual void TearDown() {}
34 TEST_F(EntryItemTest, FindByID) {
35 EntryItem item("entry_id");
37 AbstractItem& child = item.FindByID("entry_id");
38 EntryItem& btn = static_cast<EntryItem&>(child);
39 ASSERT_EQ(btn.GetId(), "entry_id");
42 TEST_F(EntryItemTest, FindByIDNullItemReturn) {
43 EntryItem item("entry_id");
45 AbstractItem& child = item.FindByID("not_existed_item");
46 ASSERT_EQ(child.GetType(), EntryItem::NullObject);
49 TEST_F(EntryItemTest, SerializeDeserialize) {
50 EntryItem item("entry_id");
51 Bundle b = item.Serialize();
52 std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
53 ASSERT_EQ(gen_item->GetType(), item.GetType());
55 auto gen_effect = std::static_pointer_cast<EntryItem>(gen_item);
56 ASSERT_EQ(item.GetId(), gen_effect->GetId());
59 TEST_F(EntryItemTest, SetTextGetText) {
60 EntryItem item("entry_id");
63 ASSERT_EQ(item.GetText(), "test");
66 TEST_F(EntryItemTest, GetTextLimit) {
67 EntryItem item("entry_id");
69 ASSERT_EQ(item.GetTextLimit(), 160);