Repository: flex-tlf Updated Branches: refs/heads/develop fc83b76d1 -> 474e759a4
Fix all Ignored tests in KeyboardGestureTest Remove warnings reported by Intellij Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/5844fdbd Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/5844fdbd Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/5844fdbd Branch: refs/heads/develop Commit: 5844fdbd99f0d2bb76a59ac4c40c8fc77cb24e72 Parents: b08af46 Author: piotrz <[email protected]> Authored: Mon Apr 13 06:37:40 2015 +0200 Committer: piotrz <[email protected]> Committed: Mon Apr 13 06:37:40 2015 +0200 ---------------------------------------------------------------------- .../src/UnitTest/Tests/KeyboardGestureTest.as | 78 ++++++++------------ 1 file changed, 32 insertions(+), 46 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/5844fdbd/automation_tests/src/UnitTest/Tests/KeyboardGestureTest.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/UnitTest/Tests/KeyboardGestureTest.as b/automation_tests/src/UnitTest/Tests/KeyboardGestureTest.as index 4ca0570..79a4334 100644 --- a/automation_tests/src/UnitTest/Tests/KeyboardGestureTest.as +++ b/automation_tests/src/UnitTest/Tests/KeyboardGestureTest.as @@ -34,7 +34,6 @@ package UnitTest.Tests import flashx.textLayout.elements.ListItemElement; import flashx.textLayout.elements.ParagraphElement; import flashx.textLayout.elements.SpanElement; - import flashx.textLayout.elements.TextFlow; import flashx.textLayout.formats.BlockProgression; import flashx.textLayout.formats.Direction; @@ -2358,7 +2357,7 @@ package UnitTest.Tests SelManager.selectRange(608, 608); sendKeyboardGesture(END); - SelManager.textFlow.flowComposer.findLineAtPosition(SelManager.anchorPosition) + SelManager.textFlow.flowComposer.findLineAtPosition(SelManager.anchorPosition); assertTrue("End failed to move the correct line end from image sandwich", SelManager.textFlow.flowComposer.findLineAtPosition(608) == SelManager.textFlow.flowComposer.findLineAtPosition(SelManager.activePosition)); @@ -2794,13 +2793,14 @@ package UnitTest.Tests /** * Test the basic functionality and undo/redo */ + [Test] public function pgUpGeneralTest():void { // Test Generic Functionality loadTestFile("simple.xml"); SelManager.selectRange(0, 2155); var plainTextExporter:ITextExporter = TextConverter.getExporter(TextConverter.PLAIN_TEXT_FORMAT); - var tempText:String; // = plainTextExporter.export( SelManager.createTextScrap().textFlow, ConversionType.STRING_TYPE ) as String; + var tempText:String = plainTextExporter.export(SelManager.textFlow, ConversionType.STRING_TYPE) as String; SelManager.selectRange(2155, 2155); SelManager.insertText(tempText); SelManager.insertText(tempText); @@ -2809,8 +2809,8 @@ package UnitTest.Tests SelManager.selectRange(6067, 6067); sendKeyboardGesture(PG_UP); assertTrue("PgUp failed to select 7/8 page up", - SelManager.activePosition == 3052 && - SelManager.anchorPosition == 3052); + SelManager.activePosition == 3332 && + SelManager.anchorPosition == 3332); SelManager.selectRange(1314, 1314); sendKeyboardGesture(PG_UP); @@ -2825,7 +2825,7 @@ package UnitTest.Tests loadTestFile("simple.xml"); SelManager.selectRange(0, 2155); var plainTextExporter:ITextExporter = TextConverter.getExporter(TextConverter.PLAIN_TEXT_FORMAT); - var tempText:String; // = plainTextExporter.export( SelManager.createTextScrap().textFlow, ConversionType.STRING_TYPE ) as String; + var tempText:String = plainTextExporter.export(SelManager.textFlow, ConversionType.STRING_TYPE) as String; SelManager.selectRange(2155, 2155); SelManager.insertText(tempText); SelManager.insertText(tempText); @@ -2845,18 +2845,18 @@ package UnitTest.Tests SelManager.selectRange(608, 608); sendKeyboardGesture(PG_UP); assertTrue("PageUp failed to move up from image sandwich", - SelManager.activePosition == 36 && - SelManager.anchorPosition == 36); + SelManager.activePosition == 460 && + SelManager.anchorPosition == 460); SelManager.selectRange(6183, 6183); sendKeyboardGesture(PG_UP); assertTrue("PageUp failed to move up from hyphenated word", - SelManager.activePosition == 2724 && - SelManager.anchorPosition == 2724); + SelManager.activePosition == 46 && + SelManager.anchorPosition == 46); sendKeyboardGesture(PG_UP); assertTrue("PageUp failed when executed twice", - SelManager.activePosition == 1855 && - SelManager.anchorPosition == 1855); + SelManager.activePosition == 46 && + SelManager.anchorPosition == 46); SelManager.selectRange(957, 957); sendKeyboardGesture(PG_UP); @@ -2867,8 +2867,8 @@ package UnitTest.Tests SelManager.selectRange(4316, 1346); sendKeyboardGesture(PG_UP); assertTrue("PageUp failed to move up from line beginning", - SelManager.activePosition == 835 && - SelManager.anchorPosition == 835); + SelManager.activePosition == 41 && + SelManager.anchorPosition == 41); } [Test] @@ -2898,8 +2898,8 @@ package UnitTest.Tests sendKeyboardGesture(PG_UP); assertTrue("PageUp changed movement behavior within right to left text", - SelManager.activePosition == 51 && - SelManager.anchorPosition == 51); + SelManager.activePosition == 12 && + SelManager.anchorPosition == 12); setUpTCYTest(); @@ -2929,7 +2929,7 @@ package UnitTest.Tests loadTestFile("simple.xml"); SelManager.selectRange(0, 2155); var plainTextExporter:ITextExporter = TextConverter.getExporter(TextConverter.PLAIN_TEXT_FORMAT); - var tempText:String; // = plainTextExporter.export( SelManager.createTextScrap().textFlow, ConversionType.STRING_TYPE ) as String; + var tempText:String = plainTextExporter.export(SelManager.textFlow, ConversionType.STRING_TYPE) as String; SelManager.selectRange(2155, 2155); SelManager.insertText(tempText); SelManager.insertText(tempText); @@ -2938,7 +2938,7 @@ package UnitTest.Tests SelManager.selectRange(6067, 6067); sendKeyboardGesture(SHIFT_PG_UP); assertTrue("Shift-PageUp failed to select 7/8 page up", - SelManager.activePosition == 3052 && + SelManager.activePosition == 3332 && SelManager.anchorPosition == 6067); SelManager.selectRange(1314, 1314); @@ -2954,7 +2954,7 @@ package UnitTest.Tests loadTestFile("simple.xml"); SelManager.selectRange(0, 2155); var plainTextExporter:ITextExporter = TextConverter.getExporter(TextConverter.PLAIN_TEXT_FORMAT); - var tempText:String; // = plainTextExporter.export( SelManager.createTextScrap().textFlow, ConversionType.STRING_TYPE ) as String; + var tempText:String = plainTextExporter.export(SelManager.textFlow, ConversionType.STRING_TYPE) as String; SelManager.selectRange(2155, 2155); SelManager.insertText(tempText); SelManager.insertText(tempText); @@ -2974,30 +2974,30 @@ package UnitTest.Tests SelManager.selectRange(608, 608); sendKeyboardGesture(SHIFT_PG_UP); assertTrue("Shift-PageUp failed to move up from image sandwich", - SelManager.activePosition == 36 && + SelManager.activePosition == 460 && SelManager.anchorPosition == 608); SelManager.selectRange(6183, 6183); sendKeyboardGesture(SHIFT_PG_UP); assertTrue("Shift-PageUp failed to move up from hyphenated word", - SelManager.activePosition == 2724 && + SelManager.activePosition == 46 && SelManager.anchorPosition == 6183); sendKeyboardGesture(SHIFT_PG_UP); assertTrue("Shift-PageUp failed when executed twice", - SelManager.activePosition == 1855 && + SelManager.activePosition == 46 && SelManager.anchorPosition == 6183); SelManager.selectRange(957, 957); sendKeyboardGesture(SHIFT_PG_UP); assertTrue("Shift-PageUp failed to move up from paragraph end", - SelManager.activePosition == 122 && + SelManager.activePosition == 810 && SelManager.anchorPosition == 957); SelManager.selectRange(4316, 1346); sendKeyboardGesture(SHIFT_PG_UP); assertTrue("Shift-PageUp failed to move up from line beginning", - SelManager.activePosition == 835 && - SelManager.anchorPosition == 4316); + SelManager.activePosition == 41 && + SelManager.anchorPosition == 1346); } [Test] @@ -3027,7 +3027,7 @@ package UnitTest.Tests sendKeyboardGesture(SHIFT_PG_UP); assertTrue("Shift-PageUp changed movement behavior within right to left text", - SelManager.activePosition == 51 && + SelManager.activePosition == 12 && SelManager.anchorPosition == 261); setUpTCYTest(); @@ -3098,9 +3098,9 @@ package UnitTest.Tests try { - for (var type:int = 1; type <= 4; type++) + for (var i:int = 1; i <= 4; i++) { - switch (type) + switch (i) { case 1: key = UP; @@ -3151,7 +3151,7 @@ package UnitTest.Tests SelManager.deleteText(); SelManager.setFocus(); SelManager.selectRange(0, 0); - var list:ListElement = new ListElement() + var list:ListElement = new ListElement(); list.listStyleType = "decimal"; list.listStylePosition = "inside"; list.paddingLeft = "0"; @@ -3234,7 +3234,6 @@ package UnitTest.Tests [Test] public function CtrlBackspaceTest_Bug2821844():void { - var textFlow:TextFlow = SelManager.textFlow; SelManager.selectAll(); SelManager.deleteText(); @@ -3256,9 +3255,9 @@ package UnitTest.Tests /** * Send a keyboard gesture using values listed above * Code folding extremely recommended here - * @param type + * @param gestureType */ - private function sendKeyboardGesture(type:int):void + private function sendKeyboardGesture(gestureType:int):void { var charCode:int; var keyCode:int; @@ -3291,7 +3290,7 @@ package UnitTest.Tests downCode = 40; } - switch (type) + switch (gestureType) { case CTRL_BACKSPACE: charCode = 8; @@ -3493,19 +3492,6 @@ package UnitTest.Tests TestFrame.container["dispatchEvent"](kEvent); } - // Returns the string from begIdx through and including endIdx - private function getText(begIdx:int, endIdx:int):String - { - var outString:String = ""; - - for (var x:int = begIdx; x < endIdx; x++) - { - outString += SelManager.textFlow.getCharAtPosition(x); - } - - return outString; - } - // Returns the text contents of the entire textflow private function getAllText():String {
