Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Optimize scope when maxBreadcrumb is 0 ([#4504](https://github.com/getsentry/sentry-java/pull/4504))
- Fix javadoc on TransportResult ([#4528](https://github.com/getsentry/sentry-java/pull/4528))
- Session Replay: Fix `IllegalArgumentException` when `Bitmap` is initialized with non-positive values ([#4536](https://github.com/getsentry/sentry-java/pull/4536))

### Internal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,4 @@ internal fun View?.removeOnPreDrawListenerSafe(listener: ViewTreeObserver.OnPreD
}
}

internal fun View.hasSize(): Boolean = width != 0 && height != 0
internal fun View.hasSize(): Boolean = width > 0 && height > 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.sentry.android.replay.util

import android.view.View
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import kotlin.test.Test
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class ViewsTest {
@Test
fun `hasSize returns true for positive values`() {
val view = View(ApplicationProvider.getApplicationContext())
view.right = 100
view.bottom = 100
assertTrue(view.hasSize())
}

@Test
fun `hasSize returns false for null values`() {
val view = View(ApplicationProvider.getApplicationContext())
view.right = 0
view.bottom = 0
assertFalse(view.hasSize())
}

@Test
fun `hasSize returns false for negative values`() {
val view = View(ApplicationProvider.getApplicationContext())
view.right = -1
view.bottom = -1
assertFalse(view.hasSize())
}
}
Loading