Loading core/tests/coretests/res/drawable/custom_drawable.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright (C) 2021 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. --> <drawable xmlns:android="http://schemas.android.com/apk/res/android" class="android.window.CustomDrawable" android:drawable="@drawable/bitmap_drawable" android:inset="10dp" /> No newline at end of file core/tests/coretests/src/android/window/CustomDrawable.java 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ package android.window; import android.graphics.drawable.InsetDrawable; public class CustomDrawable extends InsetDrawable { public CustomDrawable() { super(null, 0); } } core/tests/coretests/src/android/window/WindowContextTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import android.app.Activity; Loading @@ -47,6 +48,8 @@ import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.rule.ActivityTestRule; import androidx.test.runner.AndroidJUnit4; import com.android.frameworks.coretests.R; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -242,6 +245,12 @@ public class WindowContextTest { mInstrumentation.runOnMainSync(() -> wm.addView(subWindow, subWindowAttrs)); } @Test public void testGetCustomDrawable() { assertNotNull(mWindowContext.getResources().getDrawable(R.drawable.custom_drawable, null /* theme */)); } private WindowContext createWindowContext() { return createWindowContext(TYPE_APPLICATION_OVERLAY); } Loading Loading
core/tests/coretests/res/drawable/custom_drawable.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright (C) 2021 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. --> <drawable xmlns:android="http://schemas.android.com/apk/res/android" class="android.window.CustomDrawable" android:drawable="@drawable/bitmap_drawable" android:inset="10dp" /> No newline at end of file
core/tests/coretests/src/android/window/CustomDrawable.java 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ package android.window; import android.graphics.drawable.InsetDrawable; public class CustomDrawable extends InsetDrawable { public CustomDrawable() { super(null, 0); } }
core/tests/coretests/src/android/window/WindowContextTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import android.app.Activity; Loading @@ -47,6 +48,8 @@ import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.rule.ActivityTestRule; import androidx.test.runner.AndroidJUnit4; import com.android.frameworks.coretests.R; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -242,6 +245,12 @@ public class WindowContextTest { mInstrumentation.runOnMainSync(() -> wm.addView(subWindow, subWindowAttrs)); } @Test public void testGetCustomDrawable() { assertNotNull(mWindowContext.getResources().getDrawable(R.drawable.custom_drawable, null /* theme */)); } private WindowContext createWindowContext() { return createWindowContext(TYPE_APPLICATION_OVERLAY); } Loading