| <!DOCTYPE html> |
| <body> |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| |
| <div style="width:800px; height:800px"> |
| <textarea id="textInputID"> |
| Some text |
| </textarea> |
| </div> |
| |
| <script> |
| function drag(startX, startY, destX, destY, callback) { |
| chrome.gpuBenchmarking.pointerActionSequence([{source: 'mouse', actions:[ |
| {name: 'pointerDown', x: startX, y: startY}, |
| {name: 'pointerMove', x: destX, y: destY}, |
| {name: 'pointerUp'}]}], |
| callback); |
| } |
| |
| function testDragAndMove(textArea, callback) { |
| var startX = textArea.offsetLeft + 400; |
| var startY = textArea.offsetTop + 400; |
| drag(startX, startY, startX - 350, startY - 350, callback); |
| } |
| |
| var t = async_test('Test for resizing the TEXTAREA below the minimum size set.'); |
| t.step(() => { |
| assert_own_property(window, 'chrome'); |
| assert_own_property(chrome, 'gpuBenchmarking'); |
| |
| var textArea = document.getElementById('textInputID'); |
| textArea.style.width = '400px'; |
| textArea.style.height = '400px'; |
| textArea.style.minWidth = '200px'; |
| textArea.style.minHeight = '200px'; |
| testDragAndMove(textArea, t.step_func(() => { |
| // The min-width/min-height includes padding and border and width/height |
| // does not include padding and border. |
| // So when we set say min-width = 200px it means actual minimum width of box |
| // to be 194px (as 2px padding and 1px border on all side). |
| // Hence the condition check here for values which are lesser than original |
| // value by 6px. |
| assert_equals(textArea.style.width, '194px'); |
| assert_equals(textArea.style.height, '194px'); |
| |
| textArea.style.width = '400px'; |
| textArea.style.height = '400px'; |
| textArea.style.minWidth = '15vw'; |
| textArea.style.minHeight = '15vh'; |
| testDragAndMove(textArea, t.step_func(() => { |
| assert_equals(textArea.style.width, '114px'); |
| assert_equals(textArea.style.height, '84px'); |
| |
| textArea.style.width = '400px'; |
| textArea.style.height = '400px'; |
| textArea.style.minWidth = '10%'; |
| textArea.style.minHeight = '10%'; |
| testDragAndMove(textArea, t.step_func_done(() => { |
| assert_equals(textArea.style.width, '74px'); |
| assert_equals(textArea.style.height, '74px'); |
| })); |
| })); |
| })); |
| }); |
| </script> |
| </body> |