skottie_text_property_value_unittest.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "cc/paint/skottie_text_property_value.h"
  5. #include <string>
  6. #include "testing/gmock/include/gmock/gmock.h"
  7. #include "testing/gtest/include/gtest/gtest.h"
  8. namespace cc {
  9. namespace {
  10. using ::testing::Eq;
  11. using ::testing::Ne;
  12. TEST(SkottieTextPropertyValueTest, SetsText) {
  13. SkottieTextPropertyValue val("test-1", /*box=*/gfx::RectF());
  14. EXPECT_THAT(val.text(), Eq("test-1"));
  15. val.SetText("test-2");
  16. EXPECT_THAT(val.text(), Eq("test-2"));
  17. }
  18. TEST(SkottieTextPropertyValueTest, ComparisonOperator) {
  19. SkottieTextPropertyValue val("test-1", gfx::RectF(10, 20, 100, 200));
  20. SkottieTextPropertyValue val_2("test-1", gfx::RectF(10, 20, 100, 200));
  21. EXPECT_THAT(val, Eq(val_2));
  22. SkottieTextPropertyValue val_copy(val);
  23. ASSERT_THAT(val_copy, Eq(val));
  24. {
  25. SkottieTextPropertyValue tmp(val);
  26. tmp.SetText("test-2");
  27. EXPECT_THAT(val, Ne(tmp));
  28. }
  29. {
  30. SkottieTextPropertyValue tmp(val);
  31. tmp.set_box(gfx::RectF(20, 10, 200, 100));
  32. EXPECT_THAT(val, Ne(tmp));
  33. }
  34. }
  35. } // namespace
  36. } // namespace cc