Add tests for the GtkLabel builder parser

These tests check various error conditions in GtkLabel
custom tags.
This commit is contained in:
Matthias Clasen 2015-04-22 10:59:12 -05:00
parent 87d3cc47c2
commit 2c807335c4
11 changed files with 71 additions and 0 deletions

View File

@ -173,6 +173,11 @@ test_ui = \
ui/test5.ui ui/test5.expected \
ui/test6.ui ui/test6.expected \
ui/test7.ui ui/test7.expected \
ui/label1.ui ui/label1.expected \
ui/label2.ui ui/label2.expected \
ui/label3.ui ui/label3.expected \
ui/label4.ui ui/label4.expected \
ui/label5.ui ui/label5.expected \
$(NULL)
EXTRA_DIST += \

View File

@ -0,0 +1 @@
SUCCESS

View File

@ -0,0 +1,25 @@
<!-- test all valid label attributes -->
<interface>
<object class="GtkLabel">
<attributes>
<attribute name="language" value="de" start="5" end="10"/>
<attribute name="style" value="italic"/>
<attribute name="weight" value="bold"/>
<attribute name="variant" value="normal"/>
<attribute name="stretch" value="ultra-expanded"/>
<attribute name="underline" value="double"/>
<attribute name="strikethrough" value="True"/>
<attribute name="gravity" value="north"/>
<attribute name="gravity-hint" value="line"/>
<attribute name="family" value="sans"/>
<attribute name="size" value="10"/>
<attribute name="absolute-size" value="10"/>
<attribute name="font-desc" value="Cantarell 11"/>
<attribute name="foreground" value="yellow"/>
<attribute name="background" value="red"/>
<attribute name="underline-color" value="green"/>
<attribute name="strikethrough-color" value="purple"/>
<attribute name="scale" value="1.5"/>
</attributes>
</object>
</interface>

View File

@ -0,0 +1,2 @@
ERROR: g-markup-error-quark 6
.:5:32 element 'attribute' requires attribute 'value'

View File

@ -0,0 +1,8 @@
<!-- test missing label attribute value -->
<interface>
<object class="GtkLabel">
<attributes>
<attribute name="style"/>
</attributes>
</object>
</interface>

View File

@ -0,0 +1,2 @@
ERROR: gtk-builder-error-quark 6
Could not parse enum: `warbl'

View File

@ -0,0 +1,8 @@
<!-- test invalid label attribute name -->
<interface>
<object class="GtkLabel">
<attributes>
<attribute name="warbl" value="true"/>
</attributes>
</object>
</interface>

View File

@ -0,0 +1,2 @@
ERROR: gtk-builder-error-quark 1
.:5:15 Unsupported tag for GtkContainer: <blarg>

View File

@ -0,0 +1,8 @@
<!-- test invalid tag in GtkLabel attributes -->
<interface>
<object class="GtkLabel">
<attributes>
<blarg/>
</attributes>
</object>
</interface>

View File

@ -0,0 +1,2 @@
ERROR: gtk-builder-error-quark 1
Unhandled tag: <warbl>

View File

@ -0,0 +1,8 @@
<!-- test invalid tag in GtkLabel -->
<interface>
<object class="GtkLabel">
<attributes>
</attributes>
<warbl/>
</object>
</interface>