Skip to content

Commit 036b178

Browse files
author
Vasil Hristov
authored
Support HeapByteBuffer to ArrayBuffer conversion. (#135)
1 parent 27110dd commit 036b178

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var createViewModel = require("./main-view-model").createViewModel;
2+
3+
function onNavigatingTo(args) {
4+
var page = args.object;
5+
page.bindingContext = createViewModel();
6+
var bb = java.nio.ByteBuffer.allocate(12);
7+
var ab = ArrayBuffer.from(bb);
8+
console.log("###TEST PASSED###");
9+
}
10+
exports.onNavigatingTo = onNavigatingTo;

tests/emulator/android_runtime_tests.py

+20
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,23 @@ def test_302_check_if_class_implements_java_interface(self):
129129
assert 1 == 2, 'Check(instanceof) for java class implements java interface does not work' \
130130
'(myRunnable instanceof java.lang.Runnable)'
131131

132+
def test_303_support_HeapByteBuffer_to_ArrayBuffer(self):
133+
"""
134+
Test support HeapByteBuffer to ArrayBuffer
135+
https://github.com/NativeScript/android-runtime/issues/1060
136+
"""
137+
# Change main-page.js so it contains only logging information
138+
source_js = os.path.join('data', "issues", 'android-runtime-1060', 'main-page.js')
139+
target_js = os.path.join(self.app_name, 'app', 'main-page.js')
140+
File.copy(src=source_js, dest=target_js)
141+
142+
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID}, wait=False,
143+
assert_success=False)
144+
145+
Tns.wait_for_log(log_file=log, string_list=['Successfully synced application'], timeout=240, check_interval=10, clean_log=False)
146+
try:
147+
Tns.wait_for_log(log_file=log, string_list=["###TEST PASSED###"], timeout=60, check_interval=10,
148+
clean_log=False)
149+
except Exception as e:
150+
print str(e)
151+
assert 1 == 2, 'HeapByteBuffer to ArrayBuffer conversion is not working'

0 commit comments

Comments
 (0)