Opened 9 years ago

Closed 9 years ago

#11399 closed defect (fixed)

Safari5: diji.tests.robot.FullScreen test failures

Reported by: Chris Mitchell Owned by: bill
Priority: high Milestone: 1.5
Component: Editor Version: 1.5.0b2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

GROUP "FullScreen_tests" has 12 tests to run
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::Keyboard: Go to Fullscreen (CTRL-SHIFT-F11) 1516 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::Keyboard: Go to fullscreen and back 3506 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::Mouse Click: Go to Fullscreen 2360 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::Mouse Click: Go to fullscreen and back 4712 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::BorderContainer:  Go Fullscreen, Reduce BorderContainer, Exit FullScreen, Validate Resize 4036 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::BorderContainer:  Go Fullscreen, Increase BorderContainer, Exit FullScreen, Validate Resize 4018 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::TabContainer:  Go Fullscreen, Reduce TabContainer, Exit FullScreen, Validate Resize 4034 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::TabContainer:  Go Fullscreen, Increase TabContainer, Exit FullScreen, Validate Resize 4020 ms
     ERROR IN:
 		 function () {
							var d = new doh.Deferred();

							try{
								//Focus on the editor window
								dojo.window.scrollIntoView(editor.domNode);
								editor.focus();

								var origEditorSize = dojo.marginBox(editor.domNode);
								var origContainerSize = dojo.marginBox(container.domNode);
								os = {w: origContainerSize.w, h: origContainerSize.h}

								//Find the fullscreen plugin, we'll need it.
								doh.assertTrue(fsPlugin != null);

								doh.robot.sequence(function(){
									// Engage FullScreen Mode
									fsPlugin.button.set("checked", true);
								}, 1000);
								doh.robot.sequence(function(){
									// Resize the container
									container.resize({w: 400, h: 400});
								}, 1000);
								doh.robot.sequence(function(){
									// Disengage FullScreen Mode
									fsPlugin.button.set("checked", false);
								}, 1000);
								doh.robot.sequence(d.getTestCallback(function(){
									// Now validate the editor resized when it returned since
									// the Container was resized.
									var curEditorSize = dojo.marginBox(editor.domNode);
									var curContainerSize = dojo.marginBox(container.domNode);
									var containerWdiff = origContainerSize.w - curContainerSize.w;
									var containerHdiff = origContainerSize.h - curContainerSize.h;
									var eWdiff= origEditorSize.w - curEditorSize.w;
									var eHdiff= origEditorSize.h - curEditorSize.h;
									
									doh.assertTrue(origEditorSize.w > curEditorSize.w, "Validating new width is less that the original size");
									doh.assertTrue(origEditorSize.h > curEditorSize.h, "Validating new height is less that the original size");
									doh.assertTrue((eWdiff < (containerWdiff + 5)) && (eWdiff > (containerWdiff - 5)), "Doing a rouch check that the editor width resized roughly to the Container difference");
									doh.assertTrue((eHdiff < (containerHdiff + 5)) && (eHdiff > (containerHdiff - 5)), "Doing a rouch check that the editor height resized roughly to the Container difference");
								}), 1000);


							}catch(e){
								d.errback(e);
							}
							return d;
						}
 FAILED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::AccordionContainer:  Go Fullscreen, Reduce AccordionContainer, Exit FullScreen, Validate Resize 16 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::AccordionContainer:  Go Fullscreen, Increase AccordionContainer, Exit FullScreen, Validate Resize 4021 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::StackContainer:  Go Fullscreen, Reduce StackContainer, Exit FullScreen, Validate Resize 4027 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html::FullScreen_tests::StackContainer:  Go Fullscreen, Increase StackContainer, Exit FullScreen, Validate Resize 4018 ms
 PASSED test: ../../dijit/tests/editor/robot/Editor_FullScreen.html 41535 ms

Change History (5)

comment:1 Changed 9 years ago by bill

Component: GeneralEditor
Description: modified (diff)
Milestone: tbd1.5
Owner: anonymous deleted

editor/robot/Editor_FullScreen.html (the standalone test) fails for me too.

comment:2 Changed 9 years ago by Chris Mitchell

Able to reproduce on separate run. Safari Version 5.0 (6533.16), Mac OSX SnowLeopard? x64

comment:3 Changed 9 years ago by Chris Mitchell

Also able to reproduce on separate OS Safari Version 5.0 (7533.16), Windows7 x64

comment:4 Changed 9 years ago by bill

Owner: set to bill
Status: newassigned

Exception happens in editor.focus(), which tries to not only focus the editor but to set the caret/selection. The editor in question is empty, but contains a single space character to workaround some browser bugs (although not sure safari5 has that bug still).

Specifically, placeCursorAtStart() calls selectElementChildren() (in selection.js), which makes an call of

selection.setBaseAndExtent(element, 0, element, element.innerText.length - 1);

The problem is that element.innerText is returning "" even though there's actually a space character, thus making the range [0, -1] rather than [0, 0]

On a bigger scale looks like select.js/selectElementChildren() has a special code path for Safari (dating back to [8754]) that's no longer needed on Safari4/Safari5.

comment:5 Changed 9 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [22413]) Remove code path for safari 3 (or maybe safari 2) that's no longer needed on safari 4+, and actually breaks editor.focus() on a blank editor. Fixes #11399.

Note: See TracTickets for help on using tickets.