~ubuntu-branches/ubuntu/oneiric/dee/oneiric

« back to all changes in this revision

Viewing changes to tests/model-helper-clone3rows.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-06-07 11:11:12 UTC
  • Revision ID: james.westby@ubuntu.com-20100607111112-hfpzyhy4o0rhps5a
Tags: upstream-0.2.4
ImportĀ upstreamĀ versionĀ 0.2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2010 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License version 3 as 
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by
 
17
 *              Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
 
18
 *
 
19
 */
 
20
 
 
21
#include "config.h"
 
22
#include <glib.h>
 
23
#include <glib-object.h>
 
24
 
 
25
#include <gtx.h>
 
26
#include <dee.h>
 
27
 
 
28
/* Expects a clone with 3 rows in it */
 
29
gint
 
30
main (gint argc, gchar *argv[])
 
31
{
 
32
  DeeModel     *model;
 
33
  DeeModelIter *iter;
 
34
  
 
35
  g_type_init (); 
 
36
  g_thread_init (NULL);
 
37
  dbus_g_thread_init ();
 
38
 
 
39
  model = dee_shared_model_new_with_name (argv[1]);
 
40
  dee_shared_model_connect (DEE_SHARED_MODEL (model));
 
41
  
 
42
  if (gtx_wait_for_signal (G_OBJECT (model), 100000, "ready"))
 
43
    g_error ("Helper model timed out waiting for 'ready' signal");
 
44
 
 
45
  g_assert_cmpint (dee_model_get_n_rows (model), ==, 3);
 
46
 
 
47
  iter = dee_model_get_iter_at_row (model, 0);
 
48
  g_assert_cmpint (dee_model_get_int (model, iter, 0), == , 0);
 
49
  g_assert_cmpstr (dee_model_get_string (model, iter, 1), == , "zero");
 
50
 
 
51
  iter = dee_model_get_iter_at_row (model, 1);
 
52
  g_assert_cmpint (dee_model_get_int (model, iter, 0), == , 1);
 
53
  g_assert_cmpstr (dee_model_get_string (model, iter, 1), == , "one");
 
54
 
 
55
  iter = dee_model_get_iter_at_row (model, 2);
 
56
  g_assert_cmpint (dee_model_get_int (model, iter, 0), == , 2);
 
57
  g_assert_cmpstr (dee_model_get_string (model, iter, 1), == , "two");
 
58
  
 
59
  return 0;
 
60
}
 
 
b'\\ No newline at end of file'