facebook / screenshot-tests-for-android

Generate fast deterministic screenshots during Android instrumentation tests
http://facebook.github.io/screenshot-tests-for-android
Apache License 2.0
1.74k stars 229 forks source link

Standard TextInputEditText hint overlaps TextInputLayout startIconDrawable on screenshot #295

Open oradkovsky opened 2 years ago

oradkovsky commented 2 years ago

Hello!

I'm observing this behavior with latest version of this beautiful library, running on SDK 26 emulator:

image

...for this simple setup:

    <com.google.android.material.textfield.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        app:startIconDrawable="@drawable/ic_card_filled">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Text as hint" />

    </com.google.android.material.textfield.TextInputLayout>

I'm doing noting really fancy actually, and the same layout works fine if app is rendering it:

        val targetContext: Context = InstrumentationRegistry.getInstrumentation().targetContext
        val inflater = LayoutInflater.from(targetContext)
        val view: View = inflater.inflate(R.layout.layout1, null, false)
        ViewHelpers.setupView(view).setExactWidthDp(400).layout()
        Screenshot.snap(view).record()

Please let me know if any ideas on how to workaround such behavior?