Ejemplo n.º 1
0
DEF_TEST(AndroidOptionsSize, reporter) {
    // A paint with default android options should serialize to something smaller than
    // a paint with non-default android options.

    SkPaint defaultOptions;

    SkPaintOptionsAndroid options;
    options.setUseFontFallbacks(true);
    SkPaint nonDefaultOptions;
    nonDefaultOptions.setPaintOptionsAndroid(options);

    SkPaint dummy;

    REPORTER_ASSERT(reporter,
                    Reconstruct(defaultOptions, &dummy) < Reconstruct(nonDefaultOptions, &dummy));
}
Ejemplo n.º 2
0
DEF_TEST(AndroidOptionsSerialization, reporter) {
    // We want to make sure that Android's paint options survive a flatten/unflatten round trip.
    // These are all non-default options.
    SkPaintOptionsAndroid options;
    options.setLanguage("ja-JP");
    options.setFontVariant(SkPaintOptionsAndroid::kElegant_Variant);
    options.setUseFontFallbacks(true);

    SkPaint paint;
    paint.setPaintOptionsAndroid(options);

    SkPaint reconstructed;
    Reconstruct(paint, &reconstructed);

    REPORTER_ASSERT(reporter, options == reconstructed.getPaintOptionsAndroid());
}
static void android_options_size(skiatest::Reporter* reporter) {
    // A paint with default android options should serialize to something smaller than
    // a paint with non-default android options.

    SkPaint defaultOptions;

    SkPaintOptionsAndroid options;
    options.setUseFontFallbacks(true);
    SkPaint nonDefaultOptions;
    nonDefaultOptions.setPaintOptionsAndroid(options);

    SkPaint dummy;

    REPORTER_ASSERT(reporter,
                    Reconstruct(defaultOptions, &dummy) < Reconstruct(nonDefaultOptions, &dummy));
}
Ejemplo n.º 4
0
DEF_TEST(AndroidOptionsSerializationReverse, reporter) {
    // Opposite test of above: make sure the serialized default values of a paint overwrite
    // non-default values on the paint we're unflattening into.
    const SkPaint defaultOptions;

    SkPaintOptionsAndroid options;
    options.setLanguage("ja-JP");
    options.setFontVariant(SkPaintOptionsAndroid::kElegant_Variant);
    options.setUseFontFallbacks(true);
    SkPaint nonDefaultOptions;
    nonDefaultOptions.setPaintOptionsAndroid(options);

    Reconstruct(defaultOptions, &nonDefaultOptions);

    REPORTER_ASSERT(reporter,
            defaultOptions.getPaintOptionsAndroid() ==
            nonDefaultOptions.getPaintOptionsAndroid());
}