summaryrefslogtreecommitdiffstats
path: root/spec/eina_log_spec.rb
blob: 0f606b076f64880721c7ebcad07bc1e25edb2566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'efl/eina'
require 'efl/eina_log'
require './spec/helper'
#
describe Efl::EinaLog do
    before(:all) {
        Efl::Eina.init
        EinaLog = Efl::EinaLog
    }
    after(:all) {
        Efl::Eina.shutdown
    }
    #
    it "level set/get" do
        EinaLog.level_set 2
        EinaLog.level_get.should == 2
        EinaLog.level = 3
        EinaLog.level.should == 3
    end
    #
    it "color_disable set/get" do
        bool_check EinaLog, 'color_disable'
    end
    #
    it "file_disable set/get" do
        bool_check EinaLog, 'file_disable'
    end
    #
    it "function_disable set/get" do
        bool_check EinaLog, 'function_disable'
    end
    #
    it "abort_on_critical set/get" do
        bool_check EinaLog, 'abort_on_critical'
    end
    #
    it "abort_on_critical_level set/get" do
        EinaLog.abort_on_critical_level_set 2
        EinaLog.abort_on_critical_level_get.should == 2
        EinaLog.abort_on_critical_level = 3
        EinaLog.abort_on_critical_level.should == 3
    end
    #
    it "domain register, unregister, level set/get" do
        d = EinaLog.domain_register "mydom", EinaLog::COLOR_CYAN
        d.should > 0
        EinaLog.domain_level_set "mydom", 2
        EinaLog.domain_level_get("mydom").should == 2
        EinaLog.domain_registered_level_get(d).should == 2
        EinaLog.domain_level_set "mydom", 1
        EinaLog.domain_level_get("mydom").should == 1
        EinaLog.domain_registered_level_get(d).should == 1
        EinaLog.domain_unregister d
    end
    #
    it "treads enable check" do
        EinaLog.main_thread_check.should be_true
        EinaLog.threads_enable
    end
    # EAPI void eina_log_threads_enable(void);
    # EAPI void eina_log_print_cb_set(Eina_Log_Print_Cb cb, void *data);
    #
    # EAPI void eina_log_print(int domain, Eina_Log_Level level, const char *file, const char *function, int line, const char *fmt, ...);
    # EAPI void eina_log_vprint(int domain, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, va_list args);
    # EAPI void eina_log_print_cb_stdout(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args);
    # EAPI void eina_log_print_cb_stderr(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args);
    # EAPI void eina_log_print_cb_file(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args);
end