bool utc_blink_ewk_base::CompareEvasImageWithResource(Evas_Object* image, const char* resource, int pixel_fuzziness) const
{
if (!image || !resource) {
- utc_message("[CompareEvasImageWithResource] :: both image and resource can't be NULL");
+ utc_warning("[CompareEvasImageWithResource] :: both image and resource can't be NULL");
return false;
}
std::string resource_absolute_path = GetResourcePath(resource);
if (resource_w != image_w || resource_h != image_h) {
evas_object_del(resource_image);
- utc_message("[CompareEvasImageWithResource] :: image size differs: %dx%d (image) vs %dx%d (resource)", image_w, image_h, resource_w, resource_h);
+ utc_warning("[CompareEvasImageWithResource] :: image size differs: %dx%d (image) vs %dx%d (resource)", image_w, image_h, resource_w, resource_h);
return false;
}
if (evas_object_image_colorspace_get(image) != evas_object_image_colorspace_get(resource_image)) {
evas_object_del(resource_image);
- utc_message("[CompareEvasImageWithResource] :: image colorspace differs");
+ utc_warning("[CompareEvasImageWithResource] :: image colorspace differs");
return false;
}
default:
evas_object_del(resource_image);
- utc_message("[CompareEvasImageWithResource] :: unsupported colorspace");
+ utc_warning("[CompareEvasImageWithResource] :: unsupported colorspace");
return false;
}
}
if (total_diff > pixel_fuzziness) {
- utc_message("[CompareEvasImageWithResource] :: maximum fuzziness (%d) exceeded at %d pixel: %d", pixel_fuzziness, i, total_diff);
+ utc_warning("[CompareEvasImageWithResource] :: maximum fuzziness (%d) exceeded at %d pixel: %d", pixel_fuzziness, i, total_diff);
retval = false;
for (int j = 0; j < bytes_per_pixel; ++j) {
- utc_message("image: 0x%2X resource: 0x%2X", image_data[i + j], resource_data[i + j]);
+ utc_info("image: 0x%2X resource: 0x%2X", image_data[i + j], resource_data[i + j]);
}
break;
{
std::string retval("file://");
retval.append(GetResourcePath(resource_path));
- utc_message("Resource:\t\"%s\"",retval.c_str());
+ utc_debug("Resource:\t\"%s\"",retval.c_str());
return retval;
}
if (!main_loop_running) {
main_loop_result = utc_blink_ewk_base::NoOp;
- utc_message("[EventLoopStart] :: timeout: %f", max_time);
+ utc_debug("[EventLoopStart] :: timeout: %f", max_time);
main_loop_running = true;
timeout = ecore_timer_add(max_time, timeout_cb, this);
ecore_main_loop_begin();
bool utc_blink_ewk_base::EventLoopWait(double time)
{
if (!main_loop_running) {
- utc_message("[EventLoopWait] :: time %f", time);
+ utc_debug("[EventLoopWait] :: time %f", time);
main_loop_running = true;
timeout = ecore_timer_add(time, timeout_cb_event_loop_wait, this);
bool utc_blink_ewk_base::EventLoopStop(utc_blink_ewk_base::MainLoopResult result)
{
if (main_loop_running && result != utc_blink_ewk_base::NoOp ) {
- utc_message("[EventLoopStop] :: Setting result to: %s", (result == utc_blink_ewk_base::Success ? "Success" : "Failure"));
+ utc_debug("[EventLoopStop] :: Setting result to: %s", (result == utc_blink_ewk_base::Success ? "Success" : "Failure"));
main_loop_running = false;
main_loop_result = result;
ecore_main_loop_quit();
void utc_blink_ewk_base::load_started_cb(void* data, Evas_Object* webview, void* event_info)
{
- utc_message("[load,started] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
+ utc_debug("[load,started] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
utc_blink_ewk_base *ut = static_cast<utc_blink_ewk_base*>(data);
ut->LoadStarted(webview);
}
void utc_blink_ewk_base::load_finished_cb(void* data, Evas_Object* webview, void* event_info)
{
- utc_message("[load,finished] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
+ utc_debug("[load,finished] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
utc_blink_ewk_base *ut = static_cast<utc_blink_ewk_base*>(data);
ut->LoadFinished(webview);
}
void utc_blink_ewk_base::load_error_cb(void* data, Evas_Object* webview, void* event_info)
{
- utc_message("[load,error] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
+ utc_debug("[load,error] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
utc_blink_ewk_base *ut = static_cast<utc_blink_ewk_base*>(data);
Ewk_Error *err = static_cast<Ewk_Error *>(event_info);
if(!ut->LoadError(webview, err)) {
- utc_message("[load,error] :: not handled by test, stopping main loop with Failure");
+ utc_warning("[load,error] :: not handled by test, stopping main loop with Failure");
ut->EventLoopStop(utc_blink_ewk_base::Failure);
}
}
void utc_blink_ewk_base::load_progress_cb(void* data, Evas_Object* webview, void* event_info)
{
- utc_message("[load,progress] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
+ utc_debug("[load,progress] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
double progress = -1.0;
if (event_info) {
progress = *((double*)event_info);
void utc_blink_ewk_base::load_progress_started_cb(void* data, Evas_Object* webview, void* event_info)
{
- utc_message("[load,progress,started] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
+ utc_debug("[load,progress,started] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
utc_blink_ewk_base *ut = static_cast<utc_blink_ewk_base*>(data);
ut->LoadProgressStarted(webview);
}
void utc_blink_ewk_base::load_progress_finished_cb(void* data, Evas_Object* webview, void* event_info)
{
- utc_message("[load,progress,finished] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
+ utc_debug("[load,progress,finished] :: data: %p, webview: %p, event_info: %p", data, webview, event_info);
utc_blink_ewk_base *ut = static_cast<utc_blink_ewk_base*>(data);
ut->LoadProgressFinished(webview);
}
{
EXPECT_EQ(ewk_webview, webview);
if (log_javascript)
- utc_message("JavaScript::console (%p):\t\"%s\"", webview, ewk_console_message_text_get(msg));
+ fprintf(stdout, "JavaScript::console (%p):\t\"%s\"", webview, ewk_console_message_text_get(msg));
}
void utc_blink_ewk_base::console_message_cb(utc_blink_ewk_base* owner, Evas_Object* webview, Ewk_Console_Message* console)
Eina_Bool utc_blink_ewk_base::timeout_cb(void *data)
{
- utc_message("[timeout] :: data: %p", data);
+ utc_debug("[timeout] :: data: %p", data);
utc_blink_ewk_base *ut = static_cast<utc_blink_ewk_base*>(data);
if (!ut->TimeOut()) {
- utc_message("[timeout] :: not handled by test, stopping main loop with Failure");
+ utc_warning("[timeout] :: not handled by test, stopping main loop with Failure");
ut->EventLoopStop(utc_blink_ewk_base::Timeout);
}
void utc_blink_ewk_base::EwkInit()
{
/* 1. Standard TETware test initialization message */
- utc_message("[[ TET_MSG ]]:: ============ Startup ============");
+ utc_info("[[ TET_MSG ]]:: ============ Startup ============");
ewk_window = elm_win_add(NULL, "TC Launcher", ELM_WIN_BASIC);
elm_win_title_set(ewk_window, "TC Launcher");
void utc_blink_ewk_base::EwkDeinit()
{
/* 1. Standard TETware test end/cleanup messages */
- utc_message("[[ TET_MSG ]]:: ============ Cleanup ============");
+ utc_info("[[ TET_MSG ]]:: ============ Cleanup ============");
/* 2. Freeing resources */
if (ewk_webview)
ewk_webview = NULL;
}
+void utc_log(UtcLogSeverity severity, const char* format, ...) {
+ static UtcLogSeverity minLogSeverity = -1;
+ if (minLogSeverity == -1) {
+ char *env_severity = getenv("UTC_MIN_LOG");
+ if (env_severity && !strcmp(env_severity, "DEBUG")) {
+ minLogSeverity = UTC_LOG_DEBUG;
+ } else if (env_severity && !strcmp(env_severity, "INFO")) {
+ minLogSeverity = UTC_LOG_INFO;
+ } else if (env_severity && !strcmp(env_severity, "WARNING")) {
+ minLogSeverity = UTC_LOG_WARNING;
+ } else if (env_severity && !strcmp(env_severity, "ERROR")) {
+ minLogSeverity = UTC_LOG_ERROR;
+ } else {
+ minLogSeverity = UTC_LOG_INFO;
+ }
+ }
+ if (minLogSeverity > severity)
+ return;
+
+ va_list arglist;
+ va_start(arglist, format);
+ vfprintf(stderr, format, arglist );
+ va_end(arglist);
+}