org.robolectric.annotation.Config.sdk()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.robolectric.annotation.Config.sdk()方法的一些代码示例,展示了Config.sdk()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.sdk()方法的具体详情如下:
包路径:org.robolectric.annotation.Config
类名称:Config
方法名:sdk

Config.sdk介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

private static void validate(Config config) {
 //noinspection ConstantConditions
 if (config.sdk() != null && config.sdk().length > 0 &&
   (config.minSdk() != DEFAULT_VALUE_INT || config.maxSdk() != DEFAULT_VALUE_INT)) {
  throw new IllegalArgumentException("sdk and minSdk/maxSdk may not be specified together" +
    " (sdk=" + Arrays.toString(config.sdk()) + ", minSdk=" + config.minSdk() + ", maxSdk=" + config.maxSdk() + ")");
 }
 if (config.minSdk() > DEFAULT_VALUE_INT && config.maxSdk() > DEFAULT_VALUE_INT && config.minSdk() > config.maxSdk()) {
  throw new IllegalArgumentException("minSdk may not be larger than maxSdk" +
    " (minSdk=" + config.minSdk() + ", maxSdk=" + config.maxSdk() + ")");
 }
}

代码示例来源:origin: robolectric/robolectric

if (config.sdk().length == 0) {
 if (appTargetSdk < appMinSdk) {
  throw new IllegalArgumentException(
if (config.sdk().length == 1 && config.sdk()[0] == Config.ALL_SDKS) {
 return sdkRange(appMinSdk, appMaxSdk);
for (int sdk : config.sdk()) {
 int decodedApiLevel = decodeSdk(sdk, appTargetSdk, appMinSdk, appTargetSdk, appMaxSdk);
 sdks.add(sdkCollection.getSdk(decodedApiLevel));

代码示例来源:origin: robolectric/robolectric

public Builder overlay(Config overlayConfig) {
 int[] overlaySdk = overlayConfig.sdk();
 int overlayMinSdk = overlayConfig.minSdk();
 int overlayMaxSdk = overlayConfig.maxSdk();

代码示例来源:origin: robolectric/robolectric

private String sdksIn(Config config) {
 return "sdk=" + Arrays.toString(config.sdk()) + ", minSdk=" + config.minSdk() + ", maxSdk=" + config.maxSdk();
}

代码示例来源:origin: robolectric/robolectric

public Builder(Config config) {
 sdk = config.sdk();
 minSdk = config.minSdk();
 maxSdk = config.maxSdk();
 manifest = config.manifest();
 qualifiers = config.qualifiers();
 packageName = config.packageName();
 resourceDir = config.resourceDir();
 assetDir = config.assetDir();
 shadows = config.shadows();
 instrumentedPackages = config.instrumentedPackages();
 application = config.application();
 libraries = config.libraries();
}

代码示例来源:origin: robolectric/robolectric

private static void assertConfig(
  Config config,
  int[] sdk,
  String manifest,
  Class<? extends Application> application,
  String packageName,
  String qualifiers,
  String resourceDir,
  String assetsDir,
  Class<?>[] shadows,
  String[] instrumentedPackages,
  String[] libraries) {
 assertThat(config.sdk()).isEqualTo(sdk);
 assertThat(config.manifest()).isEqualTo(manifest);
 assertThat(config.application()).isEqualTo(application);
 assertThat(config.packageName()).isEqualTo(packageName);
 assertThat(config.qualifiers()).isEqualTo(qualifiers);
 assertThat(config.resourceDir()).isEqualTo(resourceDir);
 assertThat(config.assetDir()).isEqualTo(assetsDir);
 assertThat(config.shadows()).asList().containsAllIn(shadows).inOrder();
 assertThat(config.instrumentedPackages()).asList().containsAllIn(instrumentedPackages);
 assertThat(config.libraries()).asList().containsAllIn(libraries);
}

代码示例来源:origin: org.robolectric/robolectric

if (config.sdk().length == 0) {
 if (appTargetSdk < appMinSdk) {
  throw new IllegalArgumentException(
if (config.sdk().length == 1 && config.sdk()[0] == Config.ALL_SDKS) {
 return sdkRange(appMinSdk, appMaxSdk);
for (int sdk : config.sdk()) {
 int decodedApiLevel = decodeSdk(sdk, appTargetSdk, appMinSdk, appTargetSdk, appMaxSdk);
 sdkConfigs.add(new SdkConfig(decodedApiLevel));

代码示例来源:origin: robospock/RoboSpock

protected int pickSdkVersion(Config config, AndroidManifest manifest) {
  if (config != null && config.sdk().length > 1) {
    throw new IllegalArgumentException("Robospock does not support multiple values for @Config.sdk");
  } else if (config != null && config.sdk().length == 1) {
    return config.sdk()[0];
  } else if (manifest != null) {
    return manifest.getTargetSdkVersion();
  } else {
    return SdkConfig.FALLBACK_SDK_VERSION;
  }
}

代码示例来源:origin: robospock/RoboSpock

protected int pickSdkVersion(Config config, AndroidManifest manifest) {
  if (config != null && config.sdk().length > 1) {
    throw new IllegalArgumentException("RoboSpock does not support multiple values for @Config.sdk");
  } else if (config != null && config.sdk().length == 1) {
    return config.sdk()[0];
  } else if (manifest != null) {
    return manifest.getTargetSdkVersion();
  } else {
    return SdkConfig.FALLBACK_SDK_VERSION;
  }
}

代码示例来源:origin: org.robolectric/annotations

private static void validate(Config config) {
 //noinspection ConstantConditions
 if (config.sdk() != null && config.sdk().length > 0 &&
   (config.minSdk() != DEFAULT_VALUE_INT || config.maxSdk() != DEFAULT_VALUE_INT)) {
  throw new IllegalArgumentException("sdk and minSdk/maxSdk may not be specified together" +
    " (sdk=" + Arrays.toString(config.sdk()) + ", minSdk=" + config.minSdk() + ", maxSdk=" + config.maxSdk() + ")");
 }
 if (config.minSdk() > DEFAULT_VALUE_INT && config.maxSdk() > DEFAULT_VALUE_INT && config.minSdk() > config.maxSdk()) {
  throw new IllegalArgumentException("minSdk may not be larger than maxSdk" +
    " (minSdk=" + config.minSdk() + ", maxSdk=" + config.maxSdk() + ")");
 }
}

代码示例来源:origin: org.robolectric/annotations

public Builder overlay(Config overlayConfig) {
 int[] overlaySdk = overlayConfig.sdk();
 int overlayMinSdk = overlayConfig.minSdk();
 int overlayMaxSdk = overlayConfig.maxSdk();

代码示例来源:origin: org.robolectric/annotations

public Builder(Config config) {
 sdk = config.sdk();
 minSdk = config.minSdk();
 maxSdk = config.maxSdk();
 manifest = config.manifest();
 qualifiers = config.qualifiers();
 packageName = config.packageName();
 resourceDir = config.resourceDir();
 assetDir = config.assetDir();
 shadows = config.shadows();
 instrumentedPackages = config.instrumentedPackages();
 application = config.application();
 libraries = config.libraries();
}

相关文章