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 tizen_base;
24 using namespace notification;
25 using namespace notification::item;
29 class EntryItemTest : public ::testing::Test {
31 virtual void SetUp() {}
32 virtual void TearDown() {}
35 TEST_F(EntryItemTest, FindByID) {
36 EntryItem item("entry_id");
38 AbstractItem& child = item.FindByID("entry_id");
39 EntryItem& btn = static_cast<EntryItem&>(child);
40 ASSERT_EQ(btn.GetId(), "entry_id");
43 TEST_F(EntryItemTest, FindByIDNullItemReturn) {
44 EntryItem item("entry_id");
46 AbstractItem& child = item.FindByID("not_existed_item");
47 ASSERT_EQ(child.GetType(), EntryItem::NullObject);
50 TEST_F(EntryItemTest, SerializeDeserialize) {
51 EntryItem item("entry_id");
53 Bundle b = item.Serialize();
54 std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
55 ASSERT_EQ(gen_item->GetType(), item.GetType());
57 auto gen_effect = std::static_pointer_cast<EntryItem>(gen_item);
58 ASSERT_EQ(item.GetId(), gen_effect->GetId());
61 TEST_F(EntryItemTest, SetTextGetText) {
62 EntryItem item("entry_id");
65 ASSERT_EQ(item.GetText(), "test");
68 TEST_F(EntryItemTest, GetTextLimit) {
69 EntryItem item("entry_id");
71 ASSERT_EQ(item.GetTextLimit(), 160);