mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Add a totalLength
getter to OperatorList
, since the length
is zero after flushing
In the `RenderPageRequest` handler in `worker.js`, we attempt to print an `info` message containing the rendering time and the length of the operator list. The latter is currently broken (and has been for quite some time), since the `length` of an `OperatorList` is reset when flushing occurs. This patch attempts to rectify this, by adding a getter which keeps track of the total length.
This commit is contained in:
parent
aae82ec4c5
commit
1c66d4a106
3 changed files with 35 additions and 2 deletions
|
@ -305,4 +305,25 @@ describe('evaluator', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('operator list', function () {
|
||||
function MessageHandlerMock() { }
|
||||
MessageHandlerMock.prototype = {
|
||||
send: function () { },
|
||||
};
|
||||
|
||||
it('should get correct total length after flushing', function () {
|
||||
var operatorList = new OperatorList(null, new MessageHandlerMock());
|
||||
operatorList.addOp(OPS.save, null);
|
||||
operatorList.addOp(OPS.restore, null);
|
||||
|
||||
expect(operatorList.totalLength).toEqual(2);
|
||||
expect(operatorList.length).toEqual(2);
|
||||
|
||||
operatorList.flush();
|
||||
|
||||
expect(operatorList.totalLength).toEqual(2);
|
||||
expect(operatorList.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue