Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ inline bool areTextAttributesEquivalentLayoutWise(const TextAttributes &lhs, con
lhs.fontStyle,
lhs.fontVariant,
lhs.allowFontScaling,
lhs.maxFontSizeMultiplier,
lhs.dynamicTypeRamp,
lhs.alignment) ==
std::tie(
Expand All @@ -127,6 +128,7 @@ inline bool areTextAttributesEquivalentLayoutWise(const TextAttributes &lhs, con
rhs.fontStyle,
rhs.fontVariant,
rhs.allowFontScaling,
rhs.maxFontSizeMultiplier,
rhs.dynamicTypeRamp,
rhs.alignment) &&
floatEquality(lhs.fontSize, rhs.fontSize) && floatEquality(lhs.fontSizeMultiplier, rhs.fontSizeMultiplier) &&
Expand All @@ -145,6 +147,7 @@ inline size_t textAttributesHashLayoutWise(const TextAttributes &textAttributes)
textAttributes.fontStyle,
textAttributes.fontVariant,
textAttributes.allowFontScaling,
textAttributes.maxFontSizeMultiplier,
textAttributes.dynamicTypeRamp,
textAttributes.letterSpacing,
textAttributes.lineHeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,33 @@
* LICENSE file in the root directory of this source tree.
*/

#include <memory>

#include <gtest/gtest.h>

#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
#include <react/renderer/textlayoutmanager/TextMeasureCache.h>

using namespace facebook::react;

TEST(TextLayoutManagerTest, testSomething) {
// TODO:
TEST(TextLayoutManagerTest, maxFontSizeMultiplierAffectsLayoutCacheEquality) {
TextAttributes lhs;
TextAttributes rhs;

lhs.fontSize = rhs.fontSize = 16;
lhs.fontSizeMultiplier = rhs.fontSizeMultiplier = 2;
lhs.maxFontSizeMultiplier = 1;
rhs.maxFontSizeMultiplier = 2;

EXPECT_FALSE(areTextAttributesEquivalentLayoutWise(lhs, rhs));
}

TEST(TextLayoutManagerTest, maxFontSizeMultiplierAffectsLayoutCacheHash) {
TextAttributes lhs;
TextAttributes rhs;

lhs.fontSize = rhs.fontSize = 16;
lhs.fontSizeMultiplier = rhs.fontSizeMultiplier = 2;
lhs.maxFontSizeMultiplier = 1;
rhs.maxFontSizeMultiplier = 2;

EXPECT_NE(
textAttributesHashLayoutWise(lhs), textAttributesHashLayoutWise(rhs));
}
Loading