Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/opentype/FontSettingsTest.cpp

Issue 2581083003: Initial OpenType Font Variations Support (Closed)
Patch Set: Fix hash collision tests, adjust test expectations Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "platform/fonts/opentype/FontSettings.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "wtf/PassRefPtr.h"
9
10 namespace blink {
11
12 PassRefPtr<FontVariationSettings> makeFontVariationSettings(
13 std::initializer_list<FontVariationAxis> variationAxes) {
14 RefPtr<FontVariationSettings> variationSettings =
15 FontVariationSettings::create();
16
17 for (auto axis = variationAxes.begin(); axis != variationAxes.end(); ++axis) {
18 variationSettings->append(*axis);
19 }
20 return variationSettings;
21 }
22
23 TEST(FontSettingsTest, HashTest) {
24 RefPtr<FontVariationSettings> oneAxisA =
25 makeFontVariationSettings({FontVariationAxis{"a ", 0}});
26 RefPtr<FontVariationSettings> oneAxisB =
27 makeFontVariationSettings({FontVariationAxis{"b ", 0}});
28 RefPtr<FontVariationSettings> twoAxes = makeFontVariationSettings(
29 {FontVariationAxis{"a ", 0}, FontVariationAxis{"b ", 0}});
30 RefPtr<FontVariationSettings> twoAxesDifferentValue =
31 makeFontVariationSettings(
32 {FontVariationAxis{"a ", 0}, FontVariationAxis{"b ", 1}});
33
34 RefPtr<FontVariationSettings> emptyVariationSettings =
35 FontVariationSettings::create();
36
37 CHECK_NE(oneAxisA->hash(), oneAxisB->hash());
38 CHECK_NE(oneAxisA->hash(), twoAxes->hash());
39 CHECK_NE(oneAxisA->hash(), twoAxesDifferentValue->hash());
40 CHECK_NE(emptyVariationSettings->hash(), oneAxisA->hash());
41 CHECK_EQ(emptyVariationSettings->hash(), 0u);
42 };
43
44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698