Skip to content

Commit

Permalink
Add default test for box sizing
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/yoga#1716

Had a mini heart attack thinking I set the default to content box. Wrote this to double check and it passed. Might as well check it in

Technically the default to BoxSizing.h is ContentBox, but in the style we override that. Regardless I switched that around so border box was the default.

Changelog: [Internal]

Differential Revision: D63802722
  • Loading branch information
joevilches authored and facebook-github-bot committed Oct 3, 2024
1 parent 5e47ef9 commit 808a7ba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
package com.facebook.yoga;

public enum YogaBoxSizing {
CONTENT_BOX(0),
BORDER_BOX(1);
BORDER_BOX(0),
CONTENT_BOX(1);

private final int mIntValue;

Expand All @@ -25,8 +25,8 @@ public int intValue() {

public static YogaBoxSizing fromInt(int value) {
switch (value) {
case 0: return CONTENT_BOX;
case 1: return BORDER_BOX;
case 0: return BORDER_BOX;
case 1: return CONTENT_BOX;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ const char* YGAlignToString(const YGAlign value) {

const char* YGBoxSizingToString(const YGBoxSizing value) {
switch (value) {
case YGBoxSizingContentBox:
return "content-box";
case YGBoxSizingBorderBox:
return "border-box";
case YGBoxSizingContentBox:
return "content-box";
}
return "unknown";
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/ReactCommon/yoga/yoga/YGEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ YG_ENUM_DECL(

YG_ENUM_DECL(
YGBoxSizing,
YGBoxSizingContentBox,
YGBoxSizingBorderBox)
YGBoxSizingBorderBox,
YGBoxSizingContentBox)

YG_ENUM_DECL(
YGDimension,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
namespace facebook::yoga {

enum class BoxSizing : uint8_t {
ContentBox = YGBoxSizingContentBox,
BorderBox = YGBoxSizingBorderBox,
ContentBox = YGBoxSizingContentBox,
};

template <>
Expand Down

0 comments on commit 808a7ba

Please sign in to comment.