Removed dead code from SimpleUI
[profile/tv/apps/web/browser.git] / unit_tests / ut_BookmarkItem.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #include <string>
18
19 #include <boost/test/unit_test.hpp>
20 #include <boost/any.hpp>
21
22 #include "BrowserLogger.h"
23 #include "BookmarkItem.h"
24 #include "BrowserImage.h"
25
26 BOOST_AUTO_TEST_SUITE(bookmark_item)
27
28 BOOST_AUTO_TEST_CASE(bookm_item_set_get)
29 {
30     BROWSER_LOGI("BOOKMARK_ITEM_TEST_CASE START --> ");
31     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
32     std::string retstr = "";
33     std::unique_ptr<tizen_browser::services::BookmarkItem>
34           bitem(new tizen_browser::services::BookmarkItem());
35
36     //Check empty address and title
37     bitem->setAddress("");
38     retstr= bitem->getAddress();
39     BOOST_CHECK_EQUAL("",retstr);
40     bitem->setTittle("");
41     retstr= bitem->getTittle();
42     BOOST_CHECK_EQUAL("",retstr);
43
44     //Check non empty address and title
45     bitem->setAddress("www.address.com");
46     retstr= bitem->getAddress();
47     BOOST_CHECK_EQUAL("www.address.com",retstr);
48     bitem->setTittle("Page Title");
49     retstr= bitem->getTittle();
50     BOOST_CHECK_EQUAL("Page Title",retstr);
51
52     //Check set/get id
53     bitem->setId(0);
54     BOOST_CHECK_EQUAL(0, bitem->getId());
55     bitem->setId(9999);
56     BOOST_CHECK_EQUAL(9999, bitem->getId());
57 }
58
59 BOOST_AUTO_TEST_CASE(bookm_item_favicon_thumb)
60 {
61     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
62     std::unique_ptr<tizen_browser::services::BookmarkItem>
63           bitem(new tizen_browser::services::BookmarkItem());
64     std::shared_ptr<tizen_browser::tools::BrowserImage> bimg
65           = std::make_shared<tizen_browser::tools::BrowserImage>();
66
67     bimg->width = 10;
68     bimg->height = 10;
69     bimg->dataSize = 500;
70
71     bitem->setFavicon(bimg);
72     BOOST_CHECK_EQUAL(10, bitem->getFavicon()->width);
73     BOOST_CHECK_EQUAL(10, bitem->getFavicon()->height);
74     BOOST_CHECK_EQUAL(500, bitem->getFavicon()->dataSize);
75
76     bitem->setThumbnail(bimg);
77     BOOST_CHECK_EQUAL(10, bitem->getThumbnail()->width);
78     BOOST_CHECK_EQUAL(10, bitem->getThumbnail()->height);
79     BOOST_CHECK_EQUAL(500, bitem->getThumbnail()->dataSize);
80
81     BROWSER_LOGI("<-- BOOKMARK_ITEM_TEST_CASE END");
82 }
83
84 BOOST_AUTO_TEST_SUITE_END()
85