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

Indexes created Thu Nov 07 10:32:03 CST 2024