1
0
Fork 0
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:
Jonas Jenwald 2015-10-26 16:38:06 +01:00
parent aae82ec4c5
commit 1c66d4a106
3 changed files with 35 additions and 2 deletions

View file

@ -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);
});
});
});