Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 827001a1 authored by Federico Baron's avatar Federico Baron Committed by fbaron
Browse files

Add WidgetPicker screenshot tests

We need screenshot tests for widget picker to prevent unintended UI changes.

Bug: 268219507
Test: n/a
Change-Id: I405401f5c68bb73bcb7bbd097f507abb1d66ff7e
parent 961e6831
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -891,6 +891,19 @@ public class WidgetsFullSheet extends BaseWidgetSheet
        return false;
    }

    /** Gets the sheet for widget picker, which is used for testing. */
    @VisibleForTesting
    public View getSheet() {
        return mContent;
    }

    /** Opens the first header in widget picker and scrolls to the top of the RecyclerView. */
    @VisibleForTesting
    public void openFirstHeader() {
        mAdapters.get(AdapterHolder.PRIMARY).mWidgetsListAdapter.selectFirstHeaderEntry();
        mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView.scrollToTop();
    }

    /** A holder class for holding adapters & their corresponding recycler view. */
    final class AdapterHolder {
        static final int PRIMARY = 0;
+11 −0
Original line number Diff line number Diff line
@@ -40,6 +40,17 @@
                       android:resource="@xml/appwidget_no_config"/>
        </receiver>

        <receiver
            android:name="com.android.launcher3.testcomponent.AppWidgetNoConfigLarge"
            android:exported="true"
            android:label="No Config Large">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
            </intent-filter>
            <meta-data android:name="android.appwidget.provider"
                android:resource="@xml/appwidget_no_config_large"/>
        </receiver>

        <receiver
            android:name="com.android.launcher3.testcomponent.AppWdigetHidden"
            android:exported="true"
+15 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:minWidth="1dp"
    android:minHeight="1dp"
    android:minResizeWidth="1dp"
    android:maxResizeWidth="3000dp"
    android:targetCellHeight="1"
    android:targetCellWidth="5"
    android:updatePeriodMillis="86400000"
    android:initialLayout="@layout/test_layout_appwidget_red"
    android:previewLayout="@layout/test_layout_appwidget_red"
    android:resizeMode="horizontal|vertical"
    android:widgetCategory="home_screen">
</appwidget-provider>
 No newline at end of file