2 * Copyright (c) 2014 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.
19 #include <boost/test/unit_test.hpp>
20 #include <boost/any.hpp>
22 #include "BrowserLogger.h"
23 #include "BookmarkItem.h"
24 #include "BrowserImage.h"
26 BOOST_AUTO_TEST_SUITE(bookmark_item)
28 BOOST_AUTO_TEST_CASE(bookm_item_set_get)
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());
36 //Check empty address and title
37 bitem->setAddress("");
38 retstr= bitem->getAddress();
39 BOOST_CHECK_EQUAL("",retstr);
41 retstr= bitem->getTittle();
42 BOOST_CHECK_EQUAL("",retstr);
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);
54 BOOST_CHECK_EQUAL(0, bitem->getId());
56 BOOST_CHECK_EQUAL(9999, bitem->getId());
59 BOOST_AUTO_TEST_CASE(bookm_item_favicon_thumb)
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>();
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);
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);
81 BROWSER_LOGI("<-- BOOKMARK_ITEM_TEST_CASE END");
84 BOOST_AUTO_TEST_SUITE_END()