Skip to content

Commit e3b2818

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Add test for -0.0 float
Summary: This was an idea to check by Joshua Gross Changelog: [General][Internal] Codegen: Adding test for negative zero floats Reviewed By: JoshuaGross Differential Revision: D14378418 fbshipit-source-id: 4d18eea18143c501d3f2e7ba334f35ec1dd140e6
1 parent 544d9fb commit e3b2818

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

packages/react-native-codegen/src/generators/__test_fixtures__/fixtures.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ const FLOAT_PROPS: SchemaType = {
213213
default: 1,
214214
},
215215
},
216+
{
217+
name: 'blurRadius6',
218+
optional: true,
219+
typeAnnotation: {
220+
type: 'FloatTypeAnnotation',
221+
default: -0.0,
222+
},
223+
},
216224
],
217225
},
218226
},

packages/react-native-codegen/src/generators/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ FloatPropNativeComponentProps::FloatPropNativeComponentProps(
169169
blurRadius2(convertRawProp(rawProps, \\"blurRadius2\\", sourceProps.blurRadius2, blurRadius2)),
170170
blurRadius3(convertRawProp(rawProps, \\"blurRadius3\\", sourceProps.blurRadius3, blurRadius3)),
171171
blurRadius4(convertRawProp(rawProps, \\"blurRadius4\\", sourceProps.blurRadius4, blurRadius4)),
172-
blurRadius5(convertRawProp(rawProps, \\"blurRadius5\\", sourceProps.blurRadius5, blurRadius5))
172+
blurRadius5(convertRawProp(rawProps, \\"blurRadius5\\", sourceProps.blurRadius5, blurRadius5)),
173+
blurRadius6(convertRawProp(rawProps, \\"blurRadius6\\", sourceProps.blurRadius6, blurRadius6))
173174
{}
174175
175176
} // namespace react

packages/react-native-codegen/src/generators/__tests__/__snapshots__/GeneratePropsH-test.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ const Float blurRadius2{0.001};
207207
const Float blurRadius3{2.1};
208208
const Float blurRadius4{0.0};
209209
const Float blurRadius5{1.0};
210+
const Float blurRadius6{0.0};
210211
};
211212
212213
} // namespace react

packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ const FloatPropNativeComponentViewConfig = {
226226
blurRadius3: true,
227227
blurRadius4: true,
228228
blurRadius5: true,
229+
blurRadius6: true,
229230
style: ReactNativeStyleAttributes
230231
}
231232
};

0 commit comments

Comments
 (0)