skia2/tests/GlyphRunTest.cpp
Herb Derby c0a2708172 Revert "Use new SkGlyphIDSet - v2"
This reverts commit 0421083a44.

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 <mtklein@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

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 <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2018-07-11 20:08:23 +00:00

45 lines
1.2 KiB
C++

/*
* Copyright 2018 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkGlyphRun.h"
#include "SkTextBlob.h"
#include "Test.h"
DEF_TEST(GlyphSetBasic, reporter) {
SkGlyphSet set;
std::vector<SkGlyphID> 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) {
SkGlyphID glyphs[] = {100, 3, 240, 3, 234, 111, 3, 4, 10, 11};
uint16_t count = SK_ARRAY_COUNT(glyphs);
SkPaint paint;
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
SkGlyphRunBuilder builder;
builder.prepareDrawText(paint, glyphs, count, SkPoint::Make(0, 0));
}