Fix problems with 4-sided padding: specifiers

The test for identifying such a specifier was wrong, and the last
value was assigned to the wrong sides.

https://bugzilla.gnome.org/show_bug.cgi?id=595990
This commit is contained in:
Owen W. Taylor 2009-09-19 23:28:39 -04:00
parent 6527dbc8b7
commit 1fd25573e5
3 changed files with 30 additions and 12 deletions

View File

@ -924,28 +924,28 @@ do_padding_property (StThemeNode *node,
*/ */
if (decl->value == NULL) /* 0 values */ if (decl->value == NULL) /* 0 values */
return; return;
else if (decl->value->next == NULL) else if (decl->value->next == NULL) /* 1 value */
{ /* 1 value */ {
do_padding_property_term (node, decl->value, TRUE, TRUE, TRUE, TRUE); /* left/right/top/bottom */ do_padding_property_term (node, decl->value, TRUE, TRUE, TRUE, TRUE); /* left/right/top/bottom */
return; return;
} }
else if (decl->value->next->next == NULL) else if (decl->value->next->next == NULL) /* 2 values */
{ /* 2 values */ {
do_padding_property_term (node, decl->value, FALSE, FALSE, TRUE, TRUE); /* top/bottom */ do_padding_property_term (node, decl->value, FALSE, FALSE, TRUE, TRUE); /* top/bottom */
do_padding_property_term (node, decl->value->next, TRUE, TRUE, FALSE, FALSE); /* left/right */ do_padding_property_term (node, decl->value->next, TRUE, TRUE, FALSE, FALSE); /* left/right */
} }
else if (decl->value->next->next->next == NULL) else if (decl->value->next->next->next == NULL) /* 3 values */
{ /* 3 values */ {
do_padding_property_term (node, decl->value, FALSE, FALSE, TRUE, FALSE); /* top */ do_padding_property_term (node, decl->value, FALSE, FALSE, TRUE, FALSE); /* top */
do_padding_property_term (node, decl->value->next, TRUE, TRUE, FALSE, FALSE); /* left/right */ do_padding_property_term (node, decl->value->next, TRUE, TRUE, FALSE, FALSE); /* left/right */
do_padding_property_term (node, decl->value->next->next, FALSE, FALSE, FALSE, TRUE); /* bottom */ do_padding_property_term (node, decl->value->next->next, FALSE, FALSE, FALSE, TRUE); /* bottom */
} }
else if (decl->value->next->next->next == NULL) else if (decl->value->next->next->next->next == NULL) /* 4 values */
{ /* 4 values */ {
do_padding_property_term (node, decl->value, FALSE, FALSE, TRUE, FALSE); do_padding_property_term (node, decl->value, FALSE, FALSE, TRUE, FALSE); /* top */
do_padding_property_term (node, decl->value->next, FALSE, TRUE, FALSE, FALSE); /* left */ do_padding_property_term (node, decl->value->next, FALSE, TRUE, FALSE, FALSE); /* right */
do_padding_property_term (node, decl->value->next->next, FALSE, FALSE, FALSE, TRUE); do_padding_property_term (node, decl->value->next->next, FALSE, FALSE, FALSE, TRUE); /* bottom */
do_padding_property_term (node, decl->value->next->next->next, TRUE, FALSE, FALSE, TRUE); /* left */ do_padding_property_term (node, decl->value->next->next->next, TRUE, FALSE, FALSE, FALSE); /* left */
} }
else else
{ {

View File

@ -206,6 +206,22 @@ test_adjacent_selector (void)
assert_foreground_color (text2, "text2", 0x000000ff); assert_foreground_color (text2, "text2", 0x000000ff);
} }
static void
test_padding (void)
{
test = "padding";
/* Test that a 4-sided padding property assigns the right paddings to
* all sides */
assert_length ("group2", "padding-top", 1.,
st_theme_node_get_padding (group2, ST_SIDE_TOP));
assert_length ("group2", "padding-right", 2.,
st_theme_node_get_padding (group2, ST_SIDE_RIGHT));
assert_length ("group2", "padding-bottom", 3.,
st_theme_node_get_padding (group2, ST_SIDE_BOTTOM));
assert_length ("group2", "padding-left", 4.,
st_theme_node_get_padding (group2, ST_SIDE_LEFT));
}
static void static void
test_background (void) test_background (void)
{ {
@ -295,6 +311,7 @@ main (int argc, char **argv)
test_classes (); test_classes ();
test_type_inheritance (); test_type_inheritance ();
test_adjacent_selector (); test_adjacent_selector ();
test_padding ();
test_background (); test_background ();
test_font (); test_font ();
test_pseudo_class (); test_pseudo_class ();

View File

@ -57,6 +57,7 @@ stage > #text2 {
#group2 { #group2 {
background-image: url('other-background.png'); background-image: url('other-background.png');
padding: 1px 2px 3px 4px;
} }
ClutterText:hover { ClutterText:hover {