chromium/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_definition_test.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_definition.h"

#include "base/memory/scoped_refptr.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_optional_effect_timing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_cssnumericvalue_double.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_cssnumericvalue_string_unrestricteddouble.h"
#include "third_party/blink/renderer/core/animation/document_timeline.h"
#include "third_party/blink/renderer/core/animation/element_animations.h"
#include "third_party/blink/renderer/core/animation/inert_effect.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect_model.h"
#include "third_party/blink/renderer/core/animation/string_keyframe.h"
#include "third_party/blink/renderer/core/animation/timing.h"
#include "third_party/blink/renderer/core/css/background_color_paint_image_generator.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/execution_context/security_context.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/graphics/bitmap_image.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/graphics/platform_paint_worklet_layer_painter.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"

namespace blink {

class FakeBackgroundColorPaintImageGenerator
    : public BackgroundColorPaintImageGenerator {};

class BackgroundColorPaintDefinitionTest : public RenderingTest {};

// Test the case where there is a background-color animation with two simple
// keyframes that will not fall back to main.
TEST_F(BackgroundColorPaintDefinitionTest, SimpleBGColorAnimationNotFallback) {}

TEST_F(BackgroundColorPaintDefinitionTest, FallbackWithPixelMovingFilter) {}

// Test the case when there is no animation attached to the element.
TEST_F(BackgroundColorPaintDefinitionTest, FallbackToMainNoAnimation) {}

// Test the case where the composite mode is not replace.
TEST_F(BackgroundColorPaintDefinitionTest, FallbackToMainCompositeAccumulate) {}

TEST_F(BackgroundColorPaintDefinitionTest, MultipleAnimationsFallback) {}

// Lack mechanism to re-snapshot keyframes on a change to current color.
TEST_F(BackgroundColorPaintDefinitionTest, FallbackToMainCurrentColor) {}

// System colors depend on theme. Presently lack mechanism to re-snapshot the
// keyframes on a change to the color scheme.
TEST_F(BackgroundColorPaintDefinitionTest, FallbackToMainSystemColor) {}

// Composite even with a complex color expression provided it evaluates to
// a simple color without dependencies on system colors or currentcolor.
TEST_F(BackgroundColorPaintDefinitionTest, CompositeColorMix) {}

TEST_F(BackgroundColorPaintDefinitionTest, FallbackToMainOnUnresolvedColorMix) {}

// Test that paint is invalidated in the case that a second background color
// animation is added.
TEST_F(BackgroundColorPaintDefinitionTest,
       TriggerRepaintCompositedToNonComposited) {}

// Test that paint is invalidated when an animation's keyframe is changed
TEST_F(BackgroundColorPaintDefinitionTest, TriggerRepaintChangedKeyframe) {}

// Test that an animation can be properly recovered as compositable after
// previously been non-composited and then cancelled.
TEST_F(BackgroundColorPaintDefinitionTest, NotStuckOnKNotComposited) {}

// Test that an animation has its status properly set after updating the
// animation keyframes to a non-compositable property.
TEST_F(BackgroundColorPaintDefinitionTest, Rep) {}

TEST_F(BackgroundColorPaintDefinitionTest, TriggerRepaintNewStartTime) {}

// Test that calling BackgroundColorPaintDefinition::Paint won't crash
// when the animated property value is empty.
TEST_F(BackgroundColorPaintDefinitionTest,
       ProxyClientPaintWithNoPropertyValue) {}

// Test that BackgroundColorPaintDefinition::Paint won't crash if the
// progress of the animation is a negative number.
TEST_F(BackgroundColorPaintDefinitionTest,
       ProxyClientPaintWithNegativeProgress) {}

// Test that BackgroundColorPaintDefinition::Paint won't crash if the
// progress of the animation is > 1.
TEST_F(BackgroundColorPaintDefinitionTest,
       ProxyClientPaintWithLargerThanOneProgress) {}

// Test that BackgroundColorPaintDefinition::Paint won't crash when the
// largest offset is not exactly one.
TEST_F(BackgroundColorPaintDefinitionTest,
       ProxyClientPaintWithCloseToOneOffset) {}

// Test that BackgroundColorPaintDefinition::Paint handles colors with
// differing color spaces - i.e won't crash/DCHECK.
TEST_F(BackgroundColorPaintDefinitionTest,
       ProxyClientPaintWithColorOfDifferingColorSpaces) {}

// Test that BackgroundColorPaintDefinition::Paint handles colors with
// differing color spaces - i.e won't crash/DCHECK.
TEST_F(BackgroundColorPaintDefinitionTest,
       ProxyClientPaintWithColorOfDifferingColorSpacesReverse) {}

}  // namespace blink