-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ImageResizeModeTest.java => ImageResizeModeTest.kt (#38844)
Summary: This PR converts ImageResizeModeTest into Kotlin as requested in #38825 . ## Changelog: [INTERNAL] [CHANGED] - Convert to ImageResizeModeTest Kotlin Pull Request resolved: #38844 Test Plan: 1. Run `./gradlew :packages:react-native:ReactAndroid:test`. 2. All tests should pass. Reviewed By: rshest Differential Revision: D48154896 Pulled By: cortinico fbshipit-source-id: df131a4f3f9190af8d7b77e625e050f02824ad07
- Loading branch information
1 parent
3660b7c
commit 639b489
Showing
2 changed files
with
41 additions
and
44 deletions.
There are no files selected for viewing
44 changes: 0 additions & 44 deletions
44
...native/ReactAndroid/src/test/java/com/facebook/react/views/image/ImageResizeModeTest.java
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...t-native/ReactAndroid/src/test/java/com/facebook/react/views/image/ImageResizeModeTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.react.views.image | ||
|
||
import com.facebook.drawee.drawable.ScalingUtils | ||
import org.assertj.core.api.Assertions | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.powermock.core.classloader.annotations.PowerMockIgnore | ||
import org.powermock.modules.junit4.rule.PowerMockRule | ||
import org.robolectric.RobolectricTestRunner | ||
|
||
@RunWith(RobolectricTestRunner::class) | ||
@PowerMockIgnore("org.mockito.*", "org.robolectric.*", "androidx.*", "android.*") | ||
class ImageResizeModeTest { | ||
@get:Rule var rule = PowerMockRule() | ||
|
||
@Test | ||
fun testImageResizeMode() { | ||
Assertions.assertThat(ImageResizeMode.toScaleType(null)) | ||
.isEqualTo(ScalingUtils.ScaleType.CENTER_CROP) | ||
Assertions.assertThat(ImageResizeMode.toScaleType("contain")) | ||
.isEqualTo(ScalingUtils.ScaleType.FIT_CENTER) | ||
Assertions.assertThat(ImageResizeMode.toScaleType("cover")) | ||
.isEqualTo(ScalingUtils.ScaleType.CENTER_CROP) | ||
Assertions.assertThat(ImageResizeMode.toScaleType("stretch")) | ||
.isEqualTo(ScalingUtils.ScaleType.FIT_XY) | ||
Assertions.assertThat(ImageResizeMode.toScaleType("center")) | ||
.isEqualTo(ScalingUtils.ScaleType.CENTER_INSIDE) | ||
|
||
// No resizeMode set | ||
Assertions.assertThat(ImageResizeMode.defaultValue()) | ||
.isEqualTo(ScalingUtils.ScaleType.CENTER_CROP) | ||
} | ||
} |