IsClosedSingleContourTest.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright 2015 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 "src/core/SkPathPriv.h"
  8. #include "tests/Test.h"
  9. DEF_TEST(IsClosedSingleContourTest, reporter) {
  10. SkPath p;
  11. REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
  12. p.reset();
  13. p.close();
  14. REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
  15. p.reset();
  16. p.moveTo(10, 10);
  17. p.close();
  18. REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p));
  19. p.reset();
  20. p.moveTo(10, 10);
  21. p.lineTo(20, 20);
  22. p.close();
  23. REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p));
  24. p.reset();
  25. p.moveTo(10, 10);
  26. p.lineTo(20, 20);
  27. p.quadTo(30, 30, 40, 40);
  28. p.cubicTo(50, 50, 60, 60, 70, 70);
  29. p.conicTo(30, 30, 40, 40, 0.5);
  30. p.close();
  31. REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p));
  32. p.reset();
  33. p.moveTo(10, 10);
  34. p.lineTo(20, 20);
  35. p.lineTo(20, 30);
  36. REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
  37. p.reset();
  38. p.moveTo(10, 10);
  39. p.lineTo(20, 20);
  40. p.moveTo(10, 10);
  41. p.lineTo(20, 30);
  42. p.close();
  43. REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
  44. p.reset();
  45. p.moveTo(10, 10);
  46. p.lineTo(20, 20);
  47. p.close();
  48. p.lineTo(20, 30);
  49. p.close();
  50. REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
  51. }