icon-theme: Test inheritance vs. generic fallback

Add a few tests that check the behavior of icon theme inheritance
vs generic fallback vs symbolic icons.
This commit is contained in:
Matthias Clasen 2014-09-21 16:28:15 -04:00
parent 964c202c38
commit df8a688656
9 changed files with 74 additions and 0 deletions

View File

@ -152,6 +152,12 @@ test_icontheme = \
icons/16-22/size-test.png \
icons/25+/size-test.svg \
icons/35+/size-test.svg \
icons/scalable/one-two.svg \
icons/scalable/one-two-rtl.svg \
icons2/scalable/one-two-three-symbolic.svg \
icons2/scalable/one-two-symbolic.svg \
icons2/scalable/one-two-symbolic-rtl.svg \
icons2/index.theme \
$(NULL)
EXTRA_DIST += \

View File

@ -2,6 +2,7 @@
Name=Icons
Comment=Testing of the Icon theme code
Example=16x16/simple.png
Inherits=icons2
Directories=16x16,16x16s,32x32,32x32s,scalable,15,16-22,25+,35+

View File

@ -0,0 +1,5 @@
<?xml version="1.0" standalone="no"?>
<svg width="128" height="128" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="64" height="64" fill="black"/>
<rect x="64" y="64" width="64" height="64" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 243 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" standalone="no"?>
<svg width="128" height="128" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="64" height="64" fill="black"/>
<rect x="64" y="64" width="64" height="64" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 243 B

View File

@ -0,0 +1,12 @@
[Icon Theme]
Name=Icons2
Comment=Testing of the Icon theme code
Directories=scalable
[scalable]
Context=scalable icons
Type=Scalable
Size=128
MinSize=1
MaxSize=256

View File

@ -0,0 +1,5 @@
<?xml version="1.0" standalone="no"?>
<svg width="128" height="128" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="64" height="64" fill="black"/>
<rect x="64" y="64" width="64" height="64" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 243 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" standalone="no"?>
<svg width="128" height="128" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="64" height="64" fill="black"/>
<rect x="64" y="64" width="64" height="64" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 243 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" standalone="no"?>
<svg width="128" height="128" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="64" height="64" fill="black"/>
<rect x="64" y="64" width="64" height="64" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 243 B

View File

@ -669,6 +669,35 @@ test_async (void)
g_assert (loaded == 2);
}
static void
test_inherit (void)
{
assert_icon_lookup ("one-two-three",
SCALABLE_IMAGE_SIZE,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
"/icons/scalable/one-two.svg");
assert_icon_lookup ("one-two-three",
SCALABLE_IMAGE_SIZE,
GTK_ICON_LOOKUP_GENERIC_FALLBACK | GTK_ICON_LOOKUP_DIR_RTL,
"/icons/scalable/one-two-rtl.svg");
assert_icon_lookup ("one-two-three-symbolic",
SCALABLE_IMAGE_SIZE,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
"/icons2/scalable/one-two-three-symbolic.svg");
assert_icon_lookup ("one-two-three-symbolic",
SCALABLE_IMAGE_SIZE,
GTK_ICON_LOOKUP_GENERIC_FALLBACK | GTK_ICON_LOOKUP_DIR_RTL,
"/icons2/scalable/one-two-three-symbolic.svg");
assert_icon_lookup ("one-two-symbolic",
SCALABLE_IMAGE_SIZE,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
"/icons2/scalable/one-two-symbolic.svg");
assert_icon_lookup ("one-two-symbolic",
SCALABLE_IMAGE_SIZE,
GTK_ICON_LOOKUP_GENERIC_FALLBACK | GTK_ICON_LOOKUP_DIR_RTL,
"/icons2/scalable/one-two-symbolic-rtl.svg");
}
int
main (int argc, char *argv[])
{
@ -686,6 +715,7 @@ main (int argc, char *argv[])
g_test_add_func ("/icontheme/builtin", test_builtin);
g_test_add_func ("/icontheme/list", test_list);
g_test_add_func ("/icontheme/async", test_async);
g_test_add_func ("/icontheme/inherit", test_inherit);
return g_test_run();
}