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

Commit 442dd588 authored by Tyler Freeman's avatar Tyler Freeman Committed by Automerger Merge Worker
Browse files

Merge "fix(non linear font scaling): wait longer after setting font scale to...

Merge "fix(non linear font scaling): wait longer after setting font scale to fix flaky test" into udc-dev am: 17a23d5b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21562862



Change-Id: Ie36fc1193b9fe9f9a13c67dca9ded8fa04303509
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents dc87aa07 17a23d5b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.compat.testing.PlatformCompatChangeRule;
import android.os.Bundle;
import android.platform.test.annotations.Presubmit;
import android.provider.Settings;
import android.util.PollingCheck;
import android.view.View;
import android.widget.TextView;

@@ -91,6 +92,9 @@ public class FontScaleConverterActivityTest {

        var densityRef = new AtomicReference<Float>();
        scenario.onActivity(activity -> {
            assertThat(activity.getResources().getConfiguration().fontScale)
                .isWithin(0.05f)
                .of(2f);
            densityRef.compareAndSet(null, activity.getResources().getDisplayMetrics().density);
        });
        var density = densityRef.get();
@@ -141,6 +145,15 @@ public class FontScaleConverterActivityTest {
                    fontScale
            );
        });

        PollingCheck.waitFor(/* timeout= */ 5000, () ->
                InstrumentationRegistry
                    .getInstrumentation()
                    .getContext()
                    .getResources()
                    .getConfiguration()
                    .fontScale == fontScale
        );
    }

    private Matcher<View> withTextSizeInRange(float sizeStartPx, float sizeEndPx) {