40
42
void gobject_to_string_test () {
42
// Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "int", () => {
43
// var v1 = GLib.Object.new (typeof (MyTestClassInt),
45
// string got_string = object_to_string (v1);
47
// debug (got_string);
49
// string expected = "(MyTestClassInt)}\n\t(gint) prop-int: 1337\n}";
53
// if (expected != got_string) {
55
// Test.message ("The output sting does not match the expected string.");
59
// Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "string", () => {
60
// var v1 = GLib.Object.new (typeof (MyTestClassString),
61
// prop_string: "string");
63
// string got_string = object_to_string (v1);
65
// debug (got_string);
67
// string expected = "(MyTestClassString):\n\t(gchararray) prop-string: string\n";
71
// if (expected != got_string) {
73
// Test.message ("The output sting does not match the expected string.");
77
// Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "bool", () => {
78
// var v1 = GLib.Object.new (typeof (MyTestClassBool),
81
// string got_string = object_to_string (v1);
83
// debug (got_string);
85
// string expected = "(MyTestClassBool):\n\t(gboolean) prop-bool: true\n";
89
// if (expected != got_string) {
91
// Test.message ("The output sting does not match the expected string.");
95
// Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "variant", () => {
96
// var my_var = new Variant ("(ssibb)", "aa", "bb", 10, false, true);
97
// var v1 = GLib.Object.new (typeof (MyTestClassVariant),
100
// string got_string = object_to_string (v1);
102
// debug (got_string);
105
//"(MyTestClassVariant):
106
//\t(GVariant) prop-var: (ssibb)
118
// if (str_cmp (expected, got_string) != 0) {
120
// Test.message ("The output sting does not match the expected string.");
44
Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "int", () => {
45
var v1 = GLib.Object.new (typeof (MyTestClassInt),
47
string got_string = object_to_string (v1);
51
string expected = "(MyTestClassInt)}\n\t(gint) prop-int: 1337\n}";
55
if (expected != got_string) {
57
Test.message ("The output sting does not match the expected string.");
61
Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "string", () => {
62
var v1 = GLib.Object.new (typeof (MyTestClassString),
63
prop_string: "string");
65
string got_string = object_to_string (v1);
69
string expected = "(MyTestClassString):\n\t(gchararray) prop-string: string\n";
73
if (expected != got_string) {
75
Test.message ("The output sting does not match the expected string.");
79
Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "bool", () => {
80
var v1 = GLib.Object.new (typeof (MyTestClassBool),
83
string got_string = object_to_string (v1);
87
string expected = "(MyTestClassBool):\n\t(gboolean) prop-bool: true\n";
91
if (expected != got_string) {
93
Test.message ("The output sting does not match the expected string.");
97
Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "variant", () => {
98
var my_var = new Variant ("(ssibb)", "aa", "bb", 10, false, true);
99
var v1 = GLib.Object.new (typeof (MyTestClassVariant),
102
string got_string = object_to_string (v1);
107
"(MyTestClassVariant):
108
\t(GVariant) prop-var: (ssibb)
120
if (str_cmp (expected, got_string) != 0) {
122
Test.message ("The output sting does not match the expected string.");
124
126
Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "/nested", () => {
125
127
MyTestClassB obj = new MyTestClassB ();