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

Commit c5018624 authored by Nino Jagar's avatar Nino Jagar Committed by Automerger Merge Worker
Browse files

Merge "Add setter for textIdEntry in ViewNode" into udc-qpr-dev am: f8b9dd9f

parents fdccb2db f8b9dd9f
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -480,6 +480,11 @@ public final class ViewNode extends AssistStructure.ViewNode {
        return mLocaleList;
        return mLocaleList;
    }
    }


    /** @hide */
    public void setTextIdEntry(@NonNull String textIdEntry) {
        mTextIdEntry = textIdEntry;
    }

    private void writeSelfToParcel(@NonNull Parcel parcel, int parcelFlags) {
    private void writeSelfToParcel(@NonNull Parcel parcel, int parcelFlags) {
        long nodeFlags = mFlags;
        long nodeFlags = mFlags;


+38 −27
Original line number Original line Diff line number Diff line
@@ -41,49 +41,60 @@ public class ViewNodeTest {


    private final Context mContext = InstrumentationRegistry.getTargetContext();
    private final Context mContext = InstrumentationRegistry.getTargetContext();


    private final View mView = new View(mContext);

    private final ViewStructureImpl mViewStructure = new ViewStructureImpl(mView);

    private final ViewNode mViewNode = mViewStructure.getNode();

    @Mock
    @Mock
    private HtmlInfo mHtmlInfoMock;
    private HtmlInfo mHtmlInfoMock;


    @Test
    @Test
    public void testUnsupportedProperties() {
    public void testUnsupportedProperties() {
        View view = new View(mContext);
        mViewStructure.setChildCount(1);
        assertThat(mViewNode.getChildCount()).isEqualTo(0);

        mViewStructure.addChildCount(1);
        assertThat(mViewNode.getChildCount()).isEqualTo(0);


        ViewStructureImpl structure = new ViewStructureImpl(view);
        assertThat(mViewStructure.newChild(0)).isNull();
        ViewNode node = structure.getNode();
        assertThat(mViewNode.getChildCount()).isEqualTo(0);


        structure.setChildCount(1);
        assertThat(mViewStructure.asyncNewChild(0)).isNull();
        assertThat(node.getChildCount()).isEqualTo(0);
        assertThat(mViewNode.getChildCount()).isEqualTo(0);


        structure.addChildCount(1);
        mViewStructure.asyncCommit();
        assertThat(node.getChildCount()).isEqualTo(0);
        assertThat(mViewNode.getChildCount()).isEqualTo(0);


        assertThat(structure.newChild(0)).isNull();
        mViewStructure.setWebDomain("Y U NO SET?");
        assertThat(node.getChildCount()).isEqualTo(0);
        assertThat(mViewNode.getWebDomain()).isNull();


        assertThat(structure.asyncNewChild(0)).isNull();
        assertThat(mViewStructure.newHtmlInfoBuilder("WHATEVER")).isNull();
        assertThat(node.getChildCount()).isEqualTo(0);


        structure.asyncCommit();
        mViewStructure.setHtmlInfo(mHtmlInfoMock);
        assertThat(node.getChildCount()).isEqualTo(0);
        assertThat(mViewNode.getHtmlInfo()).isNull();


        structure.setWebDomain("Y U NO SET?");
        mViewStructure.setDataIsSensitive(true);
        assertThat(node.getWebDomain()).isNull();


        assertThat(structure.newHtmlInfoBuilder("WHATEVER")).isNull();
        assertThat(mViewStructure.getTempRect()).isNull();


        structure.setHtmlInfo(mHtmlInfoMock);
        // Graphic properties
        assertThat(node.getHtmlInfo()).isNull();
        mViewStructure.setElevation(6.66f);
        assertThat(mViewNode.getElevation()).isEqualTo(0f);
        mViewStructure.setAlpha(66.6f);
        assertThat(mViewNode.getAlpha()).isEqualTo(1.0f);
        mViewStructure.setTransformation(Matrix.IDENTITY_MATRIX);
        assertThat(mViewNode.getTransformation()).isNull();
    }


        structure.setDataIsSensitive(true);
    @Test
    public void testGetSet_textIdEntry() {
        assertThat(mViewNode.getTextIdEntry()).isNull();


        assertThat(structure.getTempRect()).isNull();
        String expected = "TEXT_ID_ENTRY";
        mViewNode.setTextIdEntry(expected);


        // Graphic properties
        assertThat(mViewNode.getTextIdEntry()).isEqualTo(expected);
        structure.setElevation(6.66f);
        assertThat(node.getElevation()).isWithin(1.0e-10f).of(0f);
        structure.setAlpha(66.6f);
        assertThat(node.getAlpha()).isWithin(1.0e-10f).of(1.0f);
        structure.setTransformation(Matrix.IDENTITY_MATRIX);
        assertThat(node.getTransformation()).isNull();
    }
    }
}
}