Fix test util to measure text properly based on flex direction (#1768)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1768 Depending on the flex direction text will either be capped to the measured size or to the longest word, so I added that functionality Reviewed By: mlord93 Differential Revision: D67106199 fbshipit-source-id: 0b4691768809004043a847f3fc5f7b94e92f1575
This commit is contained in:
committed by
Facebook GitHub Bot
parent
13f4adbbcd
commit
909e4bea6e
@@ -90,14 +90,20 @@ YGSize IntrinsicSizeMeasure(
|
||||
measuredHeight = std::min(
|
||||
calculateHeight(
|
||||
innerText,
|
||||
std::max(longestWordWidth(innerText, widthPerChar), measuredWidth),
|
||||
YGNodeStyleGetFlexDirection(node) == YGFlexDirectionColumn
|
||||
? measuredWidth
|
||||
: std::max(
|
||||
longestWordWidth(innerText, widthPerChar), measuredWidth),
|
||||
widthPerChar,
|
||||
heightPerChar),
|
||||
height);
|
||||
} else {
|
||||
measuredHeight = calculateHeight(
|
||||
innerText,
|
||||
std::max(longestWordWidth(innerText, widthPerChar), measuredWidth),
|
||||
YGNodeStyleGetFlexDirection(node) == YGFlexDirectionColumn
|
||||
? measuredWidth
|
||||
: std::max(
|
||||
longestWordWidth(innerText, widthPerChar), measuredWidth),
|
||||
widthPerChar,
|
||||
heightPerChar);
|
||||
}
|
||||
|
Reference in New Issue
Block a user