-
Notifications
You must be signed in to change notification settings - Fork 64
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
RUN integration tests on API 35 in testing pyramid #2272
Merged
mariusc83
merged 4 commits into
develop
from
mconstantin/rum-6069/run-integration-tests-on-api-35
Sep 25, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cf9e60b
RUN integration tests on API 35 in testing pyramid
mariusc83 5a8be07
RUM-6069 Update the build system and CI to target API 35
mariusc83 478df2e
Fixes and updates related with API 35 source code.
mariusc83 85ea30a
Accept nullable Config in BitmapPool just for testing purposes
mariusc83 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
76 changes: 76 additions & 0 deletions
76
.../src/test/kotlin/com/datadog/android/sessionreplay/internal/utils/BitmapPoolHelperTest.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,76 @@ | ||
/* | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2016-Present Datadog, Inc. | ||
*/ | ||
|
||
package com.datadog.android.sessionreplay.internal.utils | ||
|
||
import android.graphics.Bitmap | ||
import com.datadog.android.sessionreplay.forge.ForgeConfigurator | ||
import com.datadog.android.sessionreplay.internal.recorder.resources.BitmapPoolHelper | ||
import fr.xgouchet.elmyr.Forge | ||
import fr.xgouchet.elmyr.annotation.IntForgery | ||
import fr.xgouchet.elmyr.junit5.ForgeConfiguration | ||
import fr.xgouchet.elmyr.junit5.ForgeExtension | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.junit.jupiter.api.extension.Extensions | ||
import org.mockito.Mock | ||
import org.mockito.junit.jupiter.MockitoExtension | ||
import org.mockito.junit.jupiter.MockitoSettings | ||
import org.mockito.kotlin.whenever | ||
import org.mockito.quality.Strictness | ||
|
||
@Extensions( | ||
ExtendWith(MockitoExtension::class), | ||
ExtendWith(ForgeExtension::class) | ||
) | ||
@MockitoSettings(strictness = Strictness.LENIENT) | ||
@ForgeConfiguration(ForgeConfigurator::class) | ||
internal class BitmapPoolHelperTest { | ||
|
||
lateinit var testedHelper: BitmapPoolHelper | ||
|
||
@Mock | ||
lateinit var mockBitmap: Bitmap | ||
|
||
@IntForgery | ||
var fakeWidth: Int = 0 | ||
|
||
@IntForgery | ||
var fakeHeight: Int = 0 | ||
private lateinit var fakeConfig: Bitmap.Config | ||
|
||
@BeforeEach | ||
fun `set up`(forge: Forge) { | ||
fakeConfig = forge.aValueFrom(Bitmap.Config::class.java) | ||
testedHelper = BitmapPoolHelper() | ||
whenever(mockBitmap.width).thenReturn(fakeWidth) | ||
whenever(mockBitmap.height).thenReturn(fakeHeight) | ||
whenever(mockBitmap.config).thenReturn(fakeConfig) | ||
} | ||
|
||
@Test | ||
fun `M generate bitmap key W generateKey`() { | ||
// When | ||
val key = testedHelper.generateKey(mockBitmap) | ||
|
||
// Then | ||
assertThat(key).isEqualTo("$fakeWidth-$fakeHeight-$fakeConfig") | ||
} | ||
|
||
@Test | ||
fun `M generate bitmap key W generateKey { config is null }`() { | ||
// Given | ||
whenever(mockBitmap.config).thenReturn(null) | ||
|
||
// When | ||
val key = testedHelper.generateKey(mockBitmap) | ||
|
||
// Then | ||
assertThat(key).isEqualTo("$fakeWidth-$fakeHeight-null") | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the replacement then? should we use it for newer APIs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can leave it like it is and prepare a task to remove those later. The only think that will happen for newer APIs is that those level will never be triggered. I don't see any harm now, maybe to create a task to clean these levels ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, no harm. My point is just that if something is deprecated, then probably there is a replacement for the newer APIs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. no replacement suggested in their docs, I think they simply don't support these levels anymore and only kept few important ones. I think they did not need this granularity anymore.