~oem-solutions-group/unity-2d/clutter-1.0

« back to all changes in this revision

Viewing changes to tests/conform/test-model.c

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2010-03-21 13:27:56 UTC
  • mto: (2.1.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100321132756-nf8yd30yxo3zzwcm
Tags: upstream-1.2.2
ImportĀ upstreamĀ versionĀ 1.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
335
335
 
336
336
  g_object_unref (test_data.model);
337
337
}
 
338
 
 
339
void
 
340
test_list_model_from_script (TestConformSimpleFixture *fixture,
 
341
                             gconstpointer dummy)
 
342
{
 
343
  ClutterScript *script = clutter_script_new ();
 
344
  GObject *model;
 
345
  GError *error = NULL;
 
346
  gchar *test_file;
 
347
  const gchar *name;
 
348
  GType type;
 
349
 
 
350
  test_file = clutter_test_get_data_file ("test-script-model.json");
 
351
  clutter_script_load_from_file (script, test_file, &error);
 
352
  if (g_test_verbose () && error)
 
353
    g_print ("Error: %s", error->message);
 
354
 
 
355
#if GLIB_CHECK_VERSION (2, 20, 0)
 
356
  g_assert_no_error (error);
 
357
#else
 
358
  g_assert (error == NULL);
 
359
#endif /* GLIB_CHECK_VERSION (2, 20, 0) */
 
360
 
 
361
  model = clutter_script_get_object (script, "test-model");
 
362
 
 
363
  g_assert (CLUTTER_IS_MODEL (model));
 
364
  g_assert (clutter_model_get_n_columns (CLUTTER_MODEL (model)) == 3);
 
365
 
 
366
  name = clutter_model_get_column_name (CLUTTER_MODEL (model), 0);
 
367
  type = clutter_model_get_column_type (CLUTTER_MODEL (model), 0);
 
368
 
 
369
  if (g_test_verbose ())
 
370
    g_print ("column[0]: %s, type: %s\n", name, g_type_name (type));
 
371
 
 
372
  g_assert (strcmp (name, "text-column") == 0);
 
373
  g_assert (type == G_TYPE_STRING);
 
374
 
 
375
  name = clutter_model_get_column_name (CLUTTER_MODEL (model), 2);
 
376
  type = clutter_model_get_column_type (CLUTTER_MODEL (model), 2);
 
377
 
 
378
  if (g_test_verbose ())
 
379
    g_print ("column[2]: %s, type: %s\n", name, g_type_name (type));
 
380
 
 
381
  g_assert (strcmp (name, "actor-column") == 0);
 
382
  g_assert (type == CLUTTER_TYPE_RECTANGLE);
 
383
}