2 * This file is a part of hildon tests
4 * Copyright (C) 2006, 2007 Nokia Corporation, all rights reserved.
6 * Author: Luc Pionchon <luc.pionchon@nokia.com>
7 * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 gcc `pkg-config --cflags gtk+-2.0 hildon-libs` `pkg-config --libs gtk+-2.0 hildon-libs` \
29 -o tc_banner_truncate tc_banner_truncate.c && DISPLAY=:2 run-standalone.sh ./tc_banner_truncate 1
31 Usage 1: tc_banner_truncate <case #>
32 Usage 2: tc_banner_truncate <1|2|3> the string you like to be displayed
33 1 -> information banner
40 #include <hildon-widgets/hildon-banner.h>
42 #define WAIT g_timeout_add(3000, (GSourceFunc)(gtk_main_quit), NULL);
44 #define TC_INFO(string) hildon_banner_show_information(window, NULL, string); WAIT;
45 #define TC_ANIM(string) banner = hildon_banner_show_animation(NULL, NULL, string);
46 #define TC_PROG(string) banner = hildon_banner_show_progress (NULL, NULL, string);
48 static void get_argv_string(int argc, char ** argv, char *text);
50 int main(int argc, char **argv)
57 if(argc < 2){ fprintf(stderr, "Add case # as parameter.\n"); return 1;}
58 if(argc >= 2){ if(sscanf(argv[1], "%d", &n) == 0) n = 1;}
59 if(argc > 2){ get_argv_string(argc, argv, text);}
61 gtk_init(&argc, &argv);
63 window = gtk_dialog_new();
66 /* text is given in the command line */
68 case 1: TC_INFO(text); break;
69 case 2: TC_PROG(text); break;
70 case 3: TC_ANIM(text); break;
71 default:TC_INFO(text); break;
77 /* NOTE: comments (*) are given for 0.12.12, with default theme (orange)
78 * (*) "truncated", WRAPPED", etc.
81 case 0: TC_INFO(""); break;
82 case 1: TC_INFO("loading..."); break;
84 case 11: TC_INFO("mmmmmmmmmmmmmmmmmm m.." ); break; //1 line
85 case 12: TC_INFO("mmmmmmmmmmmmmmmmmm m..." ); break; //truncated
86 case 13: TC_INFO("mmmmmmmmmmmmmmmmmm m...." ); break; //truncated
87 case 14: TC_INFO("mmmmmmmmmmmmmmmmmm m....." ); break; //truncated
88 case 15: TC_INFO("mmmmmmmmmmmmmmmmmm m......" ); break; //truncated
89 case 16: TC_INFO("mmmmmmmmmmmmmmmmmm m......." ); break; //truncated
90 case 17: TC_INFO("mmmmmmmmmmmmmmmmmm m........" ); break; //truncated
91 case 18: TC_INFO("mmmmmmmmmmmmmmmmmm m........."); break; //WRAPPED
93 case 21: TC_INFO("maximum number of characters xxxxxxxx"); break; //WRAPPED
94 case 22: TC_INFO("maximum number of characters xxxxxxxi"); break; //truncated
96 case 23: TC_INFO("Maximum number of characters reache" ); break; //1 line
97 case 24: TC_INFO("Maximum number of characters reached" ); break; //truncated
98 case 25: TC_INFO("Maximum number of characters reached." ); break; //truncated
99 case 26: TC_INFO("Maximum number of characters reached " ); break; //truncated
100 case 27: TC_INFO("Maximum number of characters reached a"); break; //WRAPPED
102 /* progress banners */
103 case 101: TC_PROG("" ); break;
104 case 102: TC_PROG("hello" ); break;
105 case 103: TC_PROG("hello progress" ); break;
107 /* Bugzilla related TC */
108 case -1: case 25305: TC_INFO("Maximum number of characters reached"); break;
109 case -2: case 23430: TC_INFO("Unable to manage folders during searching"); break; //PASSED
110 case -3: case 26624: TC_ANIM("Connection Manager - Loading"); break;
111 case -4: case 26161: TC_ANIM("Painel de Controle - carregando"); break;
112 case -5: case 26203: TC_ANIM("Caricamento di Pannello di controllo"); break;
113 case -6: case 27875: TC_ANIM("Instant messaging - loading"); break;
114 case -7: case 28760: TC_ANIM("Teach Handwriting- Loading"); break;
116 /* word longer than max width */
117 case 201: TC_INFO("mmmmmmmmmmmmmmmmmmmmmmmmmmmmm 1 2 3 4"); break;
120 case 202: TC_INFO("Maximum number of characters reached osaidfh galds hgdslf helius grkdsz vfliesdfrjaesfrszri os o ozx oyli l ilij ero worjw aeowaijf osijf a jfaowijef aoweijf s faoij flsaijf sajfd oaijfe aosi e 1 2 3 4"); break; /* TRUNCATED after last 'e' */
123 /* TC for plain GTK (no theme) */
124 case -1031: TC_INFO("iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiil i."); break; //1 line
125 case -1032: TC_INFO("iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiil i."); break; //WRAPPED
127 case -1033: TC_INFO("mmmmmmmmmmmmmmmmmm m................................................i" ); break; //1 line
128 case -1034: TC_INFO("mmmmmmmmmmmmmmmmmm m.................................................i"); break; //WRAPPED
146 /* ############################################################################## */
147 /* ############################################################################## */
148 /* ############################################################################## */
150 static void get_argv_string(int argc, char ** argv, char *text){
154 for(i=2; i<argc; i++){
155 for(j=0; argv[i][j] != '\0'; j++){