SkColor4fTest.cpp 737 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright 2016 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #include "include/core/SkColor.h"
  8. #include "tests/Test.h"
  9. DEF_TEST(SkColor4f_FromColor, reporter) {
  10. const struct {
  11. SkColor fC;
  12. SkColor4f fC4;
  13. } recs[] = {
  14. { SK_ColorBLACK, { 0, 0, 0, 1 } },
  15. { SK_ColorWHITE, { 1, 1, 1, 1 } },
  16. { SK_ColorRED, { 1, 0, 0, 1 } },
  17. { SK_ColorGREEN, { 0, 1, 0, 1 } },
  18. { SK_ColorBLUE, { 0, 0, 1, 1 } },
  19. { 0, { 0, 0, 0, 0 } },
  20. };
  21. for (const auto& r : recs) {
  22. SkColor4f c4 = SkColor4f::FromColor(r.fC);
  23. REPORTER_ASSERT(reporter, c4 == r.fC4);
  24. }
  25. }