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

Commit 3f7408fc authored by Charlie Tsai's avatar Charlie Tsai Committed by Android (Google) Code Review
Browse files

Merge "Add the test function for rectangle shadow"

parents d1c7bb77 79062f6f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ public class RectShadowPainter {
            throw new IllegalArgumentException("Outline is not a rect shadow");
        }

        // TODO replacing the algorithm here to create better shadow

        float shadowSize = elevationToShadow(elevation);
        int saved = modifyCanvas(canvas, shadowSize);
        if (saved == -1) {
+22.1 KiB
Loading image diff...
+97 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2017 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" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <Button
            android:layout_marginLeft="40dp"
            android:layout_width="48dp"
            android:layout_height="40dp"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:elevation="48dp"
            android:stateListAnimator="@null"/>

        <Button
            android:layout_marginRight="40dp"
            android:layout_width="48dp"
            android:layout_height="40dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:elevation="48dp"
            android:stateListAnimator="@null"/>

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <Button
            android:layout_marginLeft="40dp"
            android:layout_width="48dp"
            android:layout_height="40dp"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:elevation="0dp"
            android:stateListAnimator="@null"/>

        <Button
            android:layout_marginRight="40dp"
            android:layout_width="48dp"
            android:layout_height="40dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:elevation="100dp"
            android:stateListAnimator="@null"/>

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <Button
            android:layout_marginLeft="40dp"
            android:layout_width="48dp"
            android:layout_height="40dp"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:elevation="12dp"
            android:stateListAnimator="@null"/>

        <Button
            android:layout_marginRight="40dp"
            android:layout_width="48dp"
            android:layout_height="40dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:elevation="36dp"
            android:stateListAnimator="@null"/>

    </RelativeLayout>
</LinearLayout>
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -424,4 +424,9 @@ public class RenderTests extends RenderTestBase {
        assertNotEquals(0, outValue.data);
        assertTrue(sRenderMessages.isEmpty());
    }

    @Test
    public void testRectangleShadow() throws Exception {
        renderAndVerify("shadows_test.xml", "shadows_test.png");
    }
}