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

[#1330] Add more integration tests for extendedIndentAfterOperators flag #1395

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,32 @@ internal interface IndentationRuleTestMixin {
| WindowManager.LayoutParams().apply { /* ... */ }
""".trimMargin(),

"""
|private fun createLayoutParams(): WindowManager.LayoutParams =
| WindowManager.LayoutParams().apply {
| type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL
| token = composeView.applicationWindowToken
| width = WindowManager.LayoutParams.MATCH_PARENT
| height = WindowManager.LayoutParams.MATCH_PARENT
| format = PixelFormat.TRANSLUCENT
|
| // TODO make composable configurable
|
| // see https://stackoverflow.com/questions/43511326/android-making-activity-full-screen-with-status-bar-on-top-of-it
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
| windowInsetsController?.hide(WindowInsets.Type.statusBars())
| } else {
| @Suppress("DEPRECATION")
| systemUiVisibility = (View.SYSTEM_UI_FLAG_LOW_PROFILE or
| View.SYSTEM_UI_FLAG_FULLSCREEN or
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)
| }
| }
""".trimMargin(),

"""
|val offsetDelta =
| if (shimmerAnimationType != ShimmerAnimationType.FADE) translateAnim.dp
Expand Down Expand Up @@ -115,6 +141,32 @@ internal interface IndentationRuleTestMixin {
| WindowManager.LayoutParams().apply { /* ... */ }
""".trimMargin(),

"""
|private fun createLayoutParams(): WindowManager.LayoutParams =
| WindowManager.LayoutParams().apply {
| type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL
| token = composeView.applicationWindowToken
| width = WindowManager.LayoutParams.MATCH_PARENT
| height = WindowManager.LayoutParams.MATCH_PARENT
| format = PixelFormat.TRANSLUCENT
|
| // TODO make composable configurable
|
| // see https://stackoverflow.com/questions/43511326/android-making-activity-full-screen-with-status-bar-on-top-of-it
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
| windowInsetsController?.hide(WindowInsets.Type.statusBars())
| } else {
| @Suppress("DEPRECATION")
| systemUiVisibility = (View.SYSTEM_UI_FLAG_LOW_PROFILE or
| View.SYSTEM_UI_FLAG_FULLSCREEN or
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)
| }
| }
""".trimMargin(),

"""
|val offsetDelta =
| if (shimmerAnimationType != ShimmerAnimationType.FADE) translateAnim.dp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ class IndentationRuleWarnTest : LintTestBase(::IndentationRule), IndentationRule
softly.assertThat(lintResult(code, customConfig.asRulesConfigList()))
.describedAs("lint result for ${code.describe()}")
.isNotEmpty
.hasSizeBetween(1, 3).allSatisfy(Consumer { lintError ->
.hasSizeBetween(1, 20).allSatisfy(Consumer { lintError ->
assertThat(lintError.ruleId).describedAs("ruleId").isEqualTo(ruleId)
assertThat(lintError.canBeAutoCorrected).describedAs("canBeAutoCorrected").isTrue
assertThat(lintError.detail).matches(warnTextRegex)
Expand All @@ -784,7 +784,7 @@ class IndentationRuleWarnTest : LintTestBase(::IndentationRule), IndentationRule
softly.assertThat(lintResult(code, customConfig.asRulesConfigList()))
.describedAs("lint result for ${code.describe()}")
.isNotEmpty
.hasSizeBetween(1, 3).allSatisfy(Consumer { lintError ->
.hasSizeBetween(1, 20).allSatisfy(Consumer { lintError ->
assertThat(lintError.ruleId).describedAs("ruleId").isEqualTo(ruleId)
assertThat(lintError.canBeAutoCorrected).describedAs("canBeAutoCorrected").isTrue
assertThat(lintError.detail).matches(warnTextRegex)
Expand Down