mirror of
https://github.com/openstf/stf
synced 2025-10-05 10:39:25 +02:00
Gesturestart had an off by one error in the control sequence.
This commit is contained in:
parent
85427fc50a
commit
68e8f1eb2f
2 changed files with 30 additions and 28 deletions
|
@ -9,7 +9,9 @@ function SeqQueue(size, maxWaiting) {
|
|||
|
||||
SeqQueue.prototype.start = function(seq) {
|
||||
this.locked = false
|
||||
this.lo = seq
|
||||
// The loop in maybeConsume() will make sure that the value wraps correctly
|
||||
// if necessary.
|
||||
this.lo = seq + 1
|
||||
this.maybeConsume()
|
||||
}
|
||||
|
||||
|
@ -35,7 +37,7 @@ SeqQueue.prototype.maybeConsume = function() {
|
|||
|
||||
while (this.waiting) {
|
||||
// Did we reach the end of the loop? If so, start from the beginning.
|
||||
if (this.lo === this.size) {
|
||||
if (this.lo >= this.size) {
|
||||
this.lo = 0
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('SeqQueue', function() {
|
|||
it('should wait until started', function() {
|
||||
var spy = sinon.spy()
|
||||
var q = new SeqQueue(10, Infinity)
|
||||
q.push(0, spy)
|
||||
q.push(1, spy)
|
||||
expect(spy).to.not.have.been.called
|
||||
q.start(0)
|
||||
expect(spy).to.have.been.calledOnce
|
||||
|
@ -19,7 +19,7 @@ describe('SeqQueue', function() {
|
|||
var spy = sinon.spy()
|
||||
var q = new SeqQueue(10, Infinity)
|
||||
q.start(0)
|
||||
q.push(0, spy)
|
||||
q.push(1, spy)
|
||||
expect(spy).to.have.been.calledOnce
|
||||
})
|
||||
|
||||
|
@ -30,10 +30,10 @@ describe('SeqQueue', function() {
|
|||
var spy4 = sinon.spy()
|
||||
var q = new SeqQueue(10, Infinity)
|
||||
q.start(0)
|
||||
q.push(0, spy1)
|
||||
q.push(1, spy2)
|
||||
q.push(2, spy3)
|
||||
q.push(3, spy4)
|
||||
q.push(1, spy1)
|
||||
q.push(2, spy2)
|
||||
q.push(3, spy3)
|
||||
q.push(4, spy4)
|
||||
expect(spy1).to.have.been.calledOnce
|
||||
expect(spy2).to.have.been.calledOnce
|
||||
expect(spy3).to.have.been.calledOnce
|
||||
|
@ -47,14 +47,14 @@ describe('SeqQueue', function() {
|
|||
var spy4 = sinon.spy()
|
||||
var q = new SeqQueue(10, Infinity)
|
||||
q.start(0)
|
||||
q.push(0, spy1)
|
||||
q.push(3, spy4)
|
||||
q.push(1, spy1)
|
||||
q.push(4, spy4)
|
||||
expect(spy1).to.have.been.calledOnce
|
||||
expect(spy4).to.not.have.been.called
|
||||
q.push(2, spy3)
|
||||
q.push(3, spy3)
|
||||
expect(spy3).to.not.have.been.called
|
||||
expect(spy4).to.not.have.been.called
|
||||
q.push(1, spy2)
|
||||
q.push(2, spy2)
|
||||
expect(spy2).to.have.been.calledOnce
|
||||
expect(spy3).to.have.been.calledOnce
|
||||
expect(spy4).to.have.been.calledOnce
|
||||
|
@ -67,10 +67,10 @@ describe('SeqQueue', function() {
|
|||
var spy4 = sinon.spy()
|
||||
var q = new SeqQueue(10, 2)
|
||||
q.start(0)
|
||||
q.push(0, spy1)
|
||||
q.push(2, spy3)
|
||||
q.push(3, spy4)
|
||||
q.push(1, spy2)
|
||||
q.push(1, spy1)
|
||||
q.push(3, spy3)
|
||||
q.push(4, spy4)
|
||||
q.push(2, spy2)
|
||||
expect(spy1).to.have.been.calledOnce
|
||||
expect(spy2).to.not.have.been.called
|
||||
expect(spy3).to.have.been.calledOnce
|
||||
|
@ -82,14 +82,14 @@ describe('SeqQueue', function() {
|
|||
var spy2 = sinon.spy()
|
||||
var spy3 = sinon.spy()
|
||||
var spy4 = sinon.spy()
|
||||
var q = new SeqQueue(2, Infinity)
|
||||
var q = new SeqQueue(10, Infinity)
|
||||
q.start(0)
|
||||
q.push(0, spy1)
|
||||
q.push(1, spy2)
|
||||
q.stop(2)
|
||||
q.push(1, spy1)
|
||||
q.push(2, spy2)
|
||||
q.stop(3)
|
||||
q.start(0)
|
||||
q.push(0, spy3)
|
||||
q.push(1, spy4)
|
||||
q.push(1, spy3)
|
||||
q.push(2, spy4)
|
||||
expect(spy1).to.have.been.calledOnce
|
||||
expect(spy2).to.have.been.calledOnce
|
||||
expect(spy3).to.have.been.calledOnce
|
||||
|
@ -100,15 +100,15 @@ describe('SeqQueue', function() {
|
|||
var spy1 = sinon.spy()
|
||||
var spy2 = sinon.spy()
|
||||
var spy3 = sinon.spy()
|
||||
var q = new SeqQueue(1, Infinity)
|
||||
var q = new SeqQueue(2, Infinity)
|
||||
q.start(0)
|
||||
q.push(0, spy1)
|
||||
q.stop(1)
|
||||
q.push(1, spy1)
|
||||
q.stop(2)
|
||||
q.start(0)
|
||||
q.push(0, spy2)
|
||||
q.stop(1)
|
||||
q.push(1, spy2)
|
||||
q.stop(2)
|
||||
q.start(0)
|
||||
q.push(0, spy3)
|
||||
q.push(1, spy3)
|
||||
expect(spy1).to.have.been.calledOnce
|
||||
expect(spy2).to.have.been.calledOnce
|
||||
expect(spy3).to.have.been.calledOnce
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue