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

Fix SDK compat issues in 4.12 #9033

Merged
merged 1 commit into from Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -6,6 +6,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.Shadows;

/**
* Test class for Java's class resolve compatibility test. We must keep it with Java instead of
Expand All @@ -21,8 +23,6 @@ public void sdkIs29() {
@Test
public void shadowOf() {
// https://github.com/robolectric/robolectric/issues/7095
// Enable this assertion when resolving all shadowOf compatibility problem
// assertThat(Shadows.shadowOf((Application) ApplicationProvider.getApplicationContext()))
// .isNotNull();
assertThat(Shadows.shadowOf(RuntimeEnvironment.getApplication())).isNotNull();
}
}
@@ -1,7 +1,6 @@
package org.robolectric.shadows;

import static com.google.common.truth.Truth.assertThat;
import static org.robolectric.Shadows.shadowOf;

import android.content.Intent;
import android.net.Ikev2VpnProfile;
Expand All @@ -15,6 +14,7 @@
import org.junit.runner.RunWith;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadow.api.Shadow;

@RunWith(AndroidJUnit4.class)
@Config(minSdk = VERSION_CODES.R)
Expand All @@ -25,7 +25,7 @@ public class ShadowVpnManagerTest {
@Before
public void setUp() throws Exception {
vpnManager = ApplicationProvider.getApplicationContext().getSystemService(VpnManager.class);
shadowVpnManager = shadowOf(vpnManager);
shadowVpnManager = Shadow.extract(vpnManager);
}

@Test
Expand Down
Expand Up @@ -5,7 +5,10 @@
import org.robolectric.annotation.Implements;

/** Shadow for {@link android.net.wifi.ScanResult.InformationElement}. */
@Implements(value = ScanResult.InformationElement.class, minSdk = VERSION_CODES.R)
@Implements(
value = ScanResult.InformationElement.class,
minSdk = VERSION_CODES.R,
isInAndroidSdk = false)
public class ShadowInformationElement {
/**
* A builder for creating ShadowInformationElement objects. Use build() to return the
Expand Down
Expand Up @@ -15,6 +15,7 @@
value = PositionedGlyphs.class,
minSdk = S.SDK_INT,
shadowPicker = Picker.class,
isInAndroidSdk = false,
callNativeMethodsByDefault = true)
public class ShadowNativePositionedGlyphs {
/**
Expand Down
Expand Up @@ -16,6 +16,7 @@
value = RenderEffect.class,
minSdk = O,
shadowPicker = Picker.class,
isInAndroidSdk = false,
callNativeMethodsByDefault = true)
public class ShadowNativeRenderEffect {
static {
Expand Down
Expand Up @@ -22,6 +22,7 @@
value = RuntimeShader.class,
minSdk = O,
shadowPicker = Picker.class,
isInAndroidSdk = false,
callNativeMethodsByDefault = true)
public class ShadowNativeRuntimeShader {

Expand Down
Expand Up @@ -14,6 +14,7 @@
value = TextRunShaper.class,
minSdk = S.SDK_INT,
shadowPicker = Picker.class,
isInAndroidSdk = false,
callNativeMethodsByDefault = true)
public class ShadowNativeTextRunShaper {

Expand Down
Expand Up @@ -11,7 +11,7 @@
import org.robolectric.annotation.Implements;

/** Shadow for {@link TranslationManager}. */
@Implements(value = TranslationManager.class, minSdk = VERSION_CODES.S)
@Implements(value = TranslationManager.class, minSdk = VERSION_CODES.S, isInAndroidSdk = false)
public class ShadowTranslationManager {
private final Table<Integer, Integer, ImmutableSet<TranslationCapability>>
onDeviceTranslationCapabilities = HashBasedTable.create();
Expand Down
Expand Up @@ -11,7 +11,7 @@
import org.robolectric.annotation.Implements;

/** Shadow for {@link VpnManager}. */
@Implements(value = VpnManager.class, minSdk = VERSION_CODES.R)
@Implements(value = VpnManager.class, minSdk = VERSION_CODES.R, isInAndroidSdk = false)
public class ShadowVpnManager {

private VpnProfileState vpnProfileState;
Expand Down