summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2018-10-22 10:08:22 -0400
committerPhilip Chimento <philip.chimento@gmail.com>2018-10-22 20:57:56 -0400
commitd3b2ee90e47cc10c6dcf7c246847b005882adbd9 (patch)
tree65eff760d5a1efcea72905fd5dcd876f3b7a5334
parent54e12c0182cfce6bf90b35b2781d18f53c8263cb (diff)
downloadgobject-introspection-d3b2ee90e47cc10c6dcf7c246847b005882adbd9.tar.gz
regress: Add test for write-only property
GTK contains a few write-only properties, so it makes sense to have one in the regress test suite. See gjs!246
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.TestObj-write-only.page13
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-write-only.page16
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-write-only.page16
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.TestObj.page2
-rw-r--r--tests/scanner/Regress-1.0-expected.gir6
-rw-r--r--tests/scanner/regress.c14
6 files changed, 66 insertions, 1 deletions
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-write-only.page b/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-write-only.page
new file mode 100644
index 00000000..bb366613
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-write-only.page
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<page id="Regress.TestObj-write-only"
+ type="topic"
+ style="property"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestObj" group="property" type="guide"/>
+ <title type="link" role="topic">write-only</title>
+ </info>
+ <title>Regress.TestObj:write-only</title>
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-write-only.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-write-only.page
new file mode 100644
index 00000000..9fd19255
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-write-only.page
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<page id="Regress.TestObj-write-only"
+ type="topic"
+ style="property"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestObj" group="property" type="guide"/>
+ <title type="link" role="topic">write-only</title>
+ </info>
+ <title>Regress.TestObj.write_only</title>
+ <synopsis><code mime="text/x-gjs">
+TestObj.write_only: Boolean (Write)
+ </code></synopsis>
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-write-only.page b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-write-only.page
new file mode 100644
index 00000000..8281a78e
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-write-only.page
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<page id="Regress.TestObj-write-only"
+ type="topic"
+ style="property"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestObj" group="property" type="guide"/>
+ <title type="link" role="topic">write-only</title>
+ </info>
+ <title>Regress.TestObj:write-only</title>
+ <synopsis><code mime="text/x-python">
+"write-only" bool : Write
+ </code></synopsis>
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj.page b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj.page
index 6f457043..73d77243 100644
--- a/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj.page
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj.page
@@ -12,7 +12,7 @@
<synopsis><code>
from gi.repository import Regress
-test_obj = Regress.TestObj(<link xref='Regress.TestObj-bare'>bare</link>=value, <link xref='Regress.TestObj-boxed'>boxed</link>=value, <link xref='Regress.TestObj-byte-array'>byte_array</link>=value, <link xref='Regress.TestObj-double'>double</link>=value, <link xref='Regress.TestObj-float'>float</link>=value, <link xref='Regress.TestObj-gtype'>gtype</link>=value, <link xref='Regress.TestObj-hash-table'>hash_table</link>=value, <link xref='Regress.TestObj-hash-table-old'>hash_table_old</link>=value, <link xref='Regress.TestObj-int'>int</link>=value, <link xref='Regress.TestObj-list'>list</link>=value, <link xref='Regress.TestObj-list-old'>list_old</link>=value, <link xref='Regress.TestObj-name-conflict'>name_conflict</link>=value, <link xref='Regress.TestObj-pptrarray'>pptrarray</link>=value, <link xref='Regress.TestObj-string'>string</link>=value)
+test_obj = Regress.TestObj(<link xref='Regress.TestObj-bare'>bare</link>=value, <link xref='Regress.TestObj-boxed'>boxed</link>=value, <link xref='Regress.TestObj-byte-array'>byte_array</link>=value, <link xref='Regress.TestObj-double'>double</link>=value, <link xref='Regress.TestObj-float'>float</link>=value, <link xref='Regress.TestObj-gtype'>gtype</link>=value, <link xref='Regress.TestObj-hash-table'>hash_table</link>=value, <link xref='Regress.TestObj-hash-table-old'>hash_table_old</link>=value, <link xref='Regress.TestObj-int'>int</link>=value, <link xref='Regress.TestObj-list'>list</link>=value, <link xref='Regress.TestObj-list-old'>list_old</link>=value, <link xref='Regress.TestObj-name-conflict'>name_conflict</link>=value, <link xref='Regress.TestObj-pptrarray'>pptrarray</link>=value, <link xref='Regress.TestObj-string'>string</link>=value, <link xref='Regress.TestObj-write-only'>write_only</link>=value)
</code></synopsis>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index f69b8514..923e4725 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -3671,6 +3671,12 @@ raise an error.</doc>
<property name="string" writable="1" transfer-ownership="none">
<type name="utf8" c:type="gchar*"/>
</property>
+ <property name="write-only"
+ readable="0"
+ writable="1"
+ transfer-ownership="none">
+ <type name="gboolean" c:type="gboolean"/>
+ </property>
<field name="parent_instance">
<type name="GObject.Object" c:type="GObject"/>
</field>
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 330a8d16..f998a498 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -2103,6 +2103,7 @@ enum
PROP_TEST_OBJ_GTYPE,
PROP_TEST_OBJ_NAME_CONFLICT,
PROP_TEST_OBJ_BYTE_ARRAY,
+ PROP_TEST_OBJ_WRITE_ONLY,
};
static void
@@ -2169,6 +2170,11 @@ regress_test_obj_set_property (GObject *object,
self->byte_array = g_value_get_boxed (value);
break;
+ case PROP_TEST_OBJ_WRITE_ONLY:
+ if (g_value_get_boolean (value))
+ self->some_int8 = 0;
+ break;
+
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -2737,6 +2743,14 @@ regress_test_obj_class_init (RegressTestObjClass *klass)
PROP_TEST_OBJ_BYTE_ARRAY,
pspec);
+ /**
+ * TestObj:write-only:
+ */
+ pspec = g_param_spec_boolean ("write-only", "Write-only property",
+ "A write-only bool property that resets the value of TestObj:int to 0 when true",
+ FALSE, G_PARAM_WRITABLE);
+ g_object_class_install_property (gobject_class, PROP_TEST_OBJ_WRITE_ONLY, pspec);
+
klass->matrix = regress_test_obj_default_matrix;
}