~ubuntu-branches/ubuntu/natty/gedit/natty

« back to all changes in this revision

Viewing changes to tests/smart-converter.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-06-21 15:14:19 UTC
  • mfrom: (1.1.80 upstream)
  • Revision ID: james.westby@ubuntu.com-20100621151419-j79nqokj12vpw9u3
Tags: 2.30.3-0ubuntu1
* New upstream version
  - Misc bugfixes
  - Handle empty input gracefully (lp: #586848)
  - Translations update

Show diffs side-by-side

added added

removed removed

Lines of Context:
287
287
}
288
288
 
289
289
static void
 
290
test_empty ()
 
291
{
 
292
        const GeditEncoding *guessed;
 
293
        gchar *out;
 
294
        GSList *encodings = NULL;
 
295
 
 
296
        /* testing the case of an empty file and list of encodings with no
 
297
           utf-8. In this case, the smart converter cannot determine the right
 
298
           encoding (because there is no input), but should still default to
 
299
           utf-8 for the detection */
 
300
        encodings = g_slist_prepend (encodings, (gpointer)gedit_encoding_get_from_charset ("UTF-16"));
 
301
        encodings = g_slist_prepend (encodings, (gpointer)gedit_encoding_get_from_charset ("ISO-8859-15"));
 
302
 
 
303
        out = do_test ("", NULL, encodings, 0, &guessed);
 
304
 
 
305
        g_assert_cmpstr (out, ==, "");
 
306
 
 
307
        g_assert (guessed == gedit_encoding_get_utf8 ());
 
308
}
 
309
 
 
310
static void
290
311
test_guessed ()
291
312
{
292
313
        GSList *encs = NULL;
326
347
        g_test_add_func ("/smart-converter/utf8-utf8", test_utf8_utf8);
327
348
        //g_test_add_func ("/smart-converter/xxx-xxx", test_xxx_xxx);
328
349
        g_test_add_func ("/smart-converter/guessed", test_guessed);
 
350
        g_test_add_func ("/smart-converter/empty", test_empty);
329
351
 
330
352
        return g_test_run ();
331
353
}