3
using VQDR.Common.Utils;
6
class MyTestClass : GLib.Object {
7
public int prop_int {get; set;}
8
public string prop_string {get; set;}
9
public bool prop_bool {get; set;}
12
class MyTestClassString : GLib.Object {
13
public string prop_string {get; set;}
16
class MyTestClassInt : GLib.Object {
17
public int prop_int {get; set;}
20
class MyTestClassBool : GLib.Object {
21
public bool prop_bool {get; set;}
24
class MyTestClassVariant : GLib.Object {
25
public GLib.Variant prop_var {get; set;}
29
void gobject_to_string_test () {
31
Test.add_func ("/Common/Utils/gobject_to_string_int", () => {
32
var v1 = GLib.Object.new (typeof (MyTestClassInt),
34
string got_string = object_to_string (v1);
38
string expected = "(MyTestClassInt):\n\t(gint) prop-int: 1337\n";
42
if (expected != got_string) {
44
Test.message ("The output sting does not match the expected string.");
48
Test.add_func ("/Common/Utils/gobject_to_string_string", () => {
49
var v1 = GLib.Object.new (typeof (MyTestClassString),
50
prop_string: "string");
52
string got_string = object_to_string (v1);
56
string expected = "(MyTestClassString):\n\t(gchararray) prop-string: string\n";
60
if (expected != got_string) {
62
Test.message ("The output sting does not match the expected string.");
66
Test.add_func ("/Common/Utils/gobject_to_string_bool", () => {
67
var v1 = GLib.Object.new (typeof (MyTestClassBool),
70
string got_string = object_to_string (v1);
74
string expected = "(MyTestClassBool):\n\t(gboolean) prop-bool: true\n";
78
if (expected != got_string) {
80
Test.message ("The output sting does not match the expected string.");
84
Test.add_func ("/Common/Utils/gobject_to_string_variant", () => {
85
var my_var = new Variant ("(ssibb)", "aa", "bb", 10, false, true);
86
var v1 = GLib.Object.new (typeof (MyTestClassVariant),
89
string got_string = object_to_string (v1);
94
"(MyTestClassVariant):
95
\t(GVariant) prop-var: (ssibb)
107
if (str_cmp (expected, got_string) != 0) {
109
Test.message ("The output sting does not match the expected string.");