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

Commit cf03673c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix ConfigurationDispatcherTest failure" into main

parents d857f2df 5eb6944e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1195,6 +1195,16 @@ public final class Configuration implements Parcelable, Comparable<Configuration
            default: sb.append(" layoutLong=");
                    sb.append(screenLayout&SCREENLAYOUT_LONG_MASK); break;
        }
        switch ((screenLayout & SCREENLAYOUT_ROUND_MASK)) {
            case SCREENLAYOUT_ROUND_UNDEFINED: sb.append(" ?round"); break;
            case SCREENLAYOUT_ROUND_NO:  /* not-round is not interesting to print */ break;
            case SCREENLAYOUT_ROUND_YES: sb.append(" round"); break;
            default: sb.append(" layoutRound=");
                sb.append(screenLayout & SCREENLAYOUT_ROUND_MASK); break;
        }
        if ((screenLayout & SCREENLAYOUT_COMPAT_NEEDED) != 0) {
            sb.append(" compactNeeded");
        }
        switch ((colorMode &COLOR_MODE_HDR_MASK)) {
            case COLOR_MODE_HDR_UNDEFINED: sb.append(" ?ldr"); break; // most likely not HDR
            case COLOR_MODE_HDR_NO: /* ldr is not interesting to print */ break;
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ public class RoundedCornersTest {
    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
        mConfiguration = Configuration.EMPTY;
        mConfiguration = new Configuration();
    }

    final RoundedCorners mRoundedCorners = new RoundedCorners(
+22 −8
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.content.res.Configuration.ORIENTATION_PORTRAIT
import android.platform.test.annotations.Presubmit
import android.view.Display.DEFAULT_DISPLAY
import androidx.test.filters.SmallTest
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertWithMessage
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
@@ -52,7 +52,14 @@ class ConfigurationDispatcherTest(private val shouldReportPrivateChanges: Boolea
        // Verify public config field change
        receiver.windowToken.onConfigurationChangedInner(receiver, config, DEFAULT_DISPLAY, true)

        assertThat(receiver.receivedConfig).isEqualTo(config)
        assertWithMessage(
            "expected: $config, but was ${receiver.receivedConfig}. "
                    + "The diff is "
                    + Configuration.configurationDiffToString(
                receiver.receivedConfig.diff(config)
            )
        )
            .that(receiver.receivedConfig).isEqualTo(config)

        // Clear the config value
        receiver.receivedConfig.unset()
@@ -62,13 +69,20 @@ class ConfigurationDispatcherTest(private val shouldReportPrivateChanges: Boolea

        receiver.windowToken.onConfigurationChangedInner(receiver, config, DEFAULT_DISPLAY, true)

        assertThat(receiver.receivedConfig).isEqualTo(
            if (shouldReportPrivateChanges) {
        val expectedConfig = if (shouldReportPrivateChanges) {
            config
        } else {
            Configuration.EMPTY
        }

        assertWithMessage(
            "expected: $expectedConfig, but was ${receiver.receivedConfig}. "
                    + "The diff is "
                    + Configuration.configurationDiffToString(
                        receiver.receivedConfig.diff(expectedConfig)
                    )
        )
            .that(receiver.receivedConfig).isEqualTo(expectedConfig)
    }

    /**