3 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * PROPRIETARY/CONFIDENTIAL
6 * This software is the confidential and proprietary information of SAMSUNG
7 * ELECTRONICS ("Confidential Information"). You agree and acknowledge that
8 * this software is owned by Samsung and you shall not disclose such
9 * Confidential Information and shall use it only in accordance with the terms
10 * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG
11 * make no representations or warranties about the suitability of the software,
12 * either express or implied, including but not limited to the implied
13 * warranties of merchantability, fitness for a particular purpose, or
14 * non-infringement. SAMSUNG shall not be liable for any damages suffered by
15 * licensee arising out of or related to this software.
22 #define API_NAME_HAPTIC_PLAY_FILE "haptic_vibrate_file"
23 #define API_NAME_PLAY_MONOTONE "haptic_vibrate_monotone"
24 #define API_NAME_STOP_PLAY "haptic_stop_device"
25 #define API_NAME_PLAY_PTN "haptic_play_pattern"
26 #define API_NAME_STOP_PTN "haptic_stop_pattern"
27 #define TEST_IVT "/usr/share/immersion/01_Touch/touch_20ms_sharp.ivt"
29 static void startup(void);
30 static void cleanup(void);
32 void (*tet_startup)(void) = startup;
33 void (*tet_cleanup)(void) = cleanup;
35 static void utc_system_haptic_vibrate_monotone_p(void);
36 static void utc_system_haptic_vibrate_monotone_n_1(void);
37 static void utc_system_haptic_vibrate_monotone_n_2(void);
38 static void utc_system_haptic_stop_device_p(void);
39 static void utc_system_haptic_stop_device_n(void);
41 static void utc_system_haptic_vibrate_p(void);
42 static void utc_system_haptic_vibrate_n(void);
44 static void utc_system_haptic_stop_pattern_p(void);
45 static void utc_system_haptic_stop_pattern_n(void);
48 POSITIVE_TC_IDX = 0x01,
52 struct tet_testlist tet_testlist[] = {
53 { utc_system_haptic_vibrate_monotone_p, POSITIVE_TC_IDX },
54 { utc_system_haptic_vibrate_monotone_n_1, NEGATIVE_TC_IDX },
55 { utc_system_haptic_vibrate_monotone_n_2, NEGATIVE_TC_IDX },
56 { utc_system_haptic_stop_device_p, POSITIVE_TC_IDX },
57 { utc_system_haptic_stop_device_n, NEGATIVE_TC_IDX },
58 { utc_system_haptic_vibrate_p, POSITIVE_TC_IDX},
59 { utc_system_haptic_vibrate_n, NEGATIVE_TC_IDX},
60 { utc_system_haptic_stop_pattern_p, POSITIVE_TC_IDX},
61 { utc_system_haptic_stop_pattern_n, NEGATIVE_TC_IDX},
66 static void startup(void)
68 int error = HAPTIC_ERROR_NONE;
70 error = haptic_initialize();
72 dts_check_eq("haptic_initialize", error, HAPTIC_ERROR_NONE, "fail initialize in startup");
75 static void cleanup(void)
77 int error = HAPTIC_ERROR_NONE;
79 error = haptic_deinitialize();
81 dts_check_eq("haptic_deinitialize", error, HAPTIC_ERROR_NONE, "fail deinitialize in startup");
86 * @brief Positive test case of haptic_vibrate_monotone()
88 static void utc_system_haptic_vibrate_monotone_p(void)
90 int error = HAPTIC_ERROR_NONE;
92 error = haptic_vibrate_monotone(0, 1000);
93 if(error != HAPTIC_ERROR_NONE)
94 dts_fail(API_NAME_PLAY_MONOTONE);
96 dts_pass(API_NAME_PLAY_MONOTONE);
100 * @brief Negative test case of haptic_vibrate_monotone()
102 static void utc_system_haptic_vibrate_monotone_n_1(void)
104 int error = HAPTIC_ERROR_NONE;
106 error = haptic_vibrate_monotone(-1, 1000);
107 if(error == HAPTIC_ERROR_NONE)
108 dts_fail(API_NAME_PLAY_MONOTONE);
110 dts_pass(API_NAME_PLAY_MONOTONE);
114 * @brief Negative test case of haptic_vibrate_monotone()
116 static void utc_system_haptic_vibrate_monotone_n_2(void)
118 int error = HAPTIC_ERROR_NONE;
120 error = haptic_vibrate_monotone(0, -1);
121 if(error == HAPTIC_ERROR_NONE)
122 dts_fail(API_NAME_PLAY_MONOTONE);
124 dts_pass(API_NAME_PLAY_MONOTONE);
129 * @brief Positive test case of haptic_stop_device()
131 static void utc_system_haptic_stop_device_p(void)
133 int error = HAPTIC_ERROR_NONE;
135 error = haptic_vibrate_monotone(0, 1000);
136 if(error != HAPTIC_ERROR_NONE)
137 dts_fail(API_NAME_STOP_PLAY);
139 error = haptic_stop_device(0);
140 if(error != HAPTIC_ERROR_NONE)
141 dts_fail(API_NAME_STOP_PLAY);
143 dts_pass(API_NAME_STOP_PLAY);
147 * @brief Negative test case of haptic_stop_device()
149 static void utc_system_haptic_stop_device_n(void)
151 int error = HAPTIC_ERROR_NONE;
153 error = haptic_stop_device(-1);
154 if(error == HAPTIC_ERROR_NONE)
155 dts_fail(API_NAME_STOP_PLAY);
157 dts_pass(API_NAME_STOP_PLAY);
160 static void utc_system_haptic_vibrate_p(void)
162 haptic_vibration_iter_s ptn[] = {
163 {0, HAPTIC_LEVEL_5, 500},
164 {0, HAPTIC_LEVEL_1, 500},
168 if(haptic_play_pattern(ptn, 2, 1, 0, &ptn_id) < 0){
169 dts_fail(API_NAME_PLAY_PTN);
171 dts_pass(API_NAME_PLAY_PTN);
175 static void utc_system_haptic_vibrate_n(void)
178 if(haptic_play_pattern(NULL, 7, 1, 0, &ptn_id) < 0){
179 dts_pass(API_NAME_PLAY_PTN);
181 dts_fail(API_NAME_PLAY_PTN);
185 static void utc_system_haptic_stop_pattern_p(void)
187 haptic_vibration_iter_s ptn[] = {
188 {0, HAPTIC_LEVEL_5, 500},
189 {0, HAPTIC_LEVEL_1, 500},
193 haptic_play_pattern(ptn, 2, 1, 0, &ptn_id);
195 int err = haptic_stop_pattern(ptn_id);
197 dts_fail(API_NAME_STOP_PTN);
200 dts_pass(API_NAME_STOP_PTN);
204 static void utc_system_haptic_stop_pattern_n(void)
206 int err = haptic_stop_pattern(-1);
208 dts_pass(API_NAME_STOP_PTN);
211 dts_fail(API_NAME_STOP_PTN);