未验证 提交 05cf3485 编写于 作者: O openharmony_ci 提交者: Gitee

!7711 修改ipc用例

Merge pull request !7711 from 张攀/cherry-pick-1677118168
...@@ -3959,7 +3959,7 @@ export default function actsRpcClientJsTest() { ...@@ -3959,7 +3959,7 @@ export default function actsRpcClientJsTest() {
let a = [new MySequenceable(1, "aaa"), new MySequenceable(2, "bbb"), let a = [new MySequenceable(1, "aaa"), new MySequenceable(2, "bbb"),
new MySequenceable(3, "ccc")] new MySequenceable(3, "ccc")]
data.writeParcelableArray(a); data.writeParcelableArray(a);
await gIRemoteObject.sendMessageRequest(CODE_ALL_ARRAY_TYPE, data, reply, option,(err, result) => { await gIRemoteObject.sendMessageRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => {
expect(result.errCode).assertEqual(0); expect(result.errCode).assertEqual(0);
assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3]); assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3]);
assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6]); assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6]);
...@@ -4015,15 +4015,33 @@ export default function actsRpcClientJsTest() { ...@@ -4015,15 +4015,33 @@ export default function actsRpcClientJsTest() {
data.writeParcelableArray(a); data.writeParcelableArray(a);
await gIRemoteObject.sendMessageRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => { await gIRemoteObject.sendMessageRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => {
expect(result.errCode).assertEqual(0); expect(result.errCode).assertEqual(0);
assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3]); let ByteArray = new Array();
assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6]); result.reply.readByteArray(ByteArray)
assertArrayElementEqual(result.reply.readIntArray(), [7, 8, 9]); assertArrayElementEqual(ByteArray, [1, 2, 3]);
assertArrayElementEqual(result.reply.readLongArray(), [10, 11, 12]); let ShortArray = new Array();
assertArrayElementEqual(result.reply.readFloatArray(), [1.1, 1.2, 1.3]); result.reply.readShortArray(ShortArray)
assertArrayElementEqual(result.reply.readDoubleArray(), [2.1, 2.2, 2.3]); assertArrayElementEqual(ShortArray, [4, 5, 6]);
assertArrayElementEqual(result.reply.readBooleanArray(), [true, true, false]); let IntArray = new Array();
assertArrayElementEqual(result.reply.readCharArray(), [65,97,122]); result.reply.readIntArray(IntArray)
assertArrayElementEqual(result.reply.readStringArray(), ['abc', 'seggg']); assertArrayElementEqual(IntArray, [7, 8, 9]);
let LongArray = new Array();
result.reply.readLongArray(LongArray)
assertArrayElementEqual(LongArray, [10, 11, 12]);
let FloatArray = new Array();
result.reply.readFloatArray(FloatArray)
assertArrayElementEqual(FloatArray, [1.1, 1.2, 1.3]);
let DoubleArray = new Array();
result.reply.readDoubleArray(DoubleArray)
assertArrayElementEqual(DoubleArray, [2.1, 2.2, 2.3]);
let BooleanArray = new Array();
result.reply.readBooleanArray(BooleanArray)
assertArrayElementEqual(BooleanArray, [true, true, false]);
let CharArray = new Array();
result.reply.readCharArray(CharArray)
assertArrayElementEqual(CharArray, [65,97,122]);
let StringArray = new Array();
result.reply.readStringArray(StringArray);
assertArrayElementEqual(StringArray, ['abc', 'seggg']);
let b = [new MySequenceable(null, null), new MySequenceable(null, null), let b = [new MySequenceable(null, null), new MySequenceable(null, null),
new MySequenceable(null, null)]; new MySequenceable(null, null)];
result.reply.readParcelableArray(b); result.reply.readParcelableArray(b);
...@@ -9533,7 +9551,7 @@ export default function actsRpcClientJsTest() { ...@@ -9533,7 +9551,7 @@ export default function actsRpcClientJsTest() {
let a = [new MySequenceable(1, "aaa"), new MySequenceable(2, "bbb"), let a = [new MySequenceable(1, "aaa"), new MySequenceable(2, "bbb"),
new MySequenceable(3, "ccc")]; new MySequenceable(3, "ccc")];
expect(data.writeSequenceableArray(a)).assertTrue(); expect(data.writeSequenceableArray(a)).assertTrue();
gIRemoteObject.sendRequest(CODE_ALL_ARRAY_TYPE, data, reply, option,(err, result) => { gIRemoteObject.sendRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => {
expect(result.errCode).assertEqual(0); expect(result.errCode).assertEqual(0);
assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3]); assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3]);
assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6]); assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6]);
...@@ -9593,15 +9611,33 @@ export default function actsRpcClientJsTest() { ...@@ -9593,15 +9611,33 @@ export default function actsRpcClientJsTest() {
expect(data.writeSequenceableArray(a)).assertTrue(); expect(data.writeSequenceableArray(a)).assertTrue();
gIRemoteObject.sendRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => { gIRemoteObject.sendRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => {
expect(result.errCode).assertEqual(0); expect(result.errCode).assertEqual(0);
assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3]); let ByteArray = new Array();
assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6]); result.reply.readByteArray(ByteArray)
assertArrayElementEqual(result.reply.readIntArray(), [7, 8, 9]); assertArrayElementEqual(ByteArray, [1, 2, 3]);
assertArrayElementEqual(result.reply.readLongArray(), [10, 11, 12]); let ShortArray = new Array();
assertArrayElementEqual(result.reply.readFloatArray(), [1.1, 1.2, 1.3]); result.reply.readShortArray(ShortArray)
assertArrayElementEqual(result.reply.readDoubleArray(), [2.1, 2.2, 2.3]); assertArrayElementEqual(ShortArray, [4, 5, 6]);
assertArrayElementEqual(result.reply.readBooleanArray(), [true, true, false]); let IntArray = new Array();
assertArrayElementEqual(result.reply.readCharArray(), [10, 20, 30]); result.reply.readIntArray(IntArray)
assertArrayElementEqual(result.reply.readStringArray(), ['abc', 'seggg']); assertArrayElementEqual(IntArray, [7, 8, 9]);
let LongArray = new Array();
result.reply.readLongArray(LongArray)
assertArrayElementEqual(LongArray, [10, 11, 12]);
let FloatArray = new Array();
result.reply.readFloatArray(FloatArray)
assertArrayElementEqual(FloatArray, [1.1, 1.2, 1.3]);
let DoubleArray = new Array();
result.reply.readDoubleArray(DoubleArray)
assertArrayElementEqual(DoubleArray, [2.1, 2.2, 2.3]);
let BooleanArray = new Array();
result.reply.readBooleanArray(BooleanArray)
assertArrayElementEqual(BooleanArray, [true, true, false]);
let CharArray = new Array();
result.reply.readCharArray(CharArray)
assertArrayElementEqual(CharArray, [65,97,122]);
let StringArray = new Array();
result.reply.readStringArray(StringArray);
assertArrayElementEqual(StringArray, ['abc', 'seggg']);
let b = [new MySequenceable(null, null), new MySequenceable(null, null), let b = [new MySequenceable(null, null), new MySequenceable(null, null),
new MySequenceable(null, null)]; new MySequenceable(null, null)];
result.reply.readSequenceableArray(b); result.reply.readSequenceableArray(b);
...@@ -13206,7 +13242,7 @@ export default function actsRpcClientJsTest() { ...@@ -13206,7 +13242,7 @@ export default function actsRpcClientJsTest() {
data.writeString("HelloWorld"); data.writeString("HelloWorld");
data.writeParcelable(new MySequenceable(1, "aaa")); data.writeParcelable(new MySequenceable(1, "aaa"));
await gIRemoteObject.sendMessageRequest(CODE_ALL_TYPE, data, reply, option, (err, result) => { await gIRemoteObject.sendMessageRequest(CODE_ALL_TYPE, data, reply, option).then((result) => {
console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900 errorcode: " + result.errCode); console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900 errorcode: " + result.errCode);
expect(result.errCode).assertEqual(0); expect(result.errCode).assertEqual(0);
expect(result.reply.readByte()).assertEqual(1); expect(result.reply.readByte()).assertEqual(1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册