mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 895960 - Part 2: Test cases for reading PBR. r=hsinyi
This commit is contained in:
parent
9575de9cae
commit
dd802dcdd9
@ -1790,6 +1790,64 @@ add_test(function test_load_linear_fixed_ef() {
|
||||
io.loadLinearFixedEF({});
|
||||
});
|
||||
|
||||
/**
|
||||
* Verify ICCRecordHelper.readPBR
|
||||
*/
|
||||
add_test(function test_read_pbr() {
|
||||
let worker = newUint8Worker();
|
||||
let helper = worker.GsmPDUHelper;
|
||||
let record = worker.ICCRecordHelper;
|
||||
let buf = worker.Buf;
|
||||
let io = worker.ICCIOHelper;
|
||||
|
||||
io.loadLinearFixedEF = function fakeLoadLinearFixedEF(options) {
|
||||
let pbr_1 = [
|
||||
0xa8, 0x05, 0xc0, 0x03, 0x4f, 0x3a, 0x01
|
||||
];
|
||||
|
||||
// Write data size
|
||||
buf.writeUint32(pbr_1.length * 2);
|
||||
|
||||
// Write pbr
|
||||
for (let i = 0; i < pbr_1.length; i++) {
|
||||
helper.writeHexOctet(pbr_1[i]);
|
||||
}
|
||||
|
||||
// Write string delimiter
|
||||
buf.writeStringDelimiter(pbr_1.length * 2);
|
||||
|
||||
options.totalRecords = 2;
|
||||
if (options.callback) {
|
||||
options.callback(options);
|
||||
}
|
||||
};
|
||||
|
||||
io.loadNextRecord = function fakeLoadNextRecord(options) {
|
||||
let pbr_2 = [
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||
];
|
||||
|
||||
options.p1++;
|
||||
if (options.callback) {
|
||||
options.callback(options);
|
||||
}
|
||||
};
|
||||
|
||||
let successCb = function successCb(pbrs) {
|
||||
do_check_eq(pbrs[0].adn.fileId, 0x4f3a);
|
||||
do_check_eq(pbrs.length, 1);
|
||||
run_next_test();
|
||||
};
|
||||
|
||||
let errorCb = function errorCb(errorMsg) {
|
||||
do_print("Reading EF_PBR failed, msg = " + errorMsg);
|
||||
do_check_true(false);
|
||||
run_next_test();
|
||||
};
|
||||
|
||||
record.readPBR(successCb, errorCb);
|
||||
});
|
||||
|
||||
/**
|
||||
* Verify ICCRecordHelper.readEmail
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user