robertpenner/as3-signals — Issue #59: priority signal bug
Author: jaydenmorris
Created: 2011-11-07 14:31:40+00:00
State: open

I think I have come across a bug in the priority signal. I did a series of unit tests to narrow it down and this one failed to fill 5 slots.

[Test]
public function positive_to_negative_priority_values():void
{
_signal.addWithPriority(testFunction_1, 1);
Assert.assertEquals(_signal.numListeners, 1);

_signal.addWithPriority(testFunction_2, 0);
Assert.assertEquals(_signal.numListeners, 2);

_signal.addWithPriority(testFunction_3, -1);
Assert.assertEquals(_signal.numListeners, 3);

_signal.addWithPriority(testFunction_4, 0);
Assert.assertEquals(_signal.numListeners, 4);

_signal.addWithPriority(testFunction_5, 1);
Assert.assertEquals(_signal.numListeners, 5);
}

if you use 1, 0 then -1 as signal priorities in that order in a proper test case it should be reproducible.

I love signals btw. building a game with them :)