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

Commit a4bd6838 authored by Mady Mellor's avatar Mady Mellor Committed by Automerger Merge Worker
Browse files

Merge "Allow setting a configuration to TestableResources" into udc-qpr-dev...

Merge "Allow setting a configuration to TestableResources" into udc-qpr-dev am: 4a0d255a am: 04b20567

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



Change-Id: If2b4de498db3dc9efc3757d6b78240df9fd99d15
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 8fc41d0d 04b20567
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -15,9 +15,11 @@
package android.testing;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.withSettings;

import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.util.Log;
import android.util.SparseArray;
@@ -53,6 +55,16 @@ public class TestableResources {
        return mResources;
    }

    /**
     * Sets a configuration for {@link #getResources()} to return to allow custom configs to
     * be set and tested.
     *
     * @param configuration the configuration to return from resources.
     */
    public void overrideConfiguration(Configuration configuration) {
        when(mResources.getConfiguration()).thenReturn(configuration);
    }

    /**
     * Sets the return value for the specified resource id.
     * <p>