From c0a27081722eaebd005cf9c2eb78d7d1e4db7e2c Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Wed, 11 Jul 2018 20:05:53 +0000 Subject: Revert "Use new SkGlyphIDSet - v2" This reverts commit 0421083a447a8ab105d20c786f7d8377f30a6d5d. Reason for revert: fushia page fault Original change's description: > Use new SkGlyphIDSet - v2 > > Add bzero to make msan and valgrind happy. > > Change-Id: I9b4e2f2b8e690da4b4b920fef27d5a8854092219 > Reviewed-on: https://skia-review.googlesource.com/140563 > Reviewed-by: Mike Klein > Commit-Queue: Herb Derby TBR=mtklein@google.com,herb@google.com Change-Id: I4e5e16644cbf56b5ff0b21afd6f3962e3976a1da No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/140803 Reviewed-by: Herb Derby Commit-Queue: Herb Derby --- tests/GlyphRunTest.cpp | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) (limited to 'tests') diff --git a/tests/GlyphRunTest.cpp b/tests/GlyphRunTest.cpp index 0e0c441b75..46b4715c61 100644 --- a/tests/GlyphRunTest.cpp +++ b/tests/GlyphRunTest.cpp @@ -11,32 +11,25 @@ #include "Test.h" -DEF_TEST(GlyphRunGlyphIDSetBasic, reporter) { - SkGlyphID glyphs[] = {100, 3, 240, 3, 234}; - auto glyphIDs = SkSpan(glyphs, SK_ARRAY_COUNT(glyphs)); - int universeSize = 1000; - SkGlyphID uniqueGlyphs[SK_ARRAY_COUNT(glyphs)]; - uint16_t denseIndices[SK_ARRAY_COUNT(glyphs)]; - - SkGlyphIDSet gs; - auto uniqueGlyphIDs = gs.uniquifyGlyphIDs(universeSize, glyphIDs, uniqueGlyphs, denseIndices); - - std::vector test{uniqueGlyphIDs.begin(), uniqueGlyphIDs.end()}; - std::sort(test.begin(), test.end()); - auto newEnd = std::unique(test.begin(), test.end()); - REPORTER_ASSERT(reporter, uniqueGlyphIDs.size() == newEnd - test.begin()); - REPORTER_ASSERT(reporter, uniqueGlyphIDs.size() == 4); - { - uint16_t answer[] = {0, 1, 2, 1, 3}; - REPORTER_ASSERT(reporter, - std::equal(answer, std::end(answer), denseIndices)); - } - - { - SkGlyphID answer[] = {100, 3, 240, 234}; - REPORTER_ASSERT(reporter, - std::equal(answer, std::end(answer), uniqueGlyphs)); - } +DEF_TEST(GlyphSetBasic, reporter) { + SkGlyphSet set; + + std::vector unique; + + set.reuse(10, &unique); + REPORTER_ASSERT(reporter, set.add(7) == 0); + REPORTER_ASSERT(reporter, set.add(3) == 1); + set.reuse(10, &unique); + REPORTER_ASSERT(reporter, set.add(5) == 0); + REPORTER_ASSERT(reporter, set.add(8) == 1); + REPORTER_ASSERT(reporter, set.add(3) == 2); + + REPORTER_ASSERT(reporter, unique.size() == 5); + REPORTER_ASSERT(reporter, unique[0] == 7); + REPORTER_ASSERT(reporter, unique[1] == 3); + REPORTER_ASSERT(reporter, unique[2] == 5); + REPORTER_ASSERT(reporter, unique[3] == 8); + REPORTER_ASSERT(reporter, unique[4] == 3); } DEF_TEST(GlyphRunBasic, reporter) { -- cgit v1.2.3