1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46

cc / paint / skottie_text_property_value_unittest.cc [blame]

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

#include "cc/paint/skottie_text_property_value.h"

#include <string>

#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace cc {
namespace {

using ::testing::Eq;
using ::testing::Ne;

TEST(SkottieTextPropertyValueTest, SetsText) {
  SkottieTextPropertyValue val("test-1", /*box=*/gfx::RectF());
  EXPECT_THAT(val.text(), Eq("test-1"));
  val.SetText("test-2");
  EXPECT_THAT(val.text(), Eq("test-2"));
}

TEST(SkottieTextPropertyValueTest, ComparisonOperator) {
  SkottieTextPropertyValue val("test-1", gfx::RectF(10, 20, 100, 200));
  SkottieTextPropertyValue val_2("test-1", gfx::RectF(10, 20, 100, 200));
  EXPECT_THAT(val, Eq(val_2));

  SkottieTextPropertyValue val_copy(val);
  ASSERT_THAT(val_copy, Eq(val));

  {
    SkottieTextPropertyValue tmp(val);
    tmp.SetText("test-2");
    EXPECT_THAT(val, Ne(tmp));
  }
  {
    SkottieTextPropertyValue tmp(val);
    tmp.set_box(gfx::RectF(20, 10, 200, 100));
    EXPECT_THAT(val, Ne(tmp));
  }
}

}  // namespace
}  // namespace cc