themed_vector_icon_unittest.cc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2020 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 "ui/base/themed_vector_icon.h"
  5. #include "testing/gtest/include/gtest/gtest.h"
  6. #include "ui/gfx/paint_vector_icon.h"
  7. #include "ui/gfx/vector_icon_types.h"
  8. namespace ui {
  9. namespace {
  10. const gfx::VectorIcon* GetVectorIcon() {
  11. static constexpr gfx::PathElement path[] = {gfx::CommandType::CIRCLE, 24, 18,
  12. 5};
  13. static const gfx::VectorIconRep rep[] = {{path, 4}};
  14. static constexpr gfx::VectorIcon circle_icon = {rep, 1, "circle"};
  15. return &circle_icon;
  16. }
  17. } // namespace
  18. TEST(ThemedVectorIconTest, DefaultEmpty) {
  19. ThemedVectorIcon vector_icon;
  20. EXPECT_TRUE(vector_icon.empty());
  21. }
  22. TEST(ThemedVectorIconTest, CheckForVectorIcon) {
  23. ThemedVectorIcon vector_icon = ThemedVectorIcon(GetVectorIcon());
  24. EXPECT_FALSE(vector_icon.empty());
  25. }
  26. TEST(ImageModelTest, CheckAssign) {
  27. ThemedVectorIcon vector_icon_dest;
  28. ThemedVectorIcon vector_icon_src(GetVectorIcon());
  29. EXPECT_TRUE(vector_icon_dest.empty());
  30. EXPECT_FALSE(vector_icon_src.empty());
  31. vector_icon_dest = vector_icon_src;
  32. EXPECT_FALSE(vector_icon_dest.empty());
  33. }
  34. } // namespace ui