From: DongGi jang Date: Wed, 22 Feb 2012 09:19:16 +0000 (+0900) Subject: Remove test codes X-Git-Tag: 2.0_alpha~4 X-Git-Url: http://review.tizen.org/git/?p=framework%2Fapi%2Fpower.git;a=commitdiff_plain;h=d06afe8254982951add0c6c9f2a0fc27db786b52 Remove test codes --- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100755 index a4f6272..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(fw_name "capi-system-power") -SET(fw_test "${fw_name}-test") - -INCLUDE(FindPkgConfig) -pkg_check_modules(${fw_test} REQUIRED glib-2.0 ${fw_name}) -FOREACH(flag ${${fw_test}_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall") - -#ADD_EXECUTABLE("system-sensor" system-sensor.c) -#TARGET_LINK_LIBRARIES("system-sensor" ${fw_name} ${${fw_test}_LDFLAGS}) - -aux_source_directory(. sources) -FOREACH(src ${sources}) - GET_FILENAME_COMPONENT(src_name ${src} NAME_WE) - MESSAGE("${src_name}") - ADD_EXECUTABLE(${src_name} ${src}) - TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS}) -ENDFOREACH() - -IF(UNIX) - -ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution) -ADD_CUSTOM_COMMAND( - DEPENDS clean - COMMENT "distribution clean" - COMMAND find - ARGS . - -not -name config.cmake -and \( - -name tester.c -or - -name Testing -or - -name CMakeFiles -or - -name cmake.depends -or - -name cmake.check_depends -or - -name CMakeCache.txt -or - -name cmake.check_cache -or - -name *.cmake -or - -name Makefile -or - -name core -or - -name core.* -or - -name gmon.out -or - -name install_manifest.txt -or - -name *.pc -or - -name *~ \) - | grep -v TC | xargs rm -rf - TARGET distclean - VERBATIM -) - -ENDIF(UNIX) diff --git a/test/observing.c b/test/observing.c deleted file mode 100644 index ce5cb39..0000000 --- a/test/observing.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * PROPRIETARY/CONFIDENTIAL - * - * This software is the confidential and proprietary information of SAMSUNG - * ELECTRONICS ("Confidential Information"). You agree and acknowledge that - * this software is owned by Samsung and you shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG - * make no representations or warranties about the suitability of the software, - * either express or implied, including but not limited to the implied - * warranties of merchantability, fitness for a particular purpose, or - * non-infringement. SAMSUNG shall not be liable for any damages suffered by - * licensee arising out of or related to this software. - * - */ - -#include -#include -#include -#include -#include - -static GMainLoop *mainloop; - -void power_cb(power_state_e state, void *ud) -{ - char* txt = (char*)ud; - printf("power state [%d] -- %s\n", state, txt); -} - -static void sig_quit(int signo) -{ - if(mainloop) - { - g_main_loop_quit(mainloop); - } -} - -static void errp(power_error_e e){ - switch(e){ - case POWER_ERROR_INVALID_PARAMETER: - printf("invalid parameter!\n"); - break; - case POWER_ERROR_IO_ERROR: - printf("operation failed!\n"); - break; - case POWER_ERROR_NONE: - printf("success!\n"); - break; - default: - printf("unknown!\n"); - } -} - -int main(int argc, char *argv[]) -{ - int err; - - signal(SIGINT, sig_quit); - signal(SIGTERM, sig_quit); - signal(SIGQUIT, sig_quit); - - mainloop = g_main_loop_new(NULL, FALSE); - - power_state_e state; - if( (state = power_get_state()) < 0){ - printf("power state return "); - errp(err); - } - printf("current state -> %d\n", state); - - if( (err=power_set_changed_cb(power_cb, "PIUS!!")) < 0){ - printf("set cb return "); - errp(err); - } - - g_main_loop_run(mainloop); - g_main_loop_unref(mainloop); - - if( (err=power_unset_changed_cb()) < 0){ - printf("unset cb return "); - errp(err); - } - - return 0; -} diff --git a/test/system-power.c b/test/system-power.c deleted file mode 100644 index 14adbb6..0000000 --- a/test/system-power.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * PROPRIETARY/CONFIDENTIAL - * - * This software is the confidential and proprietary information of SAMSUNG - * ELECTRONICS ("Confidential Information"). You agree and acknowledge that - * this software is owned by Samsung and you shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG - * make no representations or warranties about the suitability of the software, - * either express or implied, including but not limited to the implied - * warranties of merchantability, fitness for a particular purpose, or - * non-infringement. SAMSUNG shall not be liable for any damages suffered by - * licensee arising out of or related to this software. - * - */ - - -#include -#include -#include -#include -#include -#include - -char* sname[] = { - "Normal", - "Screen Dim", - "Screen Off" -}; - -static void lock(int state) -{ - int err; - err = power_lock_state(state, 0); - if(err == POWER_ERROR_NONE){ - if(state >= POWER_STATE_NORMAL && state <= POWER_STATE_SCREEN_OFF) - printf("lock state [%s] locked\n", sname[state]); - else - printf("unknown state\n"); - }else{ - printf("power_lock_state fail\n"); - } -} - -static void unlock(int state) -{ - if(power_unlock_state(state) == POWER_ERROR_NONE){ - if(state >= POWER_STATE_NORMAL && state <= POWER_STATE_SCREEN_OFF) - printf("lock state [%s] unlocked\n", sname[state]); - else - printf("unknown state\n"); - }else{ - printf("power_unlock_state fail\n"); - } -} - -static void to_use(int state, int sleeptime) -{ - lock(state); - sleep(sleeptime); - unlock(state); -} - -static void pulse(int sleeptime) -{ - - power_lock_state(POWER_STATE_SCREEN_DIM, 1000); - power_lock_state(POWER_STATE_SCREEN_OFF, 10000); - power_lock_state(POWER_STATE_SCREEN_DIM, 1000); - power_lock_state(POWER_STATE_NORMAL, 1000); - - printf("pulse~~~\n"); - sleep(sleeptime); -} - -int main(int argc, char *argv[]) -{ - int m; - int state; - int sleeptime; - - if(argc < 3){ - printf("1 : Normal\n"); - printf("2 : Screen Dim\n"); - printf("3 : Screen Off\n"); - printf("4 : pulse test\n"); - return 0; - }else{ - switch(m = atoi(argv[1])) - { - case 1: - state = POWER_STATE_NORMAL; - printf("normal!!!\n"); - break; - case 2: - state = POWER_STATE_SCREEN_DIM; - printf("dim!!!\n"); - break; - case 3: - state = POWER_STATE_SCREEN_OFF; - printf("off!!!\n"); - break; - case 4: - break; - default: - return 0; - } - sleeptime = atoi(argv[2]); - if (m < 4){ - printf("to_use\n"); - to_use(state, sleeptime); - }else{ - printf("pulse\n"); - pulse(sleeptime); - } - } - - return 0; -}