Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: converted NativeAnimatedNodeTraversalTest to kotlin #37960

Conversation

ankit-tailor
Copy link
Contributor

Summary:

This PR converts NativeAnimatedNodeTraversalTest into Kotlin as requested in #37708

Changelog:

[INTERNAL] [CHANGED] - Convert NativeAnimatedNodeTraversalTest to Kotlin

Test Plan:

  1. Run ./gradlew :packages:react-native:ReactAndroid:test.
  2. All tests should pass.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 19, 2023
@ankit-tailor ankit-tailor changed the title refactor: conveted NativeAnimatedInterpolationTest to kotlin refactor: converted NativeAnimatedInterpolationTest to kotlin Jun 19, 2023
@facebook-github-bot
Copy link
Contributor

@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@analysis-bot
Copy link

analysis-bot commented Jun 19, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,744,604 -11,322
android hermes armeabi-v7a 8,056,781 -11,894
android hermes x86 9,235,685 -13,845
android hermes x86_64 9,086,535 -11,146
android jsc arm64-v8a 9,307,378 -9,752
android jsc armeabi-v7a 8,496,896 -10,316
android jsc x86 9,369,338 -12,274
android jsc x86_64 9,624,287 -9,567

Base commit: af57ce1
Branch: main

Copy link
Contributor

@rshest rshest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for working on this one!

@Pranav-yadav Pranav-yadav added the Tests This PR adds or edits a test case. label Jun 19, 2023
@rshest
Copy link
Contributor

rshest commented Jun 19, 2023

Hey @ankit-tailor, it looks like a couple of tests have disappeared during the conversion, namely testDecayAnimation, testDecayAnimationLoopsFiveTimes and testAnimationCallbackFinish.

Was it intentional? Could you please take a look into it?

Thanks!

Copy link
Contributor

@rshest rshest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ankit-tailor Sending back to you, need to understand the fate of disappeared test clauses, see my comment above :)

@ankit-tailor
Copy link
Contributor Author

@rshest My bad! Don't know how I missed them. Added them back.

@facebook-github-bot
Copy link
Contributor

@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepting as mine are mostly nits. @rshest is going to merge this and we'll need to follow up afterwards

Comment on lines +104 to +110
val directEventTypes: Map<String, Map<String, String>>? =
uiManagerMock?.constants?.get("customDirectEventTypes")
as? Map<String, Map<String, String>>?
if (directEventTypes != null) {
val customEventType: Map<String, String>? =
directEventTypes[eventName] as? Map<String, String>?
if (customEventType != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified (i.e. no need to null check those fields are you're creating them). cc @rshest if you want to integrate this change

}

fun performSpringAnimationTestWithConfig(
config: JavaOnlyMap?,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be non nullable. Plus this function can be private (cc @rshest)

if (i % 3 != 0) {
// i % 3 != 0 because every 3 frames we go a tiny
// bit faster, because frame length is 16.(6)ms
assertThat(currentDiff).`as`("on frame " + i).isLessThanOrEqualTo(previousDiff)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's import as as describe or something else 😅

@facebook-github-bot
Copy link
Contributor

@rshest merged this pull request in 3d6a2a9.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jun 19, 2023
cortinico added a commit that referenced this pull request Jun 20, 2023
Summary:
Follow up to:
- #37960

## Changelog:

[INTERNAL] - Update NativeAnimatedNodeTraversalTest to be more idiomatic

Pull Request resolved: #37970

Test Plan: Will run on CI

Reviewed By: javache, cipolleschi

Differential Revision: D46853581

Pulled By: cortinico

fbshipit-source-id: 1d324d0d9d24f97bc1ae5c702949615e45837cb8
@ankit-tailor ankit-tailor changed the title refactor: converted NativeAnimatedInterpolationTest to kotlin refactor: converted NativeAnimatedNodeTraversalTest to kotlin Jun 21, 2023
facebook-github-bot pushed a commit that referenced this pull request Jun 23, 2023
Summary:
Follow up to:
- #37960

## Changelog:

[INTERNAL] - Update NativeAnimatedNodeTraversalTest to be more idiomatic

Pull Request resolved: #37970

Test Plan: Will run on CI

Reviewed By: javache, cipolleschi

Differential Revision: D46853581

Pulled By: cortinico

fbshipit-source-id: 73776493163413b045482344b7b1be0635f5aa25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Tests This PR adds or edits a test case.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants