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

XmlWebViewInsideScrollView Detector #37

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Reformat code
  • Loading branch information
vickyramachandra committed Nov 28, 2019
commit 51d351b25a2cc331db9c86814a918f6e9ede97bc
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ class XmlWebViewInsideScrollViewDetectorTest : LintTestBase() {
TestLintTask.lint()
.files(xmlSource("res/layout/webview_inside_scrollview_wo_fill_viewport.xml",
"""<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</ScrollView>"""))
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</ScrollView>"""))
.detector(XmlWebViewInsideScrollViewDetector())
.issues(XmlWebViewInsideScrollViewDetector.ISSUE)
.run()
Expand All @@ -46,17 +46,17 @@ class XmlWebViewInsideScrollViewDetectorTest : LintTestBase() {
TestLintTask.lint()
.files(xmlSource("res/layout/webview_inside_support_widget_scrollview_wo_fill_viewport.xml",
"""<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.NestedScrollView>"""))
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.NestedScrollView>"""))
.detector(XmlWebViewInsideScrollViewDetector())
.issues(XmlWebViewInsideScrollViewDetector.ISSUE)
.run()
Expand All @@ -69,17 +69,17 @@ class XmlWebViewInsideScrollViewDetectorTest : LintTestBase() {
TestLintTask.lint()
.files(xmlSource("res/layout/webview_inside_androidx_widget_scrollview_wo_fill_viewport.xml",
"""<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.core.widget.NestedScrollView>"""))
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.core.widget.NestedScrollView>"""))
.detector(XmlWebViewInsideScrollViewDetector())
.issues(XmlWebViewInsideScrollViewDetector.ISSUE)
.run()
Expand All @@ -92,16 +92,16 @@ class XmlWebViewInsideScrollViewDetectorTest : LintTestBase() {
TestLintTask.lint()
.files(xmlSource("res/layout/webview_inside_scrollview_with_fill_viewport.xml",
"""<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</ScrollView>"""))
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</ScrollView>"""))
.detector(XmlWebViewInsideScrollViewDetector())
.issues(XmlWebViewInsideScrollViewDetector.ISSUE)
.run()
Expand All @@ -113,18 +113,18 @@ class XmlWebViewInsideScrollViewDetectorTest : LintTestBase() {
TestLintTask.lint()
.files(xmlSource("res/layout/webview_inside_support_widget_scrollview_with_fill_viewport.xml",
"""<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.NestedScrollView>"""))
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.NestedScrollView>"""))
.detector(XmlWebViewInsideScrollViewDetector())
.issues(XmlWebViewInsideScrollViewDetector.ISSUE)
.run()
Expand All @@ -136,18 +136,18 @@ class XmlWebViewInsideScrollViewDetectorTest : LintTestBase() {
TestLintTask.lint()
.files(xmlSource("res/layout/webview_inside_androidx_widget_scrollview_with_fill_viewport.xml",
"""<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.core.widget.NestedScrollView>"""))
android:layout_height="match_parent"/>
</androidx.core.widget.NestedScrollView>"""))
.detector(XmlWebViewInsideScrollViewDetector())
.issues(XmlWebViewInsideScrollViewDetector.ISSUE)
.run()
Expand All @@ -159,22 +159,22 @@ class XmlWebViewInsideScrollViewDetectorTest : LintTestBase() {
TestLintTask.lint()
.files(xmlSource("res/layout/scrollview_with_multiple_children_without_fill_viewport.xml",
"""<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
</ScrollView>"""))
</FrameLayout>
</ScrollView>"""))
.detector(XmlWebViewInsideScrollViewDetector())
.issues(XmlWebViewInsideScrollViewDetector.ISSUE)
.run()
Expand All @@ -187,23 +187,23 @@ class XmlWebViewInsideScrollViewDetectorTest : LintTestBase() {
TestLintTask.lint()
.files(xmlSource("res/layout/scrollview_with_multiple_children_with_fill_viewport.xml",
"""<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
</ScrollView>"""))
android:layout_height="match_parent"/>
</FrameLayout>
</ScrollView>"""))
.detector(XmlWebViewInsideScrollViewDetector())
.issues(XmlWebViewInsideScrollViewDetector.ISSUE)
.run()
Expand Down