Enable JVM Unit Tests for Gradle
Summary: This makes sure all the tests are executed inside the `ReactAndroid/src/test` folder. Currently, we're not executing those tests as they're broken. In this diff I took care of: - Re-enabling them as much as I could - Ignoring the ones that are ignored also on BUCK Those tests will have to be entirely re-written as they're using PowerMock which is unmaintained and not working well with JDK 17+ (that's also why I had to add the `--illegal-access=permit` and the `--add-opens` directing to allow mocking). In general, I believe this is a net positive change as it allows us to add new JUnit tests that are effectively executed, while the current status is ignoring all of them. Changelog: [Internal] [Changed] - Enable JVM Unit Tests for Gradle Reviewed By: cipolleschi Differential Revision: D41523697 fbshipit-source-id: dc9f2c4c93d0e6b231e8240a583ca31220152d3f
This commit is contained in:
Родитель
342c0beafa
Коммит
a389373442
|
@ -74,9 +74,9 @@ tasks.register("buildAll") {
|
|||
dependsOn(":packages:react-native:ReactAndroid:installArchives")
|
||||
// This builds RN Tester for Hermes/JSC for debug and release
|
||||
dependsOn(":packages:rn-tester:android:app:assemble")
|
||||
// This compiles the Unit Test sources (without running them as they're partially broken)
|
||||
dependsOn(":packages:react-native:ReactAndroid:compileDebugUnitTestSources")
|
||||
dependsOn(":packages:react-native:ReactAndroid:compileReleaseUnitTestSources")
|
||||
// Runs Unit tests for both ReactAndroid and RN-Tester
|
||||
dependsOn(":packages:react-native:ReactAndroid:test")
|
||||
dependsOn(":packages:rn-tester:android:app:test")
|
||||
}
|
||||
|
||||
tasks.register("downloadAll") {
|
||||
|
|
|
@ -681,6 +681,7 @@ dependencies {
|
|||
testImplementation("org.powermock:powermock-classloading-xstream:${POWERMOCK_VERSION}")
|
||||
testImplementation("org.powermock:powermock-module-junit4-rule:${POWERMOCK_VERSION}")
|
||||
testImplementation("org.robolectric:robolectric:${ROBOLECTRIC_VERSION}")
|
||||
testImplementation("com.thoughtworks.xstream:xstream:1.4.20")
|
||||
|
||||
androidTestImplementation(fileTree(dir: "src/main/third-party/java/buck-android-support/", include: ["*.jar"]))
|
||||
androidTestImplementation("androidx.test:runner:${ANDROIDX_TEST_VERSION}")
|
||||
|
@ -701,6 +702,26 @@ react {
|
|||
jsRootDir = file("../Libraries")
|
||||
}
|
||||
|
||||
tasks.withType(Test).all {
|
||||
// We add --add-opens flags to make sure we can run PowerMock tests on JDK >= 17
|
||||
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
|
||||
jvmArgs += [
|
||||
"-XX:+AllowRedefinitionToAddDeleteMethods",
|
||||
"--illegal-access=permit",
|
||||
"--add-opens=java.base/java.lang=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.xml.internal=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.util=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.net=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.security=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.io=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.nio=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.nio.charset=ALL-UNNAMED",
|
||||
"--add-opens=java.base/jdk.xml.internal=ALL-UNNAMED",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "org.jetbrains.kotlin.android"
|
||||
|
||||
/* Publishing Configuration */
|
||||
|
|
|
@ -12,13 +12,13 @@ FRESCO_VERSION=2.5.0
|
|||
INFER_ANNOTATIONS_VERSION=0.18.0
|
||||
JAVAX_INJECT_VERSION=1
|
||||
JSR305_VERSION=3.0.2
|
||||
JUNIT_VERSION=4.12
|
||||
MOCKITO_CORE_VERSION=2.26.0
|
||||
JUNIT_VERSION=4.13.2
|
||||
MOCKITO_CORE_VERSION=2.28.2
|
||||
OKHTTP_VERSION=4.9.2
|
||||
OKIO_VERSION=2.9.0
|
||||
POWERMOCK_VERSION=2.0.2
|
||||
POWERMOCK_VERSION=2.0.9
|
||||
PROGUARD_ANNOTATIONS_VERSION=1.19.0
|
||||
ROBOLECTRIC_VERSION=4.4
|
||||
ROBOLECTRIC_VERSION=4.9.2
|
||||
SO_LOADER_VERSION=0.10.5
|
||||
SWIPEREFRESH_LAYOUT_VERSION=1.0.0
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class ReactActivityDelegateTest {
|
|||
object : ReactActivityDelegate(null, "test-delegate") {
|
||||
override fun isFabricEnabled() = true
|
||||
public val inspectLaunchOptions: Bundle?
|
||||
get() = getLaunchOptions()
|
||||
get() = composeLaunchOptions()
|
||||
}
|
||||
|
||||
assertNotNull(delegate.inspectLaunchOptions)
|
||||
|
@ -36,7 +36,7 @@ class ReactActivityDelegateTest {
|
|||
object : ReactActivityDelegate(null, "test-delegate") {
|
||||
override fun isFabricEnabled() = false
|
||||
public val inspectLaunchOptions: Bundle?
|
||||
get() = getLaunchOptions()
|
||||
get() = composeLaunchOptions()
|
||||
}
|
||||
|
||||
assertNull(delegate.inspectLaunchOptions)
|
||||
|
@ -50,7 +50,7 @@ class ReactActivityDelegateTest {
|
|||
override fun getLaunchOptions(): Bundle =
|
||||
Bundle().apply { putString("test-property", "test-value") }
|
||||
public val inspectLaunchOptions: Bundle?
|
||||
get() = getLaunchOptions()
|
||||
get() = composeLaunchOptions()
|
||||
}
|
||||
|
||||
assertNotNull(delegate.inspectLaunchOptions)
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
package com.facebook.react;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
@ -91,7 +91,7 @@ public class RootViewTest {
|
|||
});
|
||||
|
||||
mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
|
||||
mReactContext = spy(new ReactApplicationContext(RuntimeEnvironment.application));
|
||||
mReactContext = spy(new ReactApplicationContext(RuntimeEnvironment.getApplication()));
|
||||
mReactContext.initializeWithInstance(mCatalystInstanceMock);
|
||||
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(mReactContext);
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
package com.facebook.react.animated;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.atMost;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.reset;
|
||||
|
|
|
@ -12,6 +12,7 @@ import static org.mockito.Mockito.when;
|
|||
import com.facebook.soloader.SoLoader;
|
||||
import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -25,6 +26,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
@PrepareForTest({ReadableNativeArray.class, SoLoader.class})
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Ignore("Ignored due to unsupported mocking mechanism with JDK 18")
|
||||
public class BaseJavaModuleTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
|
|
@ -26,7 +26,8 @@ public class ReactTestHelper {
|
|||
* #createMockCatalystInstance}
|
||||
*/
|
||||
public static ReactApplicationContext createCatalystContextForTest() {
|
||||
ReactApplicationContext context = new ReactApplicationContext(RuntimeEnvironment.application);
|
||||
ReactApplicationContext context =
|
||||
new ReactApplicationContext(RuntimeEnvironment.getApplication());
|
||||
context.initializeWithInstance(createMockCatalystInstance());
|
||||
return context;
|
||||
}
|
||||
|
|
|
@ -7,12 +7,18 @@
|
|||
|
||||
package com.facebook.react.devsupport;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isA;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.never;
|
||||
|
||||
import com.facebook.react.common.JavascriptException;
|
||||
import java.util.HashMap;
|
||||
import okhttp3.WebSocket;
|
||||
import okio.ByteString;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -25,6 +31,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
@PrepareForTest({JSDebuggerWebSocketClient.class})
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore("Ignored due to unsupported mocking mechanism with JDK 18")
|
||||
public class JSDebuggerWebSocketClientTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
@ -76,7 +83,8 @@ public class JSDebuggerWebSocketClientTest {
|
|||
JSDebuggerWebSocketClient client = PowerMockito.spy(new JSDebuggerWebSocketClient());
|
||||
|
||||
client.onMessage(
|
||||
mock(WebSocket.class), ByteString.encodeUtf8("{\"replyID\":0, \"result\":\"OK\"}"));
|
||||
PowerMockito.mock(WebSocket.class),
|
||||
ByteString.encodeUtf8("{\"replyID\":0, \"result\":\"OK\"}"));
|
||||
PowerMockito.verifyPrivate(client, never())
|
||||
.invoke("triggerRequestSuccess", anyInt(), nullable(String.class));
|
||||
PowerMockito.verifyPrivate(client, never()).invoke("triggerRequestFailure", anyInt(), any());
|
||||
|
|
|
@ -11,8 +11,8 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.powermock.api.mockito.PowerMockito.doAnswer;
|
||||
import static org.powermock.api.mockito.PowerMockito.mock;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.Mockito.times;
|
||||
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -27,7 +27,6 @@ import com.facebook.react.uimanager.DisplayMetricsHolder;
|
|||
import com.facebook.react.uimanager.events.TouchEvent;
|
||||
import com.facebook.react.uimanager.events.TouchEventCoalescingKeyHelper;
|
||||
import com.facebook.react.uimanager.events.TouchEventType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -35,7 +34,8 @@ import org.junit.Before;
|
|||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
|
@ -451,6 +451,8 @@ public class TouchEventDispatchTest {
|
|||
List<ReadableMap> mDispatchedEvents;
|
||||
FabricEventEmitter mEventEmitter;
|
||||
|
||||
FabricUIManager mUIManager;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
PowerMockito.mockStatic(Arguments.class);
|
||||
|
@ -478,26 +480,8 @@ public class TouchEventDispatchTest {
|
|||
metrics.density = 1f;
|
||||
DisplayMetricsHolder.setWindowDisplayMetrics(metrics);
|
||||
|
||||
FabricUIManager fabricUIManager = mock(FabricUIManager.class);
|
||||
mDispatchedEvents = new ArrayList<>();
|
||||
doAnswer(
|
||||
new Answer<Void>() {
|
||||
@Override
|
||||
public Void answer(InvocationOnMock invocation) {
|
||||
mDispatchedEvents.add(invocation.<ReadableMap>getArgument(5));
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.when(fabricUIManager)
|
||||
.receiveEvent(
|
||||
anyInt(),
|
||||
anyInt(),
|
||||
anyString(),
|
||||
anyBoolean(),
|
||||
anyInt(),
|
||||
ArgumentMatchers.<WritableMap>any(),
|
||||
anyInt());
|
||||
mEventEmitter = new FabricEventEmitter(fabricUIManager);
|
||||
mUIManager = Mockito.mock(FabricUIManager.class);
|
||||
mEventEmitter = new FabricEventEmitter(mUIManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -505,8 +489,12 @@ public class TouchEventDispatchTest {
|
|||
for (TouchEvent event : mStartMoveEndSequence) {
|
||||
event.dispatchModern(mEventEmitter);
|
||||
}
|
||||
ArgumentCaptor<WritableMap> argument = ArgumentCaptor.forClass(WritableMap.class);
|
||||
verify(mUIManager, times(4))
|
||||
.receiveEvent(
|
||||
anyInt(), anyInt(), anyString(), anyBoolean(), anyInt(), argument.capture(), anyInt());
|
||||
|
||||
assertEquals(mStartMoveEndExpectedSequence, mDispatchedEvents);
|
||||
assertEquals(mStartMoveEndExpectedSequence, argument.getAllValues());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -514,8 +502,12 @@ public class TouchEventDispatchTest {
|
|||
for (TouchEvent event : mStartMoveCancelSequence) {
|
||||
event.dispatchModern(mEventEmitter);
|
||||
}
|
||||
ArgumentCaptor<WritableMap> argument = ArgumentCaptor.forClass(WritableMap.class);
|
||||
verify(mUIManager, times(6))
|
||||
.receiveEvent(
|
||||
anyInt(), anyInt(), anyString(), anyBoolean(), anyInt(), argument.capture(), anyInt());
|
||||
|
||||
assertEquals(mStartMoveCancelExpectedSequence, mDispatchedEvents);
|
||||
assertEquals(mStartMoveCancelExpectedSequence, argument.getAllValues());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -523,8 +515,12 @@ public class TouchEventDispatchTest {
|
|||
for (TouchEvent event : mStartPointerMoveUpSequence) {
|
||||
event.dispatchModern(mEventEmitter);
|
||||
}
|
||||
ArgumentCaptor<WritableMap> argument = ArgumentCaptor.forClass(WritableMap.class);
|
||||
verify(mUIManager, times(6))
|
||||
.receiveEvent(
|
||||
anyInt(), anyInt(), anyString(), anyBoolean(), anyInt(), argument.capture(), anyInt());
|
||||
|
||||
assertEquals(mStartPointerMoveUpExpectedSequence, mDispatchedEvents);
|
||||
assertEquals(mStartPointerMoveUpExpectedSequence, argument.getAllValues());
|
||||
}
|
||||
|
||||
private TouchEvent createTouchEvent(
|
||||
|
|
|
@ -34,10 +34,10 @@ public class ClipboardModuleTest {
|
|||
@Before
|
||||
public void setUp() {
|
||||
mClipboardModule =
|
||||
new ClipboardModule(new ReactApplicationContext(RuntimeEnvironment.application));
|
||||
new ClipboardModule(new ReactApplicationContext(RuntimeEnvironment.getApplication()));
|
||||
mClipboardManager =
|
||||
(ClipboardManager)
|
||||
RuntimeEnvironment.application.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
RuntimeEnvironment.getApplication().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
package com.facebook.react.modules.deviceinfo;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Matchers.anyObject;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
@ -60,7 +60,7 @@ public class DeviceInfoModuleTest extends TestCase {
|
|||
initTestData();
|
||||
|
||||
mockStatic(DisplayMetricsHolder.class);
|
||||
mContext = spy(new ReactApplicationContext(RuntimeEnvironment.application));
|
||||
mContext = spy(new ReactApplicationContext(RuntimeEnvironment.getApplication()));
|
||||
CatalystInstance catalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
|
||||
mContext.initializeWithInstance(catalystInstanceMock);
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class DeviceInfoModuleTest extends TestCase {
|
|||
mDeviceInfoModule.getTypedExportedConstants();
|
||||
mDeviceInfoModule.emitUpdateDimensionsEvent();
|
||||
|
||||
verify(mContext, times(0)).emitDeviceEvent(anyString(), anyObject());
|
||||
verify(mContext, times(0)).emitDeviceEvent(anyString(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
|
||||
package com.facebook.react.modules.dialog;
|
||||
|
||||
import static android.os.Looper.getMainLooper;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.robolectric.Shadows.shadowOf;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
|
@ -19,6 +21,7 @@ import com.facebook.react.bridge.JavaOnlyMap;
|
|||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
|
@ -29,6 +32,7 @@ import org.robolectric.android.controller.ActivityController;
|
|||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore("Ignored due to unsupported mocking mechanism with JDK 18")
|
||||
public class DialogModuleTest {
|
||||
|
||||
private ActivityController<FragmentActivity> mActivityController;
|
||||
|
@ -86,8 +90,10 @@ public class DialogModuleTest {
|
|||
options.putBoolean("cancelable", false);
|
||||
|
||||
mDialogModule.showAlert(options, null, null);
|
||||
shadowOf(getMainLooper()).idle();
|
||||
|
||||
final AlertFragment fragment = getFragment();
|
||||
|
||||
assertNotNull("Fragment was not displayed", fragment);
|
||||
assertFalse(fragment.isCancelable());
|
||||
|
||||
|
@ -104,9 +110,11 @@ public class DialogModuleTest {
|
|||
|
||||
final SimpleCallback actionCallback = new SimpleCallback();
|
||||
mDialogModule.showAlert(options, null, actionCallback);
|
||||
shadowOf(getMainLooper()).idle();
|
||||
|
||||
final AlertDialog dialog = (AlertDialog) getFragment().getDialog();
|
||||
dialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
|
||||
shadowOf(getMainLooper()).idle();
|
||||
|
||||
assertEquals(1, actionCallback.getCalls());
|
||||
assertEquals(DialogModule.ACTION_BUTTON_CLICKED, actionCallback.getArgs()[0]);
|
||||
|
@ -120,9 +128,11 @@ public class DialogModuleTest {
|
|||
|
||||
final SimpleCallback actionCallback = new SimpleCallback();
|
||||
mDialogModule.showAlert(options, null, actionCallback);
|
||||
shadowOf(getMainLooper()).idle();
|
||||
|
||||
final AlertDialog dialog = (AlertDialog) getFragment().getDialog();
|
||||
dialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick();
|
||||
shadowOf(getMainLooper()).idle();
|
||||
|
||||
assertEquals(1, actionCallback.getCalls());
|
||||
assertEquals(DialogModule.ACTION_BUTTON_CLICKED, actionCallback.getArgs()[0]);
|
||||
|
@ -136,9 +146,11 @@ public class DialogModuleTest {
|
|||
|
||||
final SimpleCallback actionCallback = new SimpleCallback();
|
||||
mDialogModule.showAlert(options, null, actionCallback);
|
||||
shadowOf(getMainLooper()).idle();
|
||||
|
||||
final AlertDialog dialog = (AlertDialog) getFragment().getDialog();
|
||||
dialog.getButton(DialogInterface.BUTTON_NEUTRAL).performClick();
|
||||
shadowOf(getMainLooper()).idle();
|
||||
|
||||
assertEquals(1, actionCallback.getCalls());
|
||||
assertEquals(DialogModule.ACTION_BUTTON_CLICKED, actionCallback.getArgs()[0]);
|
||||
|
@ -151,8 +163,10 @@ public class DialogModuleTest {
|
|||
|
||||
final SimpleCallback actionCallback = new SimpleCallback();
|
||||
mDialogModule.showAlert(options, null, actionCallback);
|
||||
shadowOf(getMainLooper()).idle();
|
||||
|
||||
getFragment().getDialog().dismiss();
|
||||
shadowOf(getMainLooper()).idle();
|
||||
|
||||
assertEquals(1, actionCallback.getCalls());
|
||||
assertEquals(DialogModule.ACTION_DISMISSED, actionCallback.getArgs()[0]);
|
||||
|
|
|
@ -37,6 +37,7 @@ import okhttp3.Request;
|
|||
import okhttp3.RequestBody;
|
||||
import okio.Buffer;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -66,6 +67,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
})
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore("Ignored due to unsupported mocking mechanism with JDK 18")
|
||||
public class NetworkingModuleTest {
|
||||
private NetworkingModule mNetworkingModule;
|
||||
private OkHttpClient mHttpClient;
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.facebook.react.bridge.ReactTestHelper;
|
|||
import com.facebook.react.bridge.WritableMap;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -50,6 +51,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||
"org.springframework.context.*",
|
||||
"org.apache.log4j.*"
|
||||
})
|
||||
@Ignore("Ignored due to unsupported mocking mechanism with JDK 18")
|
||||
public class ShareModuleTest {
|
||||
|
||||
private Activity mActivity;
|
||||
|
@ -96,7 +98,8 @@ public class ShareModuleTest {
|
|||
|
||||
mShareModule.share(content, dialogTitle, promise);
|
||||
|
||||
final Intent chooserIntent = shadowOf(RuntimeEnvironment.application).getNextStartedActivity();
|
||||
final Intent chooserIntent =
|
||||
shadowOf(RuntimeEnvironment.getApplication()).getNextStartedActivity();
|
||||
assertNotNull("Dialog was not displayed", chooserIntent);
|
||||
assertEquals(Intent.ACTION_CHOOSER, chooserIntent.getAction());
|
||||
assertEquals(dialogTitle, chooserIntent.getExtras().get(Intent.EXTRA_TITLE));
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.facebook.react.modules.core.JSTimers;
|
|||
import com.facebook.react.modules.core.ReactChoreographer;
|
||||
import com.facebook.react.modules.core.TimingModule;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -34,10 +35,10 @@ import org.robolectric.RobolectricTestRunner;
|
|||
|
||||
/** Tests for {@link TimingModule}. */
|
||||
// DISABLED, BROKEN https://circleci.com/gh/facebook/react-native/12068
|
||||
// t=13905097
|
||||
@PrepareForTest({Arguments.class, SystemClock.class, ReactChoreographer.class})
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Ignore // TODO T13905097
|
||||
public class TimingModuleTest {
|
||||
|
||||
private static final long FRAME_TIME_NS = 17 * 1000 * 1000; // 17 ms
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.facebook.react.views.view.ReactViewGroup;
|
|||
import com.facebook.react.views.view.ReactViewManager;
|
||||
import java.util.Locale;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -33,6 +34,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||
@PrepareForTest({Arguments.class})
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T14964130
|
||||
public class BaseViewManagerTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
@ -43,7 +45,7 @@ public class BaseViewManagerTest {
|
|||
@Before
|
||||
public void setUp() {
|
||||
mViewManager = new ReactViewManager();
|
||||
mView = new ReactViewGroup(RuntimeEnvironment.application);
|
||||
mView = new ReactViewGroup(RuntimeEnvironment.getApplication());
|
||||
PowerMockito.mockStatic(Arguments.class);
|
||||
PowerMockito.when(Arguments.createMap())
|
||||
.thenAnswer(
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
package com.facebook.react.uimanager;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyFloat;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyFloat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
@ -28,6 +28,7 @@ import com.facebook.yoga.YogaJustify;
|
|||
import com.facebook.yoga.YogaPositionType;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -41,6 +42,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
@PrepareForTest({PixelUtil.class})
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T14964130
|
||||
public class LayoutPropertyApplicatorTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
|
|
@ -9,12 +9,14 @@ package com.facebook.react.uimanager;
|
|||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
/** Test for {@link MatrixMathHelper} */
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Ignore // TODO T14964130
|
||||
public class MatrixMathHelperTest {
|
||||
|
||||
private void verifyZRotatedMatrix(double degrees, double rotX, double rotY, double rotZ) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.view.View;
|
|||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
import java.util.Date;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -21,6 +22,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
/** Test that verifies that spec of methods annotated with @ReactProp is correct */
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T14964130
|
||||
public class ReactPropAnnotationSetterSpecTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.facebook.react.bridge.ReadableMap;
|
|||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -35,6 +36,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
*/
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T14964130
|
||||
public class ReactPropAnnotationSetterTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -31,6 +32,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||
/** Verifies that prop constants are generated properly based on {@code ReactProp} annotation. */
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T14964130
|
||||
public class ReactPropConstantsTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
@ -121,7 +123,7 @@ public class ReactPropConstantsTest {
|
|||
public void testNativePropsIncludeCorrectTypes() {
|
||||
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(new ViewManagerUnderTest());
|
||||
ReactApplicationContext reactContext =
|
||||
new ReactApplicationContext(RuntimeEnvironment.application);
|
||||
new ReactApplicationContext(RuntimeEnvironment.getApplication());
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(reactContext, viewManagers, 0);
|
||||
Map<String, String> constants =
|
||||
(Map) valueAtPath(uiManagerModule.getConstants(), "SomeView", "NativeProps");
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.facebook.react.bridge.ReadableMap;
|
|||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -33,6 +34,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
*/
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T14964130
|
||||
public class ReactPropForShadowNodeSetterTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.view.View;
|
|||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
import java.util.Map;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -24,6 +25,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
*/
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T14964130
|
||||
public class ReactPropForShadowNodeSpecTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.facebook.react.touch.JSResponderHandler;
|
|||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import java.util.Map;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -32,6 +33,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||
/** Verify {@link View} view property being applied properly by {@link SimpleViewManager} */
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T14964130
|
||||
public class SimpleViewPropertyTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
@ -64,7 +66,7 @@ public class SimpleViewPropertyTest {
|
|||
|
||||
@Before
|
||||
public void setup() {
|
||||
mContext = new ReactApplicationContext(RuntimeEnvironment.application);
|
||||
mContext = new ReactApplicationContext(RuntimeEnvironment.getApplication());
|
||||
mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
|
||||
mContext.initializeWithInstance(mCatalystInstanceMock);
|
||||
mThemedContext = new ThemedReactContext(mContext, mContext);
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import org.assertj.core.data.MapEntry;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -28,6 +29,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T14964130
|
||||
public class UIManagerModuleConstantsTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
@ -45,7 +47,7 @@ public class UIManagerModuleConstantsTest {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mReactContext = new ReactApplicationContext(RuntimeEnvironment.application);
|
||||
mReactContext = new ReactApplicationContext(RuntimeEnvironment.getApplication());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
package com.facebook.react.uimanager;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
@ -35,6 +35,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -51,6 +52,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||
@PrepareForTest({Arguments.class, ReactChoreographer.class})
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T14964130
|
||||
public class UIManagerModuleTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
@ -98,7 +100,7 @@ public class UIManagerModuleTest {
|
|||
any(ChoreographerCompat.FrameCallback.class));
|
||||
|
||||
mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
|
||||
mReactContext = new ReactApplicationContext(RuntimeEnvironment.application);
|
||||
mReactContext = new ReactApplicationContext(RuntimeEnvironment.getApplication());
|
||||
mReactContext.initializeWithInstance(mCatalystInstanceMock);
|
||||
|
||||
UIManagerModule uiManagerModuleMock = mock(UIManagerModule.class);
|
||||
|
@ -143,7 +145,7 @@ public class UIManagerModuleTest {
|
|||
UIManagerModule uiManager = getUIManagerModule();
|
||||
|
||||
ReactRootView rootView =
|
||||
new ReactRootView(RuntimeEnvironment.application.getApplicationContext());
|
||||
new ReactRootView(RuntimeEnvironment.getApplication().getApplicationContext());
|
||||
int rootTag = uiManager.addRootView(rootView);
|
||||
int viewTag = rootTag + 1;
|
||||
int subViewTag = viewTag + 1;
|
||||
|
@ -489,7 +491,7 @@ public class UIManagerModuleTest {
|
|||
public void testRemoveSubviewsFromContainerWithID() {
|
||||
UIManagerModule uiManager = getUIManagerModule();
|
||||
ReactRootView rootView =
|
||||
new ReactRootView(RuntimeEnvironment.application.getApplicationContext());
|
||||
new ReactRootView(RuntimeEnvironment.getApplication().getApplicationContext());
|
||||
int rootTag = uiManager.addRootView(rootView);
|
||||
|
||||
final int containerTag = rootTag + 1;
|
||||
|
@ -539,7 +541,7 @@ public class UIManagerModuleTest {
|
|||
*/
|
||||
private ViewGroup createSimpleTextHierarchy(UIManagerModule uiManager, String text) {
|
||||
ReactRootView rootView =
|
||||
new ReactRootView(RuntimeEnvironment.application.getApplicationContext());
|
||||
new ReactRootView(RuntimeEnvironment.getApplication().getApplicationContext());
|
||||
int rootTag = uiManager.addRootView(rootView);
|
||||
int textTag = rootTag + 1;
|
||||
int rawTextTag = textTag + 1;
|
||||
|
|
|
@ -10,6 +10,7 @@ package com.facebook.react.views.image;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import com.facebook.drawee.drawable.ScalingUtils;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -19,6 +20,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T110934492
|
||||
public class ImageResizeModeTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.facebook.react.views.imagehelper.ImageSource;
|
|||
import com.facebook.soloader.SoLoader;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -49,6 +50,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||
@PrepareForTest({Arguments.class, RNLog.class})
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T110934492
|
||||
public class ReactImagePropertyTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
@ -83,7 +85,7 @@ public class ReactImagePropertyTest {
|
|||
RNLog.w(null, "");
|
||||
|
||||
SoLoader.setInTestMode();
|
||||
mContext = new ReactApplicationContext(RuntimeEnvironment.application);
|
||||
mContext = new ReactApplicationContext(RuntimeEnvironment.getApplication());
|
||||
mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
|
||||
mContext.initializeWithInstance(mCatalystInstanceMock);
|
||||
mThemeContext = new ThemedReactContext(mContext, mContext);
|
||||
|
|
|
@ -10,6 +10,7 @@ package com.facebook.react.views.text;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import android.graphics.Paint;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
|
@ -17,6 +18,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T110934492
|
||||
public class CustomLineHeightSpanTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
package com.facebook.react.views.text;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
|
@ -40,6 +40,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -56,6 +57,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||
@PrepareForTest({Arguments.class, ReactChoreographer.class})
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T110934492
|
||||
public class ReactTextTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
@ -474,7 +476,7 @@ public class ReactTextTest {
|
|||
|
||||
private ReactRootView createText(
|
||||
UIManagerModule uiManager, JavaOnlyMap textProps, JavaOnlyMap rawTextProps) {
|
||||
ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application);
|
||||
ReactRootView rootView = new ReactRootView(RuntimeEnvironment.getApplication());
|
||||
int rootTag = uiManager.addRootView(rootView);
|
||||
int textTag = rootTag + 1;
|
||||
int rawTextTag = textTag + 1;
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.facebook.react.uimanager.ReactStylesDiffMap;
|
|||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.views.text.DefaultStyleValuesUtil;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -39,6 +40,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||
/** Verify {@link EditText} view property being applied properly by {@link ReactTextInputManager} */
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T110934492
|
||||
public class ReactTextInputPropertyTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
@ -50,7 +52,7 @@ public class ReactTextInputPropertyTest {
|
|||
|
||||
@Before
|
||||
public void setup() {
|
||||
mContext = new ReactApplicationContext(RuntimeEnvironment.application);
|
||||
mContext = new ReactApplicationContext(RuntimeEnvironment.getApplication());
|
||||
mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
|
||||
mContext.initializeWithInstance(mCatalystInstanceMock);
|
||||
mThemedContext = new ThemedReactContext(mContext, mContext);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
package com.facebook.react.views.textinput;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
|
@ -28,6 +28,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -44,6 +45,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||
@PrepareForTest({Arguments.class, ReactChoreographer.class})
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T110934492
|
||||
public class TextInputTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
@ -85,7 +87,7 @@ public class TextInputTest {
|
|||
public void testPropsApplied() {
|
||||
UIManagerModule uiManager = getUIManagerModule();
|
||||
|
||||
ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application);
|
||||
ReactRootView rootView = new ReactRootView(RuntimeEnvironment.getApplication());
|
||||
rootView.setLayoutParams(new ReactRootView.LayoutParams(100, 100));
|
||||
int rootTag = uiManager.addRootView(rootView);
|
||||
int textInputTag = rootTag + 1;
|
||||
|
@ -113,7 +115,7 @@ public class TextInputTest {
|
|||
public void testPropsUpdate() {
|
||||
UIManagerModule uiManager = getUIManagerModule();
|
||||
|
||||
ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application);
|
||||
ReactRootView rootView = new ReactRootView(RuntimeEnvironment.getApplication());
|
||||
rootView.setLayoutParams(new ReactRootView.LayoutParams(100, 100));
|
||||
int rootTag = uiManager.addRootView(rootView);
|
||||
int textInputTag = rootTag + 1;
|
||||
|
|
|
@ -10,6 +10,7 @@ package com.facebook.react.views.view;
|
|||
import static org.junit.Assert.*;
|
||||
|
||||
import android.graphics.PixelFormat;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -20,6 +21,7 @@ import org.robolectric.RobolectricTestRunner;
|
|||
/** Based on Fresco's DrawableUtilsTest (https://github.com/facebook/fresco). */
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
|
||||
@Ignore // TODO T110934492
|
||||
public class ColorUtilTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
|
Загрузка…
Ссылка в новой задаче