diff --git a/entry/build.gradle b/entry/build.gradle index 15971d45f3de70fe510db5246d66f0c78a35b971..3d3b404b1a372e6168a71fbd273cb3f44290f493 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -24,6 +24,8 @@ dependencies { implementation 'io.reactivex:rxjava:1.1.9' implementation 'com.alibaba:fastjson:1.2.55' implementation project(path: ":ikvstockchart") + testImplementation 'org.mockito:mockito-core:2.23.0' + testImplementation 'com.google.truth:truth:0.39' } decc { supportType = ['html', 'xml'] diff --git a/entry/src/ohosTest/java/com/wordplat/quickstart/AbstractRenderTest.java b/entry/src/ohosTest/java/com/wordplat/quickstart/AbstractRenderTest.java new file mode 100644 index 0000000000000000000000000000000000000000..86f96e6c81a808f90342196db8e06cae3f674778 --- /dev/null +++ b/entry/src/ohosTest/java/com/wordplat/quickstart/AbstractRenderTest.java @@ -0,0 +1,47 @@ +package com.wordplat.quickstart; + +import com.wordplat.ikvstockchart.render.AbstractRender; +import org.junit.Test; + +import static org.mockito.Mockito.mock; + + +public class AbstractRenderTest { + private AbstractRender render = mock(AbstractRender.class); + @Test + public void canDragging() { + render.canDragging(12); + } + @Test + public void canScroll() { + render.canScroll(12); + } + @Test + public void getSizeColor() { + render.getSizeColor(); + } + @Test + public void invertMapPoints() { + float[] floats = {1, 2, 3, 4}; + render.invertMapPoints(floats); + } + @Test + public void onHighlight() { + render.onHighlight(12, 12); + } + @Test + public void mapPoints() { + float[] floats = {1, 2, 3, 4}; + render.mapPoints(floats); + } + @Test + public void zoomIn() { + render.zoomIn(12, 12); + } + @Test + public void zoomOut() { + render.zoomOut(12, 12); + } + + +} diff --git a/entry/src/ohosTest/java/com/wordplat/quickstart/ExampleOhosTest.java b/entry/src/ohosTest/java/com/wordplat/quickstart/ExampleOhosTest.java index c4972164bce26776af3dd3b16f5873fed4818bc9..1be28c0040dbe8e6a80b714519710cbfc3846241 100644 --- a/entry/src/ohosTest/java/com/wordplat/quickstart/ExampleOhosTest.java +++ b/entry/src/ohosTest/java/com/wordplat/quickstart/ExampleOhosTest.java @@ -6,9 +6,10 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; public class ExampleOhosTest { + //(全UI应用、不支持Context等等原因)不支持单元测试 @Test public void testBundleName() { final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); assertEquals("com.wordplat.quickstart", actualBundleName); } -} \ No newline at end of file +} diff --git a/entry/src/ohosTest/java/com/wordplat/quickstart/InteractiveKLineLayoutTest.java b/entry/src/ohosTest/java/com/wordplat/quickstart/InteractiveKLineLayoutTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4d584ee5aa0bbae2595cb96552f42f0661dd29f1 --- /dev/null +++ b/entry/src/ohosTest/java/com/wordplat/quickstart/InteractiveKLineLayoutTest.java @@ -0,0 +1,81 @@ +package com.wordplat.quickstart; + +import com.wordplat.ikvstockchart.InteractiveKLineLayout; +import org.junit.Test; + +import static org.mockito.Mockito.mock; + + +public class InteractiveKLineLayoutTest { + private InteractiveKLineLayout layout = mock(InteractiveKLineLayout.class); + + @Test + public void announceAccessibility() { + layout.announceAccessibility("text some"); + } + + @Test + public void arrange() { + layout.arrange(12, 12, 12, 12); + } + + @Test + public void bindCornerMark() { + layout.bindCornerMark(); + } + + @Test + public void callOnClick() { + layout.callOnClick(); + } + + @Test + public void clearFocus() { + layout.clearFocus(); + } + + @Test + public void enableCornerMark() { + layout.enableCornerMark(true); + } + + @Test + public void simulateClick() { + layout.simulateClick(); + } + + @Test + public void simulateDrag() { + layout.simulateDrag(); + } + + @Test + public void createAnimatorProperty() { + layout.createAnimatorProperty(); + } + + @Test + public void getKLineView() { + layout.getKLineView(); + } + + @Test + public void isShownBOLL() { + layout.isShownBOLL(); + } + + @Test + public void isShownKDJ() { + layout.isShownKDJ(); + } + + @Test + public void isShownMACD() { + layout.isShownMACD(); + } + + @Test + public void isShownRSI() { + layout.isShownRSI(); + } +}