mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Enable lint in lib-common tests
Also move the `lint.xml` config which disables the `NewApi` check from
`lib-session` to the existing top-level file, and limit it to cover all
Robolectric tests by path matching.
Follow-up to 76db936d68
PiperOrigin-RevId: 692913646
This commit is contained in:
parent
a8ed6494c3
commit
af1c13524c
@ -35,6 +35,11 @@ android {
|
|||||||
lint {
|
lint {
|
||||||
baseline = file("lint-baseline.xml")
|
baseline = file("lint-baseline.xml")
|
||||||
}
|
}
|
||||||
|
lintOptions {
|
||||||
|
// TODO: b/353490583 - Move this to common_library_config.gradle once it's enabled for all
|
||||||
|
// libraries.
|
||||||
|
checkTestSources true
|
||||||
|
}
|
||||||
publishing {
|
publishing {
|
||||||
singleVariant('release') {
|
singleVariant('release') {
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
|
@ -557,6 +557,7 @@ public class MediaItemTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@SuppressWarnings("Range") // Deliberately testing invalid values
|
||||||
public void clippingConfigurationBuilder_throwsOnInvalidValues() {
|
public void clippingConfigurationBuilder_throwsOnInvalidValues() {
|
||||||
MediaItem.ClippingConfiguration.Builder clippingConfigurationBuilder =
|
MediaItem.ClippingConfiguration.Builder clippingConfigurationBuilder =
|
||||||
new MediaItem.ClippingConfiguration.Builder();
|
new MediaItem.ClippingConfiguration.Builder();
|
||||||
@ -582,7 +583,7 @@ public class MediaItemTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("deprecation") // Testing deprecated setter.
|
@SuppressWarnings({"deprecation", "Range"}) // Testing deprecated setter with invalid value.
|
||||||
public void builderSetStartPositionMs_negativeValue_throws() {
|
public void builderSetStartPositionMs_negativeValue_throws() {
|
||||||
MediaItem.Builder builder = new MediaItem.Builder();
|
MediaItem.Builder builder = new MediaItem.Builder();
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ public final class ColorParserTest {
|
|||||||
@Test
|
@Test
|
||||||
public void rgbColorParsingRgbValuesOutOfBounds() {
|
public void rgbColorParsingRgbValuesOutOfBounds() {
|
||||||
int outOfBounds = ColorParser.parseTtmlColor("rgb(999, 999, 999)");
|
int outOfBounds = ColorParser.parseTtmlColor("rgb(999, 999, 999)");
|
||||||
|
@SuppressWarnings("Range") // Deliberately testing invalid values
|
||||||
int color = Color.rgb(999, 999, 999);
|
int color = Color.rgb(999, 999, 999);
|
||||||
// Behave like the framework does.
|
// Behave like the framework does.
|
||||||
assertThat(outOfBounds).isEqualTo(color);
|
assertThat(outOfBounds).isEqualTo(color);
|
||||||
|
@ -17,4 +17,9 @@
|
|||||||
<issue id="UnsafeOptInUsageError">
|
<issue id="UnsafeOptInUsageError">
|
||||||
<option name="opt-in" value="androidx.media3.common.util.UnstableApi" />
|
<option name="opt-in" value="androidx.media3.common.util.UnstableApi" />
|
||||||
</issue>
|
</issue>
|
||||||
|
<!-- Robolectric tests run at targetApi by default, but the linter doesn't understand this so
|
||||||
|
generates lots of spurious NewApi failures. -->
|
||||||
|
<issue id="NewApi">
|
||||||
|
<ignore path="*/src/test/**" />
|
||||||
|
</issue>
|
||||||
</lint>
|
</lint>
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright 2024 The Android Open Source Project
|
|
||||||
~
|
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
~ you may not use this file except in compliance with the License.
|
|
||||||
~ You may obtain a copy of the License at
|
|
||||||
~
|
|
||||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
~ See the License for the specific language governing permissions and
|
|
||||||
~ limitations under the License.
|
|
||||||
-->
|
|
||||||
<lint>
|
|
||||||
<!-- Robolectric tests run at targetApi by default, but the linter doesn't understand this so
|
|
||||||
generates lots of spurious NewApi failures. -->
|
|
||||||
<issue id="NewApi" severity="ignore" />
|
|
||||||
</lint>
|
|
Loading…
x
Reference in New Issue
Block a user