Enable UtilitiesKtTest for multivalent. Remove test resource

Fix: 325088427
Test: UtilitiesKtTest in studio and presubmit
Flag: EXEMPT test-only
Change-Id: I71b77c4633b1075f643ed479f8224f9b80811f54
This commit is contained in:
Uwais Ashraf
2024-06-11 22:05:31 +00:00
parent 27471df69c
commit eecadb0432
2 changed files with 7 additions and 49 deletions

View File

@@ -17,9 +17,8 @@
package com.android.launcher3
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
@@ -27,28 +26,20 @@ import com.android.launcher3.UtilitiesKt.CLIP_CHILDREN_FALSE_MODIFIER
import com.android.launcher3.UtilitiesKt.CLIP_TO_PADDING_FALSE_MODIFIER
import com.android.launcher3.UtilitiesKt.modifyAttributesOnViewTree
import com.android.launcher3.UtilitiesKt.restoreAttributesOnViewTree
import com.android.launcher3.tests.R
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@SmallTest
@RunWith(AndroidJUnit4::class)
class UtilitiesKtTest {
val context: Context = InstrumentationRegistry.getInstrumentation().context
private lateinit var rootView: ViewGroup
private lateinit var midView: ViewGroup
private lateinit var childView: View
@Before
fun setup() {
rootView =
LayoutInflater.from(context).inflate(R.layout.utilities_test_view, null) as ViewGroup
midView = rootView.requireViewById(R.id.mid_view)
childView = rootView.requireViewById(R.id.child_view)
}
private val childView = TextView(context)
private val midView = LinearLayout(context).apply { addView(childView) }
private val rootView = LinearLayout(context).apply { addView(midView) }
@Test
fun set_clipChildren_false() {

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2024 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/root_view">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/mid_view">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/child_view" />
</LinearLayout>
</LinearLayout>