1cb93a386Sopenharmony_ci// Copyright 2019 Google LLC. 2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 3cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h" 4cb93a386Sopenharmony_ci// HASH=c6c5b40cad7c3a839fdf576b380391a6 5cb93a386Sopenharmony_ciREG_FIDDLE(Rect_equal_operator, 256, 256, true, 0) { 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci auto debugster = [](const SkRect& test) -> void { 8cb93a386Sopenharmony_ci SkRect negZero = {-0.0f, -0.0f, 2, 2}; 9cb93a386Sopenharmony_ci SkDebugf("{%g, %g, %g, %g} %c= {%g, %g, %g, %g} %s numerically equal\n", 10cb93a386Sopenharmony_ci test.fLeft, test.fTop, test.fRight, test.fBottom, 11cb93a386Sopenharmony_ci test == negZero ? '=' : '!', 12cb93a386Sopenharmony_ci negZero.fLeft, negZero.fTop, negZero.fRight, negZero.fBottom, 13cb93a386Sopenharmony_ci (test.fLeft == negZero.fLeft && test.fTop == negZero.fTop && 14cb93a386Sopenharmony_ci test.fRight == negZero.fRight && test.fBottom == negZero.fBottom) ? 15cb93a386Sopenharmony_ci "and are" : "yet are not"); 16cb93a386Sopenharmony_ci }; 17cb93a386Sopenharmony_ci SkRect tests[] = {{0, 0, 2, 2}, {-0, -0, 2, 2}, {0.0f, 0.0f, 2, 2}}; 18cb93a386Sopenharmony_ci SkDebugf("tests are %s" "equal\n", tests[0] == tests[1] && tests[1] == tests[2] ? "" : "not "); 19cb93a386Sopenharmony_ci for (auto rect : tests) { 20cb93a386Sopenharmony_ci debugster(rect); 21cb93a386Sopenharmony_ci } 22cb93a386Sopenharmony_ci} 23cb93a386Sopenharmony_ci} // END FIDDLE 24