diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleTestMixin.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleTestMixin.kt index a9d7466cd9..ff4263716f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleTestMixin.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleTestMixin.kt @@ -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 @@ -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 diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt index 66ef42b840..eab55f1f94 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt @@ -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) @@ -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)