X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=tests%2Fcheck-hildon-note.c;h=1d4dc476e36419c60846cd0c7de23f533fd19a06;hb=363f803d7d98338324e35c9d789e80fa579f775e;hp=a5d9efb78b02e4091f9bd5655c93ea369408a021;hpb=371e26f2444facff4b31e3600b851487fe371373;p=hildon diff --git a/tests/check-hildon-note.c b/tests/check-hildon-note.c index a5d9efb..1d4dc47 100644 --- a/tests/check-hildon-note.c +++ b/tests/check-hildon-note.c @@ -1,11 +1,13 @@ /* - * Copyright (C) 2006 Nokia Corporation. + * This file is a part of hildon tests * - * Contact: Luc Pionchon + * Copyright (C) 2006, 2007 Nokia Corporation, all rights reserved. + * + * Contact: Michael Dominic Kostrzewa * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of + * as published by the Free Software Foundation; version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but @@ -25,8 +27,8 @@ #include #include #include "test_suites.h" -#include "hildon-window.h" -#include "hildon-note.h" +#include +#include /* -------------------- Fixtures -------------------- */ @@ -87,8 +89,8 @@ START_TEST (test_new_confirmation_regular) g_object_get_property(G_OBJECT (note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_CONFIRMATION_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_CONFIRMATION, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type); gtk_widget_destroy (GTK_WIDGET (note)); note=NULL; @@ -107,8 +109,8 @@ START_TEST (test_new_confirmation_regular) g_object_get_property(G_OBJECT (note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_unless( note_type == HILDON_NOTE_CONFIRMATION_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type); + fail_unless( note_type == HILDON_NOTE_TYPE_CONFIRMATION, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type); gtk_widget_destroy (GTK_WIDGET (note)); note=NULL; @@ -150,8 +152,8 @@ START_TEST (test_new_confirmation_invalid) g_object_get_property(G_OBJECT (invalid_note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_CONFIRMATION_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_CONFIRMATION, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type); gtk_widget_destroy (GTK_WIDGET (invalid_note)); invalid_note=NULL; @@ -199,8 +201,8 @@ START_TEST (test_new_information_regular) g_object_get_property(G_OBJECT (note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_INFORMATION_THEME_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_INFORMATION_THEME_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_INFORMATION_THEME, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_INFORMATION_THEME)",note_type); gtk_widget_destroy (GTK_WIDGET (note)); note=NULL; @@ -219,8 +221,8 @@ START_TEST (test_new_information_regular) g_object_get_property(G_OBJECT (note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_INFORMATION_THEME_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_INFORMATION_THEME_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_INFORMATION_THEME, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_INFORMATION_THEME)",note_type); gtk_widget_destroy (GTK_WIDGET (note)); note=NULL; @@ -262,8 +264,8 @@ START_TEST (test_new_information_invalid) g_object_get_property(G_OBJECT (invalid_note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_INFORMATION_THEME_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_INFORMATION_THEME_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_INFORMATION_THEME, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_INFORMATION_THEME)",note_type); gtk_widget_destroy (GTK_WIDGET (invalid_note)); invalid_note=NULL; @@ -278,11 +280,12 @@ START_TEST (test_new_information_invalid) } END_TEST +#ifndef HILDON_DISABLE_DEPRECATED /* ----- Test case for new_confirmation_with_icon_name -----*/ /** * Purpose: Check that note dialog is properly created with description regular values. * Cases considered: - * - Create new confirmation note with description set to TEST_STRING and icon name "qgn_list_cp_calibration". + * - Create new confirmation note with description set to TEST_STRING and icon name "control_calibration_target". * - Create new confirmation note with description set to "" and icon name NULL. * */ @@ -303,7 +306,7 @@ START_TEST (test_new_confirmation_with_icon_name_regular) /* Test 1: create new confirmation note with description set to TEST_STRING */ description = TEST_STRING; - icon_name="qgn_list_cp_calibration"; + icon_name="control_calibration_target"; note = HILDON_NOTE(hildon_note_new_confirmation_with_icon_name(n_window,description,icon_name)); fail_if(!HILDON_IS_NOTE(note), "hildon-note: Creation failed with hildon_note_new_confirmation_with_icon_name"); @@ -316,8 +319,8 @@ START_TEST (test_new_confirmation_with_icon_name_regular) g_object_get_property(G_OBJECT (note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_CONFIRMATION_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_CONFIRMATION, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type); g_object_get_property(G_OBJECT (note),"icon",&icon_name_value); ret_icon_name = g_value_get_string (&icon_name_value); @@ -343,8 +346,8 @@ START_TEST (test_new_confirmation_with_icon_name_regular) g_object_get_property(G_OBJECT (note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_CONFIRMATION_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_CONFIRMATION, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type); g_object_get_property(G_OBJECT (note),"icon",&icon_name_value); ret_icon_name = g_value_get_string (&icon_name_value); @@ -378,7 +381,7 @@ START_TEST (test_new_confirmation_with_icon_name_invalid) GValue icon_name_value={0, }; HildonNoteType note_type; HildonNote * invalid_note; - + g_value_init (&value, G_TYPE_STRING); g_value_init (&icon_name_value, G_TYPE_STRING); g_value_init (&enum_value, G_TYPE_INT); @@ -402,14 +405,14 @@ START_TEST (test_new_confirmation_with_icon_name_invalid) g_object_get_property(G_OBJECT (invalid_note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_CONFIRMATION_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_CONFIRMATION, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type); gtk_widget_destroy (GTK_WIDGET (invalid_note)); invalid_note=NULL; /* Test 2: create new confirmation note with description set to "NULL" */ - invalid_note = HILDON_NOTE(hildon_note_new_confirmation_with_icon_name(n_window,NULL,"qgn_list_cp_calibration")); + invalid_note = HILDON_NOTE(hildon_note_new_confirmation_with_icon_name(n_window,NULL,"control_calibration_target")); fail_if(HILDON_IS_NOTE(invalid_note), "hildon-note: Creation succeeded with hildon_note_new_confirmation_with_icon_name with message == NULL"); @@ -418,6 +421,7 @@ START_TEST (test_new_confirmation_with_icon_name_invalid) g_value_unset(&enum_value); } END_TEST +#endif /* ----- Test case for new_cancel_with_progress_bar -----*/ @@ -455,8 +459,8 @@ START_TEST (test_new_cancel_with_progress_bar_regular) g_object_get_property(G_OBJECT (note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_PROGRESSBAR_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_PROGRESSBAR_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_PROGRESSBAR, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_PROGRESSBAR)",note_type); gtk_widget_destroy (GTK_WIDGET (note)); note=NULL; @@ -481,8 +485,8 @@ START_TEST (test_new_cancel_with_progress_bar_regular) g_object_get_property(G_OBJECT (note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_PROGRESSBAR_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_PROGRESSBAR_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_PROGRESSBAR, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_PROGRESSBAR)",note_type); gtk_widget_destroy (GTK_WIDGET (progress_bar)); gtk_widget_destroy (GTK_WIDGET (note)); @@ -532,8 +536,8 @@ START_TEST (test_new_cancel_with_progress_bar_invalid) g_object_get_property(G_OBJECT (note),"note_type",&enum_value); note_type = g_value_get_int(&enum_value); - fail_if( note_type != HILDON_NOTE_PROGRESSBAR_TYPE, - "hildon-note: Type was not set property on creation (HILDON_NOTE_PROGRESSBAR_TYPE)",note_type); + fail_if( note_type != HILDON_NOTE_TYPE_PROGRESSBAR, + "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_PROGRESSBAR)",note_type); gtk_widget_destroy (GTK_WIDGET (note)); note=NULL; @@ -553,7 +557,9 @@ Suite *create_hildon_note_suite() /* Create test cases */ TCase *tc1 = tcase_create("new_confirmation"); +#ifndef HILDON_DISABLE_DEPRECATED TCase *tc2 = tcase_create("new_confirmation_with_icon_name"); +#endif TCase *tc3 = tcase_create("new_information"); TCase *tc4 = tcase_create("new_cancel_with_progress_bar"); @@ -563,11 +569,13 @@ Suite *create_hildon_note_suite() tcase_add_test(tc1, test_new_confirmation_invalid); suite_add_tcase (s, tc1); +#ifndef HILDON_DISABLE_DEPRECATED /* Create test case for hildon_note_new_confirmation_with_icon_name and add it to the suite */ tcase_add_checked_fixture(tc2, fx_setup_default_note, fx_teardown_default_note); tcase_add_test(tc2, test_new_confirmation_with_icon_name_regular); tcase_add_test(tc2, test_new_confirmation_with_icon_name_invalid); suite_add_tcase (s, tc2); +#endif /* Create test case for hildon_note_new_with_information and add it to the suite */ tcase_add_checked_fixture(tc3, fx_setup_default_note, fx_teardown_default_note);