forked from mirrors/gecko-dev
		
	Bug 1704338. Include a couple more tests that I forgot to include in the refactor.
Differential Revision: https://phabricator.services.mozilla.com/D111789
This commit is contained in:
		
							parent
							
								
									605271bd29
								
							
						
					
					
						commit
						1311420452
					
				
					 2 changed files with 5 additions and 39 deletions
				
			
		|  | @ -9,33 +9,16 @@ | ||||||
|   <script src="/tests/SimpleTest/paint_listener.js"></script> |   <script src="/tests/SimpleTest/paint_listener.js"></script> | ||||||
|   <script type="application/javascript"> |   <script type="application/javascript"> | ||||||
| 
 | 
 | ||||||
| async function doubleTapOn(element, x, y) { | async function test() { | ||||||
|   let useTouchpad = (location.search == "?touchpad"); |   let useTouchpad = (location.search == "?touchpad"); | ||||||
| 
 | 
 | ||||||
|   let transformEndPromise = promiseTransformEnd(); |  | ||||||
| 
 |  | ||||||
|   if (useTouchpad) { |  | ||||||
|     synthesizeNativeTouchpadDoubleTap(element, x, y); |  | ||||||
|   } else { |  | ||||||
|     synthesizeNativeTap(element, x, y); |  | ||||||
|     synthesizeNativeTap(element, x, y); |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   // Wait for the APZ:TransformEnd to fire |  | ||||||
|   await transformEndPromise; |  | ||||||
| 
 |  | ||||||
|   // Flush state so we can query an accurate resolution |  | ||||||
|   await promiseApzFlushedRepaints(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| async function test() { |  | ||||||
|   var resolution = getResolution(); |   var resolution = getResolution(); | ||||||
|   var start_resolution = resolution; |   var start_resolution = resolution; | ||||||
|   ok(resolution > 0, |   ok(resolution > 0, | ||||||
|      "The initial_resolution is " + resolution + ", which is some sane value"); |      "The initial_resolution is " + resolution + ", which is some sane value"); | ||||||
| 
 | 
 | ||||||
|   // Check that double-tapping once zooms in |   // Check that double-tapping once zooms in | ||||||
|   await doubleTapOn(document.getElementById("target"), 10, 10); |   await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad); | ||||||
|   var prev_resolution = resolution; |   var prev_resolution = resolution; | ||||||
|   resolution = getResolution(); |   resolution = getResolution(); | ||||||
|   ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution); |   ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution); | ||||||
|  | @ -57,7 +40,7 @@ async function test() { | ||||||
| 
 | 
 | ||||||
|   // Check that double-tapping on the bottom scrollbar does not scroll us to the top |   // Check that double-tapping on the bottom scrollbar does not scroll us to the top | ||||||
|   // Need to divide by resolution because the coords are assumed to be inside the resolution |   // Need to divide by resolution because the coords are assumed to be inside the resolution | ||||||
|   await doubleTapOn(window, (window.innerWidth/2)/resolution, (window.innerHeight - 5)/resolution); |   await doubleTapOn(window, (window.innerWidth/2)/resolution, (window.innerHeight - 5)/resolution, useTouchpad); | ||||||
|   prev_resolution = resolution; |   prev_resolution = resolution; | ||||||
|   resolution = getResolution(); |   resolution = getResolution(); | ||||||
|   ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution); |   ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution); | ||||||
|  |  | ||||||
|  | @ -9,26 +9,9 @@ | ||||||
|   <script src="/tests/SimpleTest/paint_listener.js"></script> |   <script src="/tests/SimpleTest/paint_listener.js"></script> | ||||||
|   <script type="application/javascript"> |   <script type="application/javascript"> | ||||||
| 
 | 
 | ||||||
| async function doubleTapOn(element, x, y) { | async function test() { | ||||||
|   let useTouchpad = (location.search == "?touchpad"); |   let useTouchpad = (location.search == "?touchpad"); | ||||||
| 
 | 
 | ||||||
|   let transformEndPromise = promiseTransformEnd(); |  | ||||||
| 
 |  | ||||||
|   if (useTouchpad) { |  | ||||||
|     synthesizeNativeTouchpadDoubleTap(element, x, y); |  | ||||||
|   } else { |  | ||||||
|     synthesizeNativeTap(element, x, y); |  | ||||||
|     synthesizeNativeTap(element, x, y); |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   // Wait for the APZ:TransformEnd to fire |  | ||||||
|   await transformEndPromise; |  | ||||||
| 
 |  | ||||||
|   // Flush state so we can query an accurate resolution |  | ||||||
|   await promiseApzFlushedRepaints(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| async function test() { |  | ||||||
|   var resolution = getResolution(); |   var resolution = getResolution(); | ||||||
|   ok(resolution > 0, |   ok(resolution > 0, | ||||||
|      "The initial_resolution is " + resolution + ", which is some sane value"); |      "The initial_resolution is " + resolution + ", which is some sane value"); | ||||||
|  | @ -57,7 +40,7 @@ async function test() { | ||||||
|   let y = document.documentElement.scrollHeight - 60; |   let y = document.documentElement.scrollHeight - 60; | ||||||
| 
 | 
 | ||||||
|   // Check that double-tapping once zooms in |   // Check that double-tapping once zooms in | ||||||
|   await doubleTapOn(target, x, y); |   await doubleTapOn(target, x, y, useTouchpad); | ||||||
|   var prev_resolution = resolution; |   var prev_resolution = resolution; | ||||||
|   resolution = getResolution(); |   resolution = getResolution(); | ||||||
|   ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution); |   ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Timothy Nikkel
						Timothy Nikkel