glib/tests/app-name.c
changeset 50 79045913e4e9
child 72 403e7f6ed6c5
equal deleted inserted replaced
49:e5d77a29bdca 50:79045913e4e9
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #undef G_DISABLE_ASSERT
       
    17 #undef G_LOG_DOMAIN
       
    18 
       
    19 #include <glib.h>
       
    20 #include <errno.h>
       
    21 #define LOG_FILE "c:\\logs\\app_name_log.txt"
       
    22 #include "std_log_result.h"
       
    23 #define LOG_FILENAME_LINE __FILE__, __LINE__
       
    24 
       
    25 void create_xml(int result)
       
    26 {
       
    27     if(result)
       
    28         assert_failed = 1;
       
    29     
       
    30     testResultXml("app_name_log");
       
    31     close_log_file();
       
    32 }
       
    33 
       
    34 int main (int argc, char *argv[])
       
    35 {
       
    36     char appName[] = "TestApp";
       
    37     const char *retAppName;
       
    38     
       
    39     g_set_application_name(appName);
       
    40     
       
    41     retAppName = g_get_application_name();
       
    42 	
       
    43 	if(retAppName != NULL)
       
    44 	    {
       
    45         if(g_strcmp0(appName, retAppName) !=0 )
       
    46             {
       
    47             std_log(LOG_FILENAME_LINE, "g_get_application_name returned wrong name");
       
    48             assert_failed = 1;
       
    49             }
       
    50 	    }
       
    51 	else
       
    52 	    {
       
    53         std_log(LOG_FILENAME_LINE, "g_get_application_name returned NULL. errno  = %d", errno);
       
    54         assert_failed = 1;
       
    55 	    }
       
    56 	
       
    57 	g_free((void *)retAppName);
       
    58 	
       
    59 	if(assert_failed)
       
    60           std_log(LOG_FILENAME_LINE,"Test Failed");
       
    61     else
       
    62           std_log(LOG_FILENAME_LINE,"Test Successful");
       
    63 	
       
    64     create_xml(0);
       
    65 
       
    66 	return 0;
       
    67 }