mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-20 18:40:08 +01:00
[variations] Fix test
This does not exercise merging of variations from font-options and from pattern. Before this commit the code was more towards doing that.
This commit is contained in:
parent
6accf16093
commit
34047d11db
1 changed files with 6 additions and 11 deletions
|
|
@ -59,14 +59,9 @@ test_variation (cairo_test_context_t *ctx,
|
||||||
#if CAIRO_HAS_FC_FONT
|
#if CAIRO_HAS_FC_FONT
|
||||||
FcPattern *pattern;
|
FcPattern *pattern;
|
||||||
|
|
||||||
#ifndef FC_FONT_VARIATIONS
|
|
||||||
#define FC_FONT_VARIATIONS "fontvariations"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* we need a font that has variations */
|
/* we need a font that has variations */
|
||||||
pattern = FcPatternBuild (NULL,
|
pattern = FcPatternBuild (NULL,
|
||||||
FC_FAMILY, FcTypeString, (FcChar8*)"Adobe Variable Font Prototype",
|
FC_FAMILY, FcTypeString, (FcChar8*)"Adobe Variable Font Prototype",
|
||||||
FC_FONT_VARIATIONS, FcTypeString, input,
|
|
||||||
NULL);
|
NULL);
|
||||||
font_face = cairo_ft_font_face_create_for_pattern (pattern);
|
font_face = cairo_ft_font_face_create_for_pattern (pattern);
|
||||||
status = cairo_font_face_status (font_face);
|
status = cairo_font_face_status (font_face);
|
||||||
|
|
@ -84,13 +79,13 @@ test_variation (cairo_test_context_t *ctx,
|
||||||
return CAIRO_TEST_FAILURE;
|
return CAIRO_TEST_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_font_options_set_variations (options, "wdth=200,wght=300");
|
cairo_font_options_set_variations (options, input);
|
||||||
if (cairo_font_options_status (options) != CAIRO_STATUS_SUCCESS) {
|
if (cairo_font_options_status (options) != CAIRO_STATUS_SUCCESS) {
|
||||||
cairo_test_log (ctx, "Failed to set variations");
|
cairo_test_log (ctx, "Failed to set variations");
|
||||||
return CAIRO_TEST_FAILURE;
|
return CAIRO_TEST_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp (cairo_font_options_get_variations (options), "wdth=200,wght=300") != 0) {
|
if (strcmp (cairo_font_options_get_variations (options), input) != 0) {
|
||||||
cairo_test_log (ctx, "Failed to verify variations");
|
cairo_test_log (ctx, "Failed to verify variations");
|
||||||
return CAIRO_TEST_FAILURE;
|
return CAIRO_TEST_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
@ -172,10 +167,10 @@ preamble (cairo_test_context_t *ctx)
|
||||||
int expected_default;
|
int expected_default;
|
||||||
float expected_value;
|
float expected_value;
|
||||||
} tests[] = {
|
} tests[] = {
|
||||||
{ "wdth=200,wght=300", "wght", 0, 200.0 }, // valid
|
{ "wdth=200,wght=300", "wdth", 0, 200.0 }, // valid
|
||||||
{ "wdth=200.5,wght=300", "wght", 0, 200.5 }, // valid, using decimal dot
|
{ "wdth=200.5,wght=300", "wdth", 0, 200.5 }, // valid, using decimal dot
|
||||||
{ "wdth 200 , wght=300", "wght", 0, 200.0 }, // valid, without =
|
{ "wdth 200 , wght=300", "wdth", 0, 200.0 }, // valid, without =
|
||||||
{ "wdth = 200", "wght", 0, 200.0 }, // valid, whitespace and =
|
{ "wdth = 200", "wdth", 0, 200.0 }, // valid, whitespace and =
|
||||||
{ "CNTR=20", "wght", 1, 0.0 }, // valid, not setting wght
|
{ "CNTR=20", "wght", 1, 0.0 }, // valid, not setting wght
|
||||||
{ "weight=100", "wght", 1, 0.0 }, // not a valid tag
|
{ "weight=100", "wght", 1, 0.0 }, // not a valid tag
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue