Skip to content

Commit

Permalink
[#1330] Add more integration tests for extendedIndentAfterOperators
Browse files Browse the repository at this point in the history
… flag

### What's done:

 * More complex code fragments which test the behaviour of the
   `extendedIndentAfterOperators` flag have been added.
  • Loading branch information
0x6675636b796f75676974687562 committed Jun 22, 2022
1 parent c0b42a8 commit b4c3a45
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
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

0 comments on commit b4c3a45

Please sign in to comment.