Skip to content

Commit

Permalink
Functional test demonstrating Firefox startOffset overflow bug at 409…
Browse files Browse the repository at this point in the history
…6 characters.
  • Loading branch information
Alexander Ljungberg committed Dec 10, 2009
1 parent 87482de commit b3160af
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions test/functional/range.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>WysiHat functional test file</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<script src="../unit/tmp/lib_assets/prototype.js" type="text/javascript" charset="utf-8"></script>
<script src="../unit/tmp/lib_assets/unittest.js" type="text/javascript" charset="utf-8"></script>
<script src="../unit/tmp/assets/wysihat.js" type="text/javascript" charset="utf-8"></script>

<style type="text/css" media="screen">
/* <![CDATA[ */
body { margin:1em 2em; padding:0; font-size:0.8em }
hr { width:31.2em; margin:1em 0; text-align:left }
p { width:30em; margin:0.5em 0; padding:0.3em 0.6em; color:#222; background:#eee; border:1px solid silver; }
.subtest { margin-top:-0.5em }
.passed { color:green; border-color:olive }
.failed { color:firebrick; border-color:firebrick }
.button { padding:0.2em 0.4em; background:#ccc; border:1px solid #aaa }
#log { position:absolute; left:35em; top:5em; width:20em; font-size:13px !important }
h2 { font:normal 1.1em Verdana,Arial,sans-serif; font-style:italic; color:gray; margin-top:-1.2em }
h2 *, h2 a:visited { color:#444 }
h2 a:hover { color:blue }
a:visited { color:blue }
a:hover { color:red }
/* ]]> */
</style>

<script type="text/javascript">
Element.addMethods({
passed: function(el, message) {
el = $(el);
el.className = 'passed';
(el.down('span') || el).update(message || 'Test passed!');
},

failed: function(el, message) {
el = $(el);
el.className = 'failed';
(el.down('span') || el).update(message || 'Test failed');
}
});

function log(obj) {
var line, all = [];
for (prop in obj) {
if (typeof obj[prop] == 'function' || /^[A-Z]|[XY]$/.test(prop)) continue;
line = prop + ": " + Object.inspect(obj[prop]);
all.push(line.escapeHTML());
}
$('log').update(all.join('<br />'));
}

var editor;
Event.observe(window, 'load', function() {
editor = WysiHat.Editor.attach('content');
});
</script>
</head>
<body>
<h1>WysiHat functional tests for the Range class</h1>

<form action="#" method="post" style="width: 500px;">
<textarea id="content">0000 0005 0010 0015 0020 0025 0030 0035 0040 0045 0050 0055 0060 0065 0070 0075 0080 0085 0090 0095 0100 0105 0110 0115 0120 0125 0130 0135 0140 0145 0150 0155 0160 0165 0170 0175 0180 0185 0190 0195 0200 0205 0210 0215 0220 0225 0230 0235 0240 0245 0250 0255 0260 0265 0270 0275 0280 0285 0290 0295 0300 0305 0310 0315 0320 0325 0330 0335 0340 0345 0350 0355 0360 0365 0370 0375 0380 0385 0390 0395 0400 0405 0410 0415 0420 0425 0430 0435 0440 0445 0450 0455 0460 0465 0470 0475 0480 0485 0490 0495 0500 0505 0510 0515 0520 0525 0530 0535 0540 0545 0550 0555 0560 0565 0570 0575 0580 0585 0590 0595 0600 0605 0610 0615 0620 0625 0630 0635 0640 0645 0650 0655 0660 0665 0670 0675 0680 0685 0690 0695 0700 0705 0710 0715 0720 0725 0730 0735 0740 0745 0750 0755 0760 0765 0770 0775 0780 0785 0790 0795 0800 0805 0810 0815 0820 0825 0830 0835 0840 0845 0850 0855 0860 0865 0870 0875 0880 0885 0890 0895 0900 0905 0910 0915 0920 0925 0930 0935 0940 0945 0950 0955 0960 0965 0970 0975 0980 0985 0990 0995 1000 1005 1010 1015 1020 1025 1030 1035 1040 1045 1050 1055 1060 1065 1070 1075 1080 1085 1090 1095 1100 1105 1110 1115 1120 1125 1130 1135 1140 1145 1150 1155 1160 1165 1170 1175 1180 1185 1190 1195 1200 1205 1210 1215 1220 1225 1230 1235 1240 1245 1250 1255 1260 1265 1270 1275 1280 1285 1290 1295 1300 1305 1310 1315 1320 1325 1330 1335 1340 1345 1350 1355 1360 1365 1370 1375 1380 1385 1390 1395 1400 1405 1410 1415 1420 1425 1430 1435 1440 1445 1450 1455 1460 1465 1470 1475 1480 1485 1490 1495 1500 1505 1510 1515 1520 1525 1530 1535 1540 1545 1550 1555 1560 1565 1570 1575 1580 1585 1590 1595 1600 1605 1610 1615 1620 1625 1630 1635 1640 1645 1650 1655 1660 1665 1670 1675 1680 1685 1690 1695 1700 1705 1710 1715 1720 1725 1730 1735 1740 1745 1750 1755 1760 1765 1770 1775 1780 1785 1790 1795 1800 1805 1810 1815 1820 1825 1830 1835 1840 1845 1850 1855 1860 1865 1870 1875 1880 1885 1890 1895 1900 1905 1910 1915 1920 1925 1930 1935 1940 1945 1950 1955 1960 1965 1970 1975 1980 1985 1990 1995 2000 2005 2010 2015 2020 2025 2030 2035 2040 2045 2050 2055 2060 2065 2070 2075 2080 2085 2090 2095 2100 2105 2110 2115 2120 2125 2130 2135 2140 2145 2150 2155 2160 2165 2170 2175 2180 2185 2190 2195 2200 2205 2210 2215 2220 2225 2230 2235 2240 2245 2250 2255 2260 2265 2270 2275 2280 2285 2290 2295 2300 2305 2310 2315 2320 2325 2330 2335 2340 2345 2350 2355 2360 2365 2370 2375 2380 2385 2390 2395 2400 2405 2410 2415 2420 2425 2430 2435 2440 2445 2450 2455 2460 2465 2470 2475 2480 2485 2490 2495 2500 2505 2510 2515 2520 2525 2530 2535 2540 2545 2550 2555 2560 2565 2570 2575 2580 2585 2590 2595 2600 2605 2610 2615 2620 2625 2630 2635 2640 2645 2650 2655 2660 2665 2670 2675 2680 2685 2690 2695 2700 2705 2710 2715 2720 2725 2730 2735 2740 2745 2750 2755 2760 2765 2770 2775 2780 2785 2790 2795 2800 2805 2810 2815 2820 2825 2830 2835 2840 2845 2850 2855 2860 2865 2870 2875 2880 2885 2890 2895 2900 2905 2910 2915 2920 2925 2930 2935 2940 2945 2950 2955 2960 2965 2970 2975 2980 2985 2990 2995 3000 3005 3010 3015 3020 3025 3030 3035 3040 3045 3050 3055 3060 3065 3070 3075 3080 3085 3090 3095 3100 3105 3110 3115 3120 3125 3130 3135 3140 3145 3150 3155 3160 3165 3170 3175 3180 3185 3190 3195 3200 3205 3210 3215 3220 3225 3230 3235 3240 3245 3250 3255 3260 3265 3270 3275 3280 3285 3290 3295 3300 3305 3310 3315 3320 3325 3330 3335 3340 3345 3350 3355 3360 3365 3370 3375 3380 3385 3390 3395 3400 3405 3410 3415 3420 3425 3430 3435 3440 3445 3450 3455 3460 3465 3470 3475 3480 3485 3490 3495 3500 3505 3510 3515 3520 3525 3530 3535 3540 3545 3550 3555 3560 3565 3570 3575 3580 3585 3590 3595 3600 3605 3610 3615 3620 3625 3630 3635 3640 3645 3650 3655 3660 3665 3670 3675 3680 3685 3690 3695 3700 3705 3710 3715 3720 3725 3730 3735 3740 3745 3750 3755 3760 3765 3770 3775 3780 3785 3790 3795 3800 3805 3810 3815 3820 3825 3830 3835 3840 3845 3850 3855 3860 3865 3870 3875 3880 3885 3890 3895 3900 3905 3910 3915 3920 3925 3930 3935 3940 3945 3950 3955 3960 3965 3970 3975 3980 3985 3990 3995 4000 4005 4010 4015 4020 4025 4030 4035 4040 4045 4050 4055 4060 4065 4070 4075 4080 4085 4090 4095 4100 4105</textarea>
</form>

<div id="log">log empty</div>

<p id="testLongRange">testLongRange: place cursor at beginning of 4095, click here, select before 4100</p>
<script type="text/javascript">
testElem = $('testLongRange');
testElem.observe('click', function(e) {
if (!testElem.testRunning) {
testElem.testRunning = true;
startOffset = editor.selection.getRange().startOffset;
if (startOffset != 4095) {
testElem.testRunning = false;
testElem.failed('Wrong start offset: '+startOffset);
}
} else {
testElem.testRunning = false;
endOffset = editor.selection.getRange().endOffset;
if (endOffset == 4100) {
testElem.passed('Pass');
} else {
testElem.failed('Wrong end offset: '+endOffset);
}
}
});
</script>

</body>
</html>

0 comments on commit b3160af

Please sign in to comment.