diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..cae93e3697c5c5eb2f5e1536e5267360e3c426a7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,2 @@ +# 0.0.1-SNAPSHOT: +- ohos 第一个版本,完整实现了原库的全部 api diff --git a/README.OPENSOURCE b/README.OPENSOURCE index ac96d905f8ad3e84fed1bbc853c16394e127f859..10f6a464912a59dcc59bc97b4849f6bacadf3c15 100644 --- a/README.OPENSOURCE +++ b/README.OPENSOURCE @@ -2,17 +2,17 @@ { - "Name": "PinView", + "Name": " PinView ", - "License": "Apache License 2.0", + "License": " Apache License 2.0 ", - "License File": "https://github.com/ChaosLeung/PinView/blob/master/LICENSE", + "License File": " LICENSE ", - "Version Number": "1.4.3", + "Version Number": " v1.4.3 ", - "Upstream URL": "https://github.com/ChaosLeung/PinView", + "Upstream URL": " https://github.com/ChaosLeung/PinView/archive/1.4.3.tar.gz ", - "Description": "输入框的背景颜色的动态变化,基线的显示与隐藏,明文密文的切换" + "Description": " 输入框的背景颜色的动态变化,基线的显示与隐藏,明文密文的切换 " } diff --git a/changeLog.md b/changeLog.md deleted file mode 100644 index 63dc57e41e7130a4cc2bde0ed41b7c10830b041c..0000000000000000000000000000000000000000 --- a/changeLog.md +++ /dev/null @@ -1,8 +0,0 @@ -# 基本功能: -- 输入框的背景颜色的动态变化,基线的显示与隐藏,明文密文的切换 - -# 修改点: -1. EditText 鸿蒙使用TextField替换实现 - -# 遗留问题(暂不支持的功能): -无 \ No newline at end of file diff --git a/entry/build.gradle b/entry/build.gradle index c75cfa0b1f4fedf5386ea2384e569ae999e4e97a..9eb1f5b67ebda5d937f58c88c1710e534c2f529a 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -23,6 +23,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) implementation project(path: ':pinview') testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' } decc { supportType = ['html', 'xml'] diff --git a/entry/src/ohosTest/config.json b/entry/src/ohosTest/config.json new file mode 100644 index 0000000000000000000000000000000000000000..0dc05983e4ff012c8f73d3f7cc02f83a7fed579e --- /dev/null +++ b/entry/src/ohosTest/config.json @@ -0,0 +1,40 @@ +{ + "app": { + "bundleName": "com.chaos.view.example", + "vendor": "chaos", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.chaos.view.example", + "name": "testModule", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry_test", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "name": "decc.testkit.runner.EntryAbility", + "description": "Test Entry Ability", + "icon": "$media:icon", + "label": "$string:app_name", + "launchType": "standard", + "orientation": "landscape", + "visible": true, + "type": "page" + } + ] + } +} \ No newline at end of file diff --git a/entry/src/ohosTest/java/com/chaos/view/example/ExampleOhosTest.java b/entry/src/ohosTest/java/com/chaos/view/example/ExampleOhosTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f5efac01d1d4c18fc2e2f471d8cfd91090a291ce --- /dev/null +++ b/entry/src/ohosTest/java/com/chaos/view/example/ExampleOhosTest.java @@ -0,0 +1,17 @@ +package com.chaos.view.example; + +import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import org.junit.Test; + + +import static org.junit.Assert.assertEquals; + +public class ExampleOhosTest { + + + @Test + public void testBundleName() { + final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); + assertEquals("com.chaos.view.example", actualBundleName); + } +} \ No newline at end of file diff --git a/entry/src/ohosTest/java/com/chaos/view/example/PinViewTest.java b/entry/src/ohosTest/java/com/chaos/view/example/PinViewTest.java new file mode 100644 index 0000000000000000000000000000000000000000..68d2289b3422d9ec4361c5abeceae9975cdd9576 --- /dev/null +++ b/entry/src/ohosTest/java/com/chaos/view/example/PinViewTest.java @@ -0,0 +1,13 @@ +package com.chaos.view.example; + +import com.chaos.view.PinView; +import junit.framework.TestCase; +import org.junit.Test; + +public class PinViewTest extends TestCase { + @Test + public void testIsNumeric() { + assertTrue(PinView.isNumeric("655")); + assertFalse(PinView.isNumeric("ddd")); + } +} diff --git a/pinview/build.gradle b/pinview/build.gradle index e1bc01664c3aefe3feeaa3e1a60b49f48652629b..c531a1764f1b9ce84aab058bd80ec3962b171940 100644 --- a/pinview/build.gradle +++ b/pinview/build.gradle @@ -9,6 +9,8 @@ ohos { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) testImplementation 'junit:junit:4.13' + testImplementation 'org.powermock:powermock-api-mockito2:2.0.2' + testImplementation 'org.powermock:powermock-module-junit4:2.0.2' } /** diff --git a/pinview/src/main/java/com/chaos/view/PinView.java b/pinview/src/main/java/com/chaos/view/PinView.java index d6061c0534b9ee0631f5e5daf45f5d4f72c659e2..53d17ba32886300ea655eaeccdf7d8dc08bfc8e0 100644 --- a/pinview/src/main/java/com/chaos/view/PinView.java +++ b/pinview/src/main/java/com/chaos/view/PinView.java @@ -311,7 +311,7 @@ public class PinView extends TextField implements Component.BindStateChangedList * @param str 传进来的文本 * @return boolean */ - public boolean isNumeric(String str) { + public static boolean isNumeric(String str) { Pattern pattern = Pattern.compile("[0-9]*"); Matcher isNum = pattern.matcher(str); if (!isNum.matches()) {