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

Commit cb225eb1 authored by Ben Reich's avatar Ben Reich
Browse files

Fix InflateMessageDocumentHolderTest for use_material3

When use_material3 is enabled, the MessageDocumentHolder layout contains
com.google.android.material.progressindicator.CircularProgressIndicator
which attempts to perform an animation. The current way the test is
structured causes the inflation of the layout to happen on the main
thread which has no Looper thread avaiable. To Enable this animation to
work, move the initialization to the test and annotate the method
appropriately so it's ran on the UI thread and it's associated Looper
thread.

Bug: 412776499
Test: atest InflateMessageDocumentHolderTest
Flag: com.android.documentsui.flags.use_material3
Change-Id: I937dff745419f2a55284dcdaf3e6bf8e461fa0b6
parent 410f4e5a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.os.UserManager;
import android.view.View;
import android.widget.Button;

import androidx.test.annotation.UiThreadTest;
import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;

@@ -121,12 +122,14 @@ public final class InflateMessageDocumentHolderTest {
            mInflateMessage = new Message.InflateMessage(env, mDefaultCallback, mTestConfigStore);
            env.getDisplayState().canShareAcrossProfile = true;
        }
        mHolder = new InflateMessageDocumentHolder(mContext, /* parent= */null, mTestConfigStore);
    }

    @Test
    @UiThreadTest
    public void testClickingButtonShouldShowProgressBar() {
        if (SdkLevel.isAtLeastV()) return;
        mHolder = new InflateMessageDocumentHolder(mContext, /* parent= */null, mTestConfigStore);

        Model.Update error = new Model.Update(
                new CrossProfileQuietModeException(TestProvidersAccess.OtherUser.USER_ID),
                /* remoteActionsEnabled= */ true);