From 6fc751f89b971504cbaec7be83a7f5d3bc8c8455 Mon Sep 17 00:00:00 2001 From: Adrian Heine <mail@adrianheine.de> Date: Thu, 26 Jan 2017 11:39:51 +0100 Subject: [PATCH] Trust and test goLineStart --- test/test.js | 74 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/test/test.js b/test/test.js index 633190ac6..7f6d5d860 100644 --- a/test/test.js +++ b/test/test.js @@ -2232,13 +2232,7 @@ function testMoveBidi(str) { } // Make sure we are at the visual beginning of the first line - var pos = Pos(0, 0), lastPos; - cm.doc.setCursor(pos); - do { - lastPos = pos; - cm.execCommand("goCharLeft"); - pos = cm.doc.getCursor(); - } while (pos != lastPos && pos.ch != 0) + cm.execCommand("goLineStart"); var prevCoords = cm.cursorCoords(), coords; for(var i = 0; i < steps; ++i) { @@ -2283,37 +2277,61 @@ function testMoveBidi(str) { }, {value: str, lineWrapping: true}) }; +function testMoveEndBidi(str) { + testCM("move_end_bidi_" + str, function(cm) { + cm.getScrollerElement().style.fontFamily = "monospace"; + makeItWrapAfter(cm, Pos(0, 5)); + + cm.execCommand("goLineStart"); + var pos = cm.doc.getCursor(); + cm.execCommand("goCharLeft"); + eqCursorPos(pos, cm.doc.getCursor()); + + cm.execCommand("goLineEnd"); + pos = cm.doc.getCursor(); + cm.execCommand("goColumnRight"); + eqCursorPos(pos, cm.doc.getCursor()); + }, {value: str, lineWrapping: true}) +}; + +var bidiTests = []; + // We don't correctly implement L1 UBA // See https://bugzilla.mozilla.org/show_bug.cgi?id=1331501 // and https://bugs.chromium.org/p/chromium/issues/detail?id=673405 /* -testMoveBidi("Say ا ب جabj\nS"); -testMoveBidi("Sayyy ا ا ب ج"); +bidiTests.push("Say ا ب جabj\nS"); +bidiTests.push("Sayyy ا ا ب ج"); */ if (!phantom) { - testMoveBidi("ÎŒÈÇڪȉۥ״ۺ׆ɀҩÛ\nÒ³"); - testMoveBidi("ŌӰтقȤØƥ؅٣ĎȺ١\nÏš"); - testMoveBidi("ٻоҤѕѽΩ־؉ïίքdz\nÙµ"); - testMoveBidi("Ø…ØĆՕƿÉÇžÏ®Ø È©Ã³Ä‡\nÄ"); - testMoveBidi("RŨÄңŪzϢŎÆÔ–Ú‡Ú¦\nÓˆ"); - testMoveBidi("ό׊۷٢ԜһОצЉيÄÇŸ\nÑ©"); - testMoveBidi("ۑÚҳҕڬġڹհÑųKV\nr"); - testMoveBidi("źڻғúÛ4×1È c1a\nÔ"); - testMoveBidi("ҒȨҟփƞ٦ԓȦڰғâƥ\nÚ¤"); - testMoveBidi("ϖسՉÈŧΔԛdžĎӟیڡ\nÎ"); - testMoveBidi("۹ؼL۵ĺȧКԙػ×7×´\nÙ…"); + bidiTests.push("ÎŒÈÇڪȉۥ״ۺ׆ɀҩÛ\nÒ³"); + bidiTests.push("ŌӰтقȤØƥ؅٣ĎȺ١\nÏš"); + bidiTests.push("ٻоҤѕѽΩ־؉ïίքdz\nÙµ"); + bidiTests.push("Ø…ØĆՕƿÉÇžÏ®Ø È©Ã³Ä‡\nÄ"); + bidiTests.push("RŨÄңŪzϢŎÆÔ–Ú‡Ú¦\nÓˆ"); + bidiTests.push("ό׊۷٢ԜһОצЉيÄÇŸ\nÑ©"); + bidiTests.push("ۑÚҳҕڬġڹհÑųKV\nr"); + bidiTests.push("źڻғúÛ4×1È c1a\nÔ"); + bidiTests.push("ҒȨҟփƞ٦ԓȦڰғâƥ\nÚ¤"); + bidiTests.push("ϖسՉÈŧΔԛdžĎӟیڡ\nÎ"); + bidiTests.push("۹ؼL۵ĺȧКԙػ×7×´\nÙ…"); } -testMoveBidi("քմѧǮßپüŢÒҞўڳ\nÓ§"); -testMoveBidi("Ù† (ÙŠ)\u2009أقواس"); // thin space to throw off Firefox 51's broken white-space compressing behavior +bidiTests.push("քմѧǮßپüŢÒҞўڳ\nÓ§"); +bidiTests.push("Ù† (ÙŠ)\u2009أقواس"); // thin space to throw off Firefox 51's broken white-space compressing behavior -//testMoveBidi("Count Ù¡ Ù¢ Ù£ Ù¤"); -//testMoveBidi("Ó£×Ʀϰ؊ȓÛÛوը٬ز\nϪ"); -//testMoveBidi("ҾճٳџIÕ–Ó»Ù¥×ÖØœÚ\nÛŽ"); -//testMoveBidi("ҬÓФ؜ڂį٦ϿɓÚͳٵ\nÕˆ"); -//testMoveBidi("aÑ´NijȻهˇ҃ڱӧǻֵ\na"); -//testMoveBidi(" a٧ا٢ ب جa\nS"); +//bidiTests.push("Count Ù¡ Ù¢ Ù£ Ù¤"); +//bidiTests.push("Ó£×Ʀϰ؊ȓÛÛوը٬ز\nϪ"); +//bidiTests.push("ҾճٳџIÕ–Ó»Ù¥×ÖØœÚ\nÛŽ"); +//bidiTests.push("ҬÓФ؜ڂį٦ϿɓÚͳٵ\nÕˆ"); +//bidiTests.push("aÑ´NijȻهˇ҃ڱӧǻֵ\na"); +//bidiTests.push(" a٧ا٢ ب جa\nS"); + +for (var i = 0; i < bidiTests.length; ++i) { + testMoveBidi(bidiTests[i]); + testMoveEndBidi(bidiTests[i]); +} /* for (var i = 0; i < 5; ++i) { -- GitLab