1 /**************************************************************************
3 * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
5 * Contact: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
6 * Contact: Andrii Sokolenko <a.sokolenko@samsung.com>
7 * Contact: Roman Marchenko <r.marchenko@samsung.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the
11 * "Software"), to deal in the Software without restriction, including
12 * without limitation the rights to use, copy, modify, merge, publish,
13 * distribute, sub license, and/or sell copies of the Software, and to
14 * permit persons to whom the Software is furnished to do so, subject to
15 * the following conditions:
17 * The above copyright notice and this permission notice (including the
18 * next paragraph) shall be included in all copies or substantial portions
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
24 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
25 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 **************************************************************************/
34 * 1. Test When there is no bufmgr.
37 TBMBufmgr::TBMBufmgr()
42 void TBMBufmgr::SetUp()
46 bufmgr = tbm_bufmgr_init(-1);
47 ASSERT_TRUE(bufmgr != NULL);
50 void TBMBufmgr::TearDown()
52 tbm_bufmgr_deinit(bufmgr);
54 ASSERT_TRUE(tbm_bufmgr_debug_get_ref_count() == 0);
59 /* tbm_bufmgr_get_capability() */
60 TEST_P(TBMBufmgr, BufmgrGetCapability)
62 unsigned int capability;
64 capability = tbm_bufmgr_get_capability(bufmgr);
65 EXPECT_NE(capability, TBM_BUFMGR_CAPABILITY_NONE);
68 TEST_P(TBMBufmgr, BufmgrGetCapabilityWithNullBufmgr)
70 unsigned int capability;
72 capability = tbm_bufmgr_get_capability(NULL);
73 EXPECT_EQ(capability, TBM_BUFMGR_CAPABILITY_NONE);
76 TEST_P(TBMBufmgr, BufmgrGetCapabilityWithWrongBufmgr)
78 tbm_bufmgr bufmgr = (tbm_bufmgr)UT_TBM_INVALID_VALUE;
79 unsigned int capability;
81 capability = tbm_bufmgr_get_capability(bufmgr);
82 EXPECT_EQ(capability, TBM_BUFMGR_CAPABILITY_NONE);
85 /* tbm_bufmgr_bind_native_display() */
86 #if 0 // TDDO:: fix the crash...
87 TEST_P(TBMBufmgr, BufmgrBindNativeDisplay)
90 void *native_display = (void *)UT_TBM_INVALID_VALUE;
92 ret = tbm_bufmgr_bind_native_display(bufmgr, native_display);
96 TEST_P(TBMBufmgr, BufmgrBindNativeDisplayWithNullBufmgr)
99 void *native_display = (void *)UT_TBM_INVALID_VALUE;
101 ret = tbm_bufmgr_bind_native_display(NULL, native_display);
105 TEST_P(TBMBufmgr, BufmgrBindNativeDisplayWithWrongBufmgr)
108 void *native_display = (void *)UT_TBM_INVALID_VALUE;
110 ret = tbm_bufmgr_bind_native_display(NULL, native_display);
115 /* tbm_bufmgr_set_bo_lock_type() */
116 TEST_P(TBMBufmgr, BufmgrSetBoLockType)
120 ret = tbm_bufmgr_set_bo_lock_type(bufmgr, TBM_BUFMGR_BO_LOCK_TYPE_NEVER);
121 ASSERT_TRUE(ret == 1);
122 ret = tbm_bufmgr_set_bo_lock_type(bufmgr, TBM_BUFMGR_BO_LOCK_TYPE_ONCE);
123 ASSERT_TRUE(ret == 1);
124 ret = tbm_bufmgr_set_bo_lock_type(bufmgr, TBM_BUFMGR_BO_LOCK_TYPE_ALWAYS);
125 ASSERT_TRUE(ret == 1);
128 TEST_P(TBMBufmgr, BufmgrSetBoLockTypeWithBufmgrParamTest)
130 tbm_bufmgr invalid_bufmgr;
133 ret = tbm_bufmgr_set_bo_lock_type(NULL, TBM_BUFMGR_BO_LOCK_TYPE_NEVER);
134 ASSERT_TRUE(ret == 0);
135 invalid_bufmgr = (tbm_bufmgr)UT_TBM_INVALID_VALUE;
136 ret = tbm_bufmgr_set_bo_lock_type(invalid_bufmgr, TBM_BUFMGR_BO_LOCK_TYPE_NEVER);
137 ASSERT_TRUE(ret == 0);
141 /* tbm_bufmgr_debug_show() */
142 /* tbm_bufmgr_debug_tbm_info_get() */
143 /* tbm_bufmgr_debug_trace() */
144 /* tbm_bufmgr_debug_dump_all() */
145 /* tbm_bufmgr_debug_queue_dump() */
146 /* tbm_bufmgr_debug_dump_set_scale() */
147 /* tbm_bufmgr_debug_get_ref_count */
149 INSTANTIATE_TEST_CASE_P(TBMBufmgrParams,
151 Combine(Bool(), Bool(), Values("none")));