tester Reference Manual: GtkdocObject

## GtkdocObject GtkdocObject — class for gtk-doc unit test |

## Synopsis

    struct              GtkdocObject;
    struct              GtkdocObjectClass;
    GtkdocObject *      gtkdoc_object_new                   (void);
    void                gtkdoc_object_set_otest             (GObject *self,
                                                             const gchar *value);
    void                gtkdoc_object_frobnicate            (GObject *self,
                                                             gint n);
    gboolean            gtkdoc_object_fooify                (GObject *self,
                                                             ...);
    #define             GTKDOC_OBJECT_MACRO_DUMMY           (parameter_1,
                                                             parameter_2)
    #define             GTKDOC_OBJECT_MACRO_SUM             (parameter_1,
                                                             parameter_2)

## Object Hierarchy

      GObject
       +----GtkdocObject

## Properties

      "dep-otest"                gchar*                : Read / Write
      "otest"                    gchar*                : Read / Write

## Signals

      "dep-otest"                                      : No Hooks
      "otest"                                          : No Hooks
      "strings-changed"                                : No Hooks
      "variant-changed"                                : No Hooks

## Description

This file contains non-sense code for the sole purpose of testing the docs. We can link to the "otest" property and the "otest" signal.

When subclassing it is useful to override the `GtkdocObjectClass.test()` method. The `GtkdocObjectClass.foo_bar()` vmethod lets you refine your frobnicator.

A new instance can be created using the `gtkdoc_object_new()` function. The whole lifecycle usualy looks like shown in this example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23

    GObject *myobj;

    myobj = gtkdoc_object_new();
    // do something
    g_object_unref (myobj);

### Examples

You can also change parameters:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42

    /* example for gobject usage
     * checkout the article at http://en.wikipedia.org/wiki/GObject
     *
     * This example is part of the release, that can be downloaded
     * from ftp://ftp.gnome.org/pub/gnome/sources/gtk-doc/ or any mirror.
     */

    #include <glib.h>
    #include <glib-object.h>

    gint
    main(gint argc, gchar **argv)
    {
      GObject *myobj;

      myobj = gtkdoc_object_new();
      g_object_set (myobj, "parameter", 5, NULL);
      g_object_unref (myobj);

      return 0;
    }

This example serves two main purposes:

- testing conversion (long description follows here)

- catching bugs

- having an example

Nothing more to say.

## Details

### struct GtkdocObject

    struct GtkdocObject;

instance data of gtk-doc unit test class

### struct GtkdocObjectClass

    struct GtkdocObjectClass {
      GObjectClass parent;

      /* class methods */
      void (*test)(const GtkdocObject * const self, gconstpointer const user_data);
      gboolean (*ping)(const GtkdocObject * const self);
      gboolean (*foo_bar)(const GtkdocObject * const self);
    };

class data of gtk-doc unit test class

GObjectClass `parent`; | this is a bug :/
`test` () | overideable method
`ping` () | can be used before calling the ``test()`` function
`foo_bar` () | lets you refine your frobnicator

### gtkdoc_object_new ()

    GtkdocObject *      gtkdoc_object_new                   (void);

Create a new instance

### Note

This will only work if you have called `g_type_init()` before.

Returns : | the instance or `NULL` in case of an error

Since 0.1

### gtkdoc_object_set_otest ()

    void                gtkdoc_object_set_otest             (GObject *self,
                                                             const gchar *value);

### Warning

`gtkdoc_object_set_otest` is deprecated and should not be used in newly-written code. Use g_object_set(obj,"otest",value,NULL); instead.

Set the "otest" property. This is a long paragraph.

Oh, btw. setting the property directly saves us one method.

`self` : | the object
`value` : | the new otest value, whose description extends further than one line will allow

Since 0.5

### gtkdoc_object_frobnicate ()

    void                gtkdoc_object_frobnicate            (GObject *self,
                                                             gint n);

Frobnicate the content of `self` `n` times. This implements a complex algorithm (http://en.wikipedia.org/wiki/Algorithm). [2]

`self` : | the object
`n` : | number of iterations

Since 0.5

### gtkdoc_object_fooify ()

    gboolean            gtkdoc_object_fooify                (GObject *self,
                                                             ...);

Fooify the content of `self`.

`self` : | the object
`...` : | a NULL terminated list of arguments
Returns : | `TRUE` for success

### GTKDOC_OBJECT_MACRO_DUMMY()

    #define GTKDOC_OBJECT_MACRO_DUMMY(parameter_1,parameter_2) /* do nothing */

This macro does nothing.

`parameter_1` : | first arg
`parameter_2` : | second arg

Since 0.1

### GTKDOC_OBJECT_MACRO_SUM()

    #define             GTKDOC_OBJECT_MACRO_SUM(parameter_1,parameter_2)

This macro adds its args.

`parameter_1` : | first arg
`parameter_2` : | second arg
Returns : | the sum of `parameter_1` and `parameter_2`

## Property Details

### The `"dep-otest"` property

      "dep-otest"                gchar*                : Read / Write

### Warning

`GtkdocObject:dep-otest` is deprecated and should not be used in newly-written code. use "otest" property

dummy deprecated property for object.

Default value: "dummy"

### The `"otest"` property

      "otest"                    gchar*                : Read / Write

dummy property for object.

Default value: "dummy"

Since 0.1

## Signal Details

### The `"dep-otest"` signal

    void                user_function                      (GtkdocObject *self,
                                                            gpointer      user_data)      : No Hooks

### Warning

`GtkdocObject::dep-otest` is deprecated and should not be used in newly-written code. Use the "otest" signal instead.

Here's an example signal handler.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29

    static gchar*
    otest_callback (GObject  *o,
                    gpointer  user_data)
    {
      gdouble      value;

      value = abs (o->value);

      return value;
    }

`self` : | myself
`user_data` : | user data set when the signal handler was connected.

### The `"otest"` signal

    void                user_function                      (GtkdocObject *self,
                                                            gpointer      user_data)      : No Hooks

The event has been triggered.

`self` : | myself
`user_data` : | user data set when the signal handler was connected.

### The `"strings-changed"` signal

    void                user_function                      (GtkdocObject *arg0,
                                                            GStrv         arg1,
                                                            gpointer      user_data)      : No Hooks

Something has happened.

`user_data` : | user data set when the signal handler was connected.

### The `"variant-changed"` signal

    void                user_function                      (GtkdocObject *arg0,
                                                            GVariant     *arg1,
                                                            gpointer      user_data)      : No Hooks

Something has happened.

`user_data` : | user data set when the signal handler was connected.

## See Also

GtkdocIface

[2] Negative frobnication can lead to unexpected behaviour.