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
8 #include "SkColor.h"
9 #include "Test.h"
10
DEF_TEST(SkColor4f_FromColor,reporter)11 DEF_TEST(SkColor4f_FromColor, reporter) {
12 const struct {
13 SkColor fC;
14 SkColor4f fC4;
15 } recs[] = {
16 { SK_ColorBLACK, { 0, 0, 0, 1 } },
17 { SK_ColorWHITE, { 1, 1, 1, 1 } },
18 { SK_ColorRED, { 1, 0, 0, 1 } },
19 { SK_ColorGREEN, { 0, 1, 0, 1 } },
20 { SK_ColorBLUE, { 0, 0, 1, 1 } },
21 { 0, { 0, 0, 0, 0 } },
22 };
23
24 for (const auto& r : recs) {
25 SkColor4f c4 = SkColor4f::FromColor(r.fC);
26 REPORTER_ASSERT(reporter, c4 == r.fC4);
27 }
28 }
29