~ubuntu-branches/ubuntu/trusty/gstreamer1.0/trusty

« back to all changes in this revision

Viewing changes to tests/check/gst/gstclock.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2012-08-08 18:12:33 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120808181233-riejwxprfsxh1njl
Tags: 0.11.93-1
* New upstream release:
  + debian/libgstreamer.symbols:
    - Update symbols file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include <gst/check/gstcheck.h>
21
21
 
22
 
static void
23
 
weak_notify (gpointer data, GObject * object)
24
 
{
25
 
  *(gboolean *) data = FALSE;
26
 
}
 
22
typedef struct
 
23
{
 
24
  GstClock parent;
 
25
} GstTestClock;
 
26
 
 
27
typedef struct
 
28
{
 
29
  GstClockClass parent_class;
 
30
} GstTestClockClass;
 
31
 
 
32
#define GST_TYPE_TEST_CLOCK                   (gst_test_clock_get_type ())
 
33
#define GST_TEST_CLOCK(obj)                   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TEST_CLOCK, GstTestClock))
 
34
#define GST_TEST_CLOCK_CAST(obj)              ((GstTestClock *)(obj))
 
35
#define GST_IS_TEST_CLOCK(obj)                (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TEST_CLOCK))
 
36
#define GST_TEST_CLOCK_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TEST_CLOCK, GstTestClockClass))
 
37
#define GST_IS_TEST_CLOCK_CLASS(klass)        (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TEST_CLOCK))
 
38
#define GST_TEST_CLOCK_GET_CLASS(obj)         (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TEST_CLOCK, GstTestClockClass))
 
39
 
 
40
 
 
41
GType gst_test_clock_get_type (void);
 
42
G_DEFINE_TYPE (GstTestClock, gst_test_clock, GST_TYPE_CLOCK);
27
43
 
28
44
static GstClockReturn
29
45
fake_wait_async (GstClock * clock, GstClockEntry * entry)
31
47
  return GST_CLOCK_OK;
32
48
}
33
49
 
 
50
static void
 
51
gst_test_clock_class_init (GstTestClockClass * klass)
 
52
{
 
53
  GstClockClass *clock_class;
 
54
 
 
55
  clock_class = GST_CLOCK_CLASS (klass);
 
56
 
 
57
  clock_class->wait_async = fake_wait_async;
 
58
}
 
59
 
 
60
static void
 
61
gst_test_clock_init (GstTestClock * clock)
 
62
{
 
63
}
 
64
 
 
65
 
 
66
static void
 
67
weak_notify (gpointer data, GObject * object)
 
68
{
 
69
  *(gboolean *) data = FALSE;
 
70
}
 
71
 
34
72
GST_START_TEST (test_set_master_refcount)
35
73
{
36
74
  GstClock *master, *slave;
37
 
  GstClockClass *klass;
38
75
  gboolean master_alive = TRUE;
39
76
 
40
77
  /* create master and slave */
41
 
  master = g_object_new (GST_TYPE_CLOCK, "name", "TestClockMaster", NULL);
42
 
  slave = g_object_new (GST_TYPE_CLOCK, "name", "TestClockMaster", NULL);
 
78
  master = g_object_new (GST_TYPE_TEST_CLOCK, "name", "TestClockMaster", NULL);
 
79
  slave = g_object_new (GST_TYPE_TEST_CLOCK, "name", "TestClockMaster", NULL);
43
80
  GST_OBJECT_FLAG_SET (slave, GST_CLOCK_FLAG_CAN_SET_MASTER);
44
81
 
45
 
  /* look ma! i'm doing monkey patching in C */
46
 
  klass = GST_CLOCK_GET_CLASS (master);
47
 
  klass->wait_async = fake_wait_async;
48
 
 
49
82
  fail_unless_equals_int (GST_OBJECT_REFCOUNT (master), 1);
50
83
  fail_unless_equals_int (GST_OBJECT_REFCOUNT (slave), 1);
51
84
 
72
105
  fail_unless_equals_int (GST_OBJECT_REFCOUNT (slave), 1);
73
106
 
74
107
  gst_object_unref (slave);
75
 
 
76
 
  klass->wait_async = NULL;
77
108
}
78
109
 
79
110
GST_END_TEST;