glib/tests/at-exit.c
changeset 72 403e7f6ed6c5
parent 50 79045913e4e9
equal deleted inserted replaced
71:28ccaba883f4 72:403e7f6ed6c5
    16 #undef G_DISABLE_ASSERT
    16 #undef G_DISABLE_ASSERT
    17 #undef G_LOG_DOMAIN
    17 #undef G_LOG_DOMAIN
    18 
    18 
    19 #include <glib.h>
    19 #include <glib.h>
    20 #include <errno.h>
    20 #include <errno.h>
    21 #define LOG_FILE "c:\\logs\\at_exit_log.txt"
    21 #include <sys/stat.h>
    22 #include "std_log_result.h"
    22 #include <glib/gprintf.h>
    23 #define LOG_FILENAME_LINE __FILE__, __LINE__
    23 #ifdef __SYMBIAN32__
    24 
    24 #include "mrt2_glib2_test.h"
    25 void create_xml(int result)
    25 #endif /*__SYMBIAN32__*/
    26 {
       
    27     if(result)
       
    28         assert_failed = 1;
       
    29     
       
    30     testResultXml("at_exit_log");
       
    31     close_log_file();
       
    32 }
       
    33 
    26 
    34 void on_exit()
    27 void on_exit()
    35     {
    28     {
    36     std_log(LOG_FILENAME_LINE,"Test Successful");
    29     g_print("Test at_exit Successful");
    37     create_xml(0);    
    30     #if __SYMBIAN32__
       
    31     testResultXml("at-exit");
       
    32     #endif /* EMULATOR */    
    38     }
    33     }
    39 
    34 
    40 int main (int argc, char *argv[])
    35 int main (int argc, char *argv[])
    41 {
    36 {
       
    37     #ifdef __SYMBIAN32__
       
    38     g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
       
    39     g_set_print_handler(mrtPrintHandler);
       
    40     #endif /*__SYMBIAN32__*/
       
    41     
       
    42     g_print("Test at_exit Start");
    42     g_atexit(on_exit);
    43     g_atexit(on_exit);
    43     std_log(LOG_FILENAME_LINE, "Test ll be considered failed if on_exit() is not called");
    44     g_print( "Test will be considered failed if on_exit() is not called");
    44     return 0;
    45     return 0;
    45 }
    46 }