FLEX-18746 Added the same test, but without using opening animation. (This way the bug cannot be reproduced, which is a good clue.)
diff --git a/frameworks/projects/mx/tests/mx/controls/Tree_FLEX_18746_Tests.as b/frameworks/projects/mx/tests/mx/controls/Tree_FLEX_18746_Tests.as
index 26568d6..16a3cbc 100644
--- a/frameworks/projects/mx/tests/mx/controls/Tree_FLEX_18746_Tests.as
+++ b/frameworks/projects/mx/tests/mx/controls/Tree_FLEX_18746_Tests.as
@@ -18,8 +18,8 @@
private static var _sut:Tree;
private static var child:Object = {label: "Item"};
- private static var parent0:Object = {label: "Folder 0", children: new ArrayCollection()};
- private static var parent1:Object = {label: "Folder 1", children: new ArrayCollection([child])};
+ private static var parent0:Object;
+ private static var parent1:Object;
[Before]
@@ -28,6 +28,10 @@
_sut = new Tree();
_sut.width = 200;
_sut.height = 200;
+
+ parent0 = {label: "Folder 0", children: new ArrayCollection()};
+ parent1 = {label: "Folder 1", children: new ArrayCollection([child])};
+
UIImpersonator.addChild(_sut);
}
@@ -46,7 +50,7 @@
//--------------------------------------------------------------------------
[Test(async, timeout=1000)]
- public function test_closing_previously_opened_folder_with_0_children_does_not_throw_fatal():void
+ public function test_closing_previously_opened_folder_with_0_children_without_animation_does_not_throw_fatal():void
{
//given
const dataProvider:ArrayCollection = new ArrayCollection();
@@ -59,19 +63,36 @@
//then wait a few frames
noEnterFramesToWait = 2;
UIImpersonator.testDisplay.addEventListener(Event.ENTER_FRAME, onEnterFrame);
- Async.handleEvent(this, _finishNotifier, Event.COMPLETE, then_expand_second_folder, 300);
+ Async.handleEvent(this, _finishNotifier, Event.COMPLETE, then_expand_second_folder, 300, {useAnimation:false});
+ }
+
+ [Test(async, timeout=1000)]
+ public function test_closing_previously_opened_folder_with_0_children_using_animation_does_not_throw_fatal():void
+ {
+ //given
+ const dataProvider:ArrayCollection = new ArrayCollection();
+ dataProvider.addItem(parent0);
+ dataProvider.addItem(parent1);
+
+ //when
+ _sut.dataProvider = dataProvider;
+
+ //then wait a few frames
+ noEnterFramesToWait = 2;
+ UIImpersonator.testDisplay.addEventListener(Event.ENTER_FRAME, onEnterFrame);
+ Async.handleEvent(this, _finishNotifier, Event.COMPLETE, then_expand_second_folder, 300, {useAnimation:true});
}
private function then_expand_second_folder(event:Event, passThroughData:Object):void
{
//when
- _sut.expandItem(parent1, true, true, true);
+ _sut.expandItem(parent1, true, passThroughData.useAnimation, true);
//then wait a bit
noEnterFramesToWait = 5;
UIImpersonator.testDisplay.addEventListener(Event.ENTER_FRAME, onEnterFrame);
- Async.handleEvent(this, _finishNotifier, Event.COMPLETE, then_move_child_to_first_parent_and_expand_it, 500);
+ Async.handleEvent(this, _finishNotifier, Event.COMPLETE, then_move_child_to_first_parent_and_expand_it, 500, passThroughData);
}
private function then_move_child_to_first_parent_and_expand_it(event:Event, passThroughData:Object):void
@@ -81,19 +102,19 @@
//when
ArrayCollection(parent1.children).removeItemAt(0);
- _sut.expandItem(parent0, true, true, true);
+ _sut.expandItem(parent0, true, passThroughData.useAnimation, true);
ArrayCollection(parent0.children).addItem(child);
//then wait a bit
noEnterFramesToWait = 1;
UIImpersonator.testDisplay.addEventListener(Event.ENTER_FRAME, onEnterFrame);
- Async.handleEvent(this, _finishNotifier, Event.COMPLETE, then_contract_second_folder, 200);
+ Async.handleEvent(this, _finishNotifier, Event.COMPLETE, then_contract_second_folder, 200, passThroughData);
}
private static function then_contract_second_folder(event:Event, passThroughData:Object):void
{
//when
- _sut.expandItem(parent1, false, true, true);
+ _sut.expandItem(parent1, false, passThroughData.useAnimation, true);
//then no error was thrown
assertThat(true);