How to use test_rect method in uiautomator

Best Python code snippet using uiautomator

pixel_test_pages.py

Source:pixel_test_pages.py Github

copy

Full Screen

1# Copyright 2016 The Chromium Authors. All rights reserved.2# Use of this source code is governed by a BSD-style license that can be3# found in the LICENSE file.4class PixelTestPage(object):5 """A wrapper class mimicking the functionality of the PixelTestsStorySet6 from the old-style GPU tests.7 """8 def __init__(self, url, name, test_rect, revision,9 tolerance=2, browser_args=None, expected_colors=None,10 gpu_process_disabled=False, optional_action=None):11 super(PixelTestPage, self).__init__()12 self.url = url13 self.name = name14 self.test_rect = test_rect15 self.revision = revision16 # The tolerance when comparing against the reference image.17 self.tolerance = tolerance18 self.browser_args = browser_args19 # The expected colors can be specified as a list of dictionaries,20 # in which case these specific pixels will be sampled instead of21 # comparing the entire image snapshot. The format is only defined22 # by contract with _CompareScreenshotSamples in23 # cloud_storage_integration_test_base.py.24 self.expected_colors = expected_colors25 # Only a couple of tests run with the GPU process completely26 # disabled. To prevent regressions, only allow the GPU information27 # to be incomplete in these cases.28 self.gpu_process_disabled = gpu_process_disabled29 # One of the tests (WebGLSadCanvas) requires custom actions to30 # be run. These are specified as a string which is the name of a31 # method to call in PixelIntegrationTest. For example if the32 # action here is "CrashGpuProcess" then it would be defined in a33 # "_CrashGpuProcess" method in PixelIntegrationTest.34 self.optional_action = optional_action35 def CopyWithNewBrowserArgsAndSuffix(self, browser_args, suffix):36 return PixelTestPage(37 self.url, self.name + suffix, self.test_rect, self.revision,38 self.tolerance, browser_args, self.expected_colors)39 def CopyWithNewBrowserArgsAndPrefix(self, browser_args, prefix):40 # Assuming the test name is 'Pixel'.41 split = self.name.split('_', 1)42 return PixelTestPage(43 self.url, split[0] + '_' + prefix + split[1], self.test_rect,44 self.revision, self.tolerance, browser_args, self.expected_colors)45def CopyPagesWithNewBrowserArgsAndSuffix(pages, browser_args, suffix):46 return [47 p.CopyWithNewBrowserArgsAndSuffix(browser_args, suffix) for p in pages]48def CopyPagesWithNewBrowserArgsAndPrefix(pages, browser_args, prefix):49 return [50 p.CopyWithNewBrowserArgsAndPrefix(browser_args, prefix) for p in pages]51# TODO(kbr): consider refactoring this into pixel_integration_test.py.52SCALE_FACTOR_OVERRIDES = {53 "comment": "scale factor overrides",54 "scale_factor_overrides": [55 {56 "device_type": "Nexus 5",57 "scale_factor": 1.10558 },59 {60 "device_type": "Nexus 5X",61 "scale_factor": 1.10562 },63 {64 "device_type": "Nexus 6",65 "scale_factor": 1.4743666 },67 {68 "device_type": "Nexus 6P",69 "scale_factor": 1.47270 },71 {72 "device_type": "Nexus 9",73 "scale_factor": 1.56674 },75 {76 "comment": "NVIDIA Shield",77 "device_type": "sb_na_wf",78 "scale_factor": 1.22679 }80 ]81}82def DefaultPages(base_name):83 sw_compositing_args = ['--disable-gpu-compositing']84 return [85 PixelTestPage(86 'pixel_background_image.html',87 base_name + '_BackgroundImage',88 test_rect=[20, 20, 370, 370],89 revision=2),90 PixelTestPage(91 'pixel_canvas2d.html',92 base_name + '_Canvas2DRedBox',93 test_rect=[0, 0, 300, 300],94 revision=11),95 PixelTestPage(96 'pixel_canvas2d_untagged.html',97 base_name + '_Canvas2DUntagged',98 test_rect=[0, 0, 257, 257],99 revision=0),100 PixelTestPage(101 'pixel_css3d.html',102 base_name + '_CSS3DBlueBox',103 test_rect=[0, 0, 300, 300],104 revision=24),105 PixelTestPage(106 'pixel_webgl_aa_alpha.html',107 base_name + '_WebGLGreenTriangle_AA_Alpha',108 test_rect=[0, 0, 300, 300],109 revision=8),110 PixelTestPage(111 'pixel_webgl_noaa_alpha.html',112 base_name + '_WebGLGreenTriangle_NoAA_Alpha',113 test_rect=[0, 0, 300, 300],114 revision=5),115 PixelTestPage(116 'pixel_webgl_aa_noalpha.html',117 base_name + '_WebGLGreenTriangle_AA_NoAlpha',118 test_rect=[0, 0, 300, 300],119 revision=9),120 PixelTestPage(121 'pixel_webgl_noaa_noalpha.html',122 base_name + '_WebGLGreenTriangle_NoAA_NoAlpha',123 test_rect=[0, 0, 300, 300],124 revision=5),125 PixelTestPage(126 'pixel_webgl_noalpha_implicit_clear.html',127 base_name + '_WebGLTransparentGreenTriangle_NoAlpha_ImplicitClear',128 test_rect=[0, 0, 300, 300],129 revision=5),130 PixelTestPage(131 'pixel_webgl_sad_canvas.html',132 base_name + '_WebGLSadCanvas',133 test_rect=[0, 0, 300, 300],134 revision=1,135 optional_action='CrashGpuProcess'),136 PixelTestPage(137 'pixel_scissor.html',138 base_name + '_ScissorTestWithPreserveDrawingBuffer',139 test_rect=[0, 0, 300, 300],140 revision=0, # This is not used.141 expected_colors=[142 {143 'comment': 'red top',144 'location': [1, 1],145 'size': [198, 188],146 'color': [255, 0, 0],147 'tolerance': 3148 },149 {150 'comment': 'green bottom left',151 'location': [1, 191],152 'size': [8, 8],153 'color': [0, 255, 0],154 'tolerance': 3155 },156 {157 'comment': 'red bottom right',158 'location': [11, 191],159 'size': [188, 8],160 'color': [255, 0, 0],161 'tolerance': 3162 }163 ]),164 PixelTestPage(165 'pixel_canvas2d_webgl.html',166 base_name + '_2DCanvasWebGL',167 test_rect=[0, 0, 300, 300],168 revision=11),169 PixelTestPage(170 'pixel_background.html',171 base_name + '_SolidColorBackground',172 test_rect=[500, 500, 100, 100],173 revision=1),174 PixelTestPage(175 'pixel_video_mp4.html',176 base_name + '_Video_MP4',177 test_rect=[0, 0, 300, 300],178 revision=10),179 PixelTestPage(180 'pixel_video_vp9.html',181 base_name + '_Video_VP9',182 test_rect=[0, 0, 300, 300],183 revision=10),184 PixelTestPage(185 'pixel_webgl_premultiplied_alpha_false.html',186 base_name + '_WebGL_PremultipliedAlpha_False',187 test_rect=[0, 0, 150, 150],188 revision=0, # This is not used.189 expected_colors=[190 SCALE_FACTOR_OVERRIDES,191 {192 'comment': 'brown',193 'location': [1, 1],194 'size': [148, 148],195 # This is the color on an NVIDIA based MacBook Pro if the196 # sRGB profile's applied correctly.197 'color': [102, 77, 0],198 # This is the color if it isn't.199 # 'color': [101, 76, 12],200 'tolerance': 3201 },202 ]),203 PixelTestPage(204 'pixel_webgl2_blitframebuffer_result_displayed.html',205 base_name + '_WebGL2_BlitFramebuffer_Result_Displayed',206 test_rect=[0, 0, 200, 200],207 revision=0, # This is not used.208 expected_colors=[209 SCALE_FACTOR_OVERRIDES,210 {211 'comment': 'green',212 'location': [1, 1],213 'size': [180, 180],214 'color': [0, 255, 0],215 'tolerance': 3216 },217 ]),218 PixelTestPage(219 'pixel_webgl2_clearbufferfv_result_displayed.html',220 base_name + '_WebGL2_ClearBufferfv_Result_Displayed',221 test_rect=[0, 0, 200, 200],222 revision=0, # This is not used.223 expected_colors=[224 SCALE_FACTOR_OVERRIDES,225 {226 'comment': 'green',227 'location': [1, 1],228 'size': [180, 180],229 'color': [0, 255, 0],230 'tolerance': 3231 },232 ]),233 PixelTestPage(234 'pixel_repeated_webgl_to_2d.html',235 base_name + '_RepeatedWebGLTo2D',236 test_rect=[0, 0, 256, 256],237 revision=0, # This is not used.238 expected_colors=[239 SCALE_FACTOR_OVERRIDES,240 {241 'comment': 'green',242 # 64x64 rectangle around the center at (128,128)243 'location': [96, 96],244 'size': [64, 64],245 'color': [0, 255, 0],246 'tolerance': 3,247 },248 ]),249 PixelTestPage(250 'pixel_repeated_webgl_to_2d.html',251 base_name + '_RepeatedWebGLTo2D_SoftwareCompositing',252 test_rect=[0, 0, 256, 256],253 revision=0, # This is not used.254 browser_args=sw_compositing_args,255 expected_colors=[256 SCALE_FACTOR_OVERRIDES,257 {258 'comment': 'green',259 # 64x64 rectangle around the center at (128,128)260 'location': [96, 96],261 'size': [64, 64],262 'color': [0, 255, 0],263 'tolerance': 3264 },265 ]),266 ]267# Pages that should be run with GPU rasterization enabled.268def GpuRasterizationPages(base_name):269 browser_args = ['--force-gpu-rasterization']270 return [271 PixelTestPage(272 'pixel_background.html',273 base_name + '_GpuRasterization_BlueBox',274 test_rect=[0, 0, 220, 220],275 revision=0, # This is not used.276 browser_args=browser_args,277 expected_colors=[278 {279 'comment': 'body-t',280 'location': [5, 5],281 'size': [1, 1],282 'color': [0, 128, 0],283 'tolerance': 0284 },285 {286 'comment': 'body-r',287 'location': [215, 5],288 'size': [1, 1],289 'color': [0, 128, 0],290 'tolerance': 0291 },292 {293 'comment': 'body-b',294 'location': [215, 215],295 'size': [1, 1],296 'color': [0, 128, 0],297 'tolerance': 0298 },299 {300 'comment': 'body-l',301 'location': [5, 215],302 'size': [1, 1],303 'color': [0, 128, 0],304 'tolerance': 0305 },306 {307 'comment': 'background-t',308 'location': [30, 30],309 'size': [1, 1],310 'color': [0, 0, 0],311 'tolerance': 0312 },313 {314 'comment': 'background-r',315 'location': [170, 30],316 'size': [1, 1],317 'color': [0, 0, 0],318 'tolerance': 0319 },320 {321 'comment': 'background-b',322 'location': [170, 170],323 'size': [1, 1],324 'color': [0, 0, 0],325 'tolerance': 0326 },327 {328 'comment': 'background-l',329 'location': [30, 170],330 'size': [1, 1],331 'color': [0, 0, 0],332 'tolerance': 0333 },334 {335 'comment': 'box-t',336 'location': [70, 70],337 'size': [1, 1],338 'color': [0, 0, 255],339 'tolerance': 0340 },341 {342 'comment': 'box-r',343 'location': [140, 70],344 'size': [1, 1],345 'color': [0, 0, 255],346 'tolerance': 0347 },348 {349 'comment': 'box-b',350 'location': [140, 140],351 'size': [1, 1],352 'color': [0, 0, 255],353 'tolerance': 0354 },355 {356 'comment': 'box-l',357 'location': [70, 140],358 'size': [1, 1],359 'color': [0, 0, 255],360 'tolerance': 0361 }362 ]),363 PixelTestPage(364 'concave_paths.html',365 base_name + '_GpuRasterization_ConcavePaths',366 test_rect=[0, 0, 100, 100],367 revision=0, # This is not used.368 browser_args=browser_args,369 expected_colors=[370 {371 'comment': 'outside',372 'location': [80, 60],373 'size': [1, 1],374 'color': [255, 255, 255],375 'tolerance': 0376 },377 {378 'comment': 'outside',379 'location': [28, 20],380 'size': [1, 1],381 'color': [255, 255, 255],382 'tolerance': 0383 },384 {385 'comment': 'inside',386 'location': [32, 25],387 'size': [1, 1],388 'color': [255, 215, 0],389 'tolerance': 0390 },391 {392 'comment': 'inside',393 'location': [80, 80],394 'size': [1, 1],395 'color': [255, 215, 0],396 'tolerance': 0397 }398 ])399 ]400# Pages that should be run with experimental canvas features.401def ExperimentalCanvasFeaturesPages(base_name):402 browser_args = [403 '--enable-experimental-web-platform-features'] # for lowLatency404 unaccelerated_args = [405 '--disable-accelerated-2d-canvas',406 '--disable-gpu-compositing']407 return [408 PixelTestPage(409 'pixel_offscreenCanvas_transfer_after_style_resize.html',410 base_name + '_OffscreenCanvasTransferAfterStyleResize',411 test_rect=[0, 0, 350, 350],412 revision=10,413 browser_args=browser_args),414 PixelTestPage(415 'pixel_offscreenCanvas_transfer_before_style_resize.html',416 base_name + '_OffscreenCanvasTransferBeforeStyleResize',417 test_rect=[0, 0, 350, 350],418 revision=10,419 browser_args=browser_args),420 PixelTestPage(421 'pixel_offscreenCanvas_webgl_paint_after_resize.html',422 base_name + '_OffscreenCanvasWebGLPaintAfterResize',423 test_rect=[0, 0, 200, 200],424 browser_args=browser_args,425 revision=0, # This is not used.426 expected_colors=[427 SCALE_FACTOR_OVERRIDES,428 {429 'comment': 'resized area',430 'location': [1, 1],431 'size': [48, 98],432 'color': [0, 255, 0],433 'tolerance': 0434 },435 {436 'comment': 'outside resized area',437 'location': [51, 1],438 'size': [48, 98],439 'color': [255, 255, 255],440 'tolerance': 0441 },442 ]),443 PixelTestPage(444 'pixel_offscreenCanvas_transferToImageBitmap_main.html',445 base_name + '_OffscreenCanvasTransferToImageBitmap',446 test_rect=[0, 0, 300, 300],447 revision=6,448 browser_args=browser_args),449 PixelTestPage(450 'pixel_offscreenCanvas_transferToImageBitmap_worker.html',451 base_name + '_OffscreenCanvasTransferToImageBitmapWorker',452 test_rect=[0, 0, 300, 300],453 revision=6,454 browser_args=browser_args),455 PixelTestPage(456 'pixel_offscreenCanvas_webgl_commit_main.html',457 base_name + '_OffscreenCanvasWebGLDefault',458 test_rect=[0, 0, 360, 200],459 revision=11,460 browser_args=browser_args),461 PixelTestPage(462 'pixel_offscreenCanvas_webgl_commit_worker.html',463 base_name + '_OffscreenCanvasWebGLDefaultWorker',464 test_rect=[0, 0, 360, 200],465 revision=11,466 browser_args=browser_args),467 PixelTestPage(468 'pixel_offscreenCanvas_webgl_commit_main.html',469 base_name + '_OffscreenCanvasWebGLSoftwareCompositing',470 test_rect=[0, 0, 360, 200],471 revision=7,472 browser_args=browser_args + ['--disable-gpu-compositing']),473 PixelTestPage(474 'pixel_offscreenCanvas_webgl_commit_worker.html',475 base_name + '_OffscreenCanvasWebGLSoftwareCompositingWorker',476 test_rect=[0, 0, 360, 200],477 revision=7,478 browser_args=browser_args + ['--disable-gpu-compositing']),479 PixelTestPage(480 'pixel_offscreenCanvas_2d_commit_main.html',481 base_name + '_OffscreenCanvasAccelerated2D',482 test_rect=[0, 0, 360, 200],483 revision=12,484 browser_args=browser_args),485 PixelTestPage(486 'pixel_offscreenCanvas_2d_commit_worker.html',487 base_name + '_OffscreenCanvasAccelerated2DWorker',488 test_rect=[0, 0, 360, 200],489 revision=12,490 browser_args=browser_args),491 PixelTestPage(492 'pixel_offscreenCanvas_2d_commit_main.html',493 base_name + '_OffscreenCanvasUnaccelerated2D',494 test_rect=[0, 0, 360, 200],495 revision=8,496 browser_args=browser_args + unaccelerated_args),497 PixelTestPage(498 'pixel_offscreenCanvas_2d_commit_worker.html',499 base_name + '_OffscreenCanvasUnaccelerated2DWorker',500 test_rect=[0, 0, 360, 200],501 revision=8,502 browser_args=browser_args + unaccelerated_args),503 PixelTestPage(504 'pixel_offscreenCanvas_2d_commit_main.html',505 base_name + '_OffscreenCanvasUnaccelerated2DGPUCompositing',506 test_rect=[0, 0, 360, 200],507 revision=13,508 browser_args=browser_args + ['--disable-accelerated-2d-canvas']),509 PixelTestPage(510 'pixel_offscreenCanvas_2d_commit_worker.html',511 base_name + '_OffscreenCanvasUnaccelerated2DGPUCompositingWorker',512 test_rect=[0, 0, 360, 200],513 revision=13,514 browser_args=browser_args + ['--disable-accelerated-2d-canvas']),515 PixelTestPage(516 'pixel_offscreenCanvas_2d_resize_on_worker.html',517 base_name + '_OffscreenCanvas2DResizeOnWorker',518 test_rect=[0, 0, 200, 200],519 revision=7,520 browser_args=browser_args),521 PixelTestPage(522 'pixel_offscreenCanvas_webgl_resize_on_worker.html',523 base_name + '_OffscreenCanvasWebglResizeOnWorker',524 test_rect=[0, 0, 200, 200],525 revision=9,526 browser_args=browser_args),527 PixelTestPage(528 'pixel_canvas_display_linear-rgb.html',529 base_name + '_CanvasDisplayLinearRGBAccelerated2D',530 test_rect=[0, 0, 140, 140],531 revision=6,532 browser_args=browser_args),533 PixelTestPage(534 'pixel_canvas_display_linear-rgb.html',535 base_name + '_CanvasDisplayLinearRGBUnaccelerated2D',536 test_rect=[0, 0, 140, 140],537 revision=1,538 browser_args=browser_args + unaccelerated_args),539 PixelTestPage(540 'pixel_canvas_display_linear-rgb.html',541 base_name + '_CanvasDisplayLinearRGBUnaccelerated2DGPUCompositing',542 test_rect=[0, 0, 140, 140],543 revision=6,544 browser_args=browser_args + ['--disable-accelerated-2d-canvas']),545 PixelTestPage(546 'pixel_canvas_low_latency_2d.html',547 base_name + '_CanvasLowLatency2D',548 test_rect=[0, 0, 100, 100],549 revision=3,550 browser_args=browser_args),551 PixelTestPage(552 'pixel_canvas_low_latency_2d.html',553 base_name + '_CanvasUnacceleratedLowLatency2D',554 test_rect=[0, 0, 100, 100],555 revision=2,556 browser_args=browser_args + unaccelerated_args),557 PixelTestPage(558 'pixel_canvas_low_latency_webgl.html',559 base_name + '_CanvasLowLatencyWebGL',560 test_rect=[0, 0, 200, 200],561 revision=0, # not used562 browser_args=browser_args,563 expected_colors=[564 SCALE_FACTOR_OVERRIDES,565 {566 'comment': 'green',567 'location': [1, 1],568 'size': [98, 98],569 'color': [0, 255, 0],570 'tolerance': 0571 },572 ]),573 ]574# Only add these tests on platforms where SwiftShader is enabled.575# Currently this is Windows and Linux.576def SwiftShaderPages(base_name):577 browser_args = ['--disable-gpu']578 suffix = "_SwiftShader"579 return [580 PixelTestPage(581 'pixel_canvas2d.html',582 base_name + '_Canvas2DRedBox' + suffix,583 test_rect=[0, 0, 300, 300],584 revision=1,585 browser_args=browser_args),586 PixelTestPage(587 'pixel_css3d.html',588 base_name + '_CSS3DBlueBox' + suffix,589 test_rect=[0, 0, 300, 300],590 revision=1,591 browser_args=browser_args),592 PixelTestPage(593 'pixel_webgl_aa_alpha.html',594 base_name + '_WebGLGreenTriangle_AA_Alpha' + suffix,595 test_rect=[0, 0, 300, 300],596 revision=2,597 browser_args=browser_args),598 PixelTestPage(599 'pixel_repeated_webgl_to_2d.html',600 base_name + '_RepeatedWebGLTo2D' + suffix,601 test_rect=[0, 0, 256, 256],602 revision=0, # This is not used.603 browser_args=browser_args,604 expected_colors=[605 SCALE_FACTOR_OVERRIDES,606 {607 'comment': 'green',608 # 64x64 rectangle around the center at (128,128)609 'location': [96, 96],610 'size': [64, 64],611 'color': [0, 255, 0],612 'tolerance': 3613 },614 ]),615 ]616# Test rendering where GPU process is blocked.617def NoGpuProcessPages(base_name):618 browser_args = ['--disable-gpu', '--disable-software-rasterizer']619 suffix = "_NoGpuProcess"620 return [621 PixelTestPage(622 'pixel_canvas2d.html',623 base_name + '_Canvas2DRedBox' + suffix,624 test_rect=[0, 0, 300, 300],625 revision=2,626 browser_args=browser_args,627 gpu_process_disabled=True),628 PixelTestPage(629 'pixel_css3d.html',630 base_name + '_CSS3DBlueBox' + suffix,631 test_rect=[0, 0, 300, 300],632 revision=2,633 browser_args=browser_args,634 gpu_process_disabled=True),635 ]636# Pages that should be run with various macOS specific command line637# arguments.638def MacSpecificPages(base_name):639 iosurface_2d_canvas_args = [640 '--enable-accelerated-2d-canvas']641 non_chromium_image_args = ['--disable-webgl-image-chromium']642 # This disables the Core Animation compositor, falling back to the643 # old GLRenderer path, but continuing to allocate IOSurfaces for644 # WebGL's back buffer.645 no_overlays_args = ['--disable-mac-overlays']646 return [647 # On macOS, test the IOSurface 2D Canvas compositing path.648 PixelTestPage(649 'pixel_canvas2d_accelerated.html',650 base_name + '_IOSurface2DCanvas',651 test_rect=[0, 0, 400, 400],652 revision=1,653 browser_args=iosurface_2d_canvas_args),654 PixelTestPage(655 'pixel_canvas2d_webgl.html',656 base_name + '_IOSurface2DCanvasWebGL',657 test_rect=[0, 0, 300, 300],658 revision=4,659 browser_args=iosurface_2d_canvas_args),660 # On macOS, test WebGL non-Chromium Image compositing path.661 PixelTestPage(662 'pixel_webgl_aa_alpha.html',663 base_name + '_WebGLGreenTriangle_NonChromiumImage_AA_Alpha',664 test_rect=[0, 0, 300, 300],665 revision=3,666 browser_args=non_chromium_image_args),667 PixelTestPage(668 'pixel_webgl_noaa_alpha.html',669 base_name + '_WebGLGreenTriangle_NonChromiumImage_NoAA_Alpha',670 test_rect=[0, 0, 300, 300],671 revision=1,672 browser_args=non_chromium_image_args),673 PixelTestPage(674 'pixel_webgl_aa_noalpha.html',675 base_name + '_WebGLGreenTriangle_NonChromiumImage_AA_NoAlpha',676 test_rect=[0, 0, 300, 300],677 revision=3,678 browser_args=non_chromium_image_args),679 PixelTestPage(680 'pixel_webgl_noaa_noalpha.html',681 base_name + '_WebGLGreenTriangle_NonChromiumImage_NoAA_NoAlpha',682 test_rect=[0, 0, 300, 300],683 revision=1,684 browser_args=non_chromium_image_args),685 # On macOS, test CSS filter effects with and without the CA compositor.686 PixelTestPage(687 'filter_effects.html',688 base_name + '_CSSFilterEffects',689 test_rect=[0, 0, 300, 300],690 revision=8),691 PixelTestPage(692 'filter_effects.html',693 base_name + '_CSSFilterEffects_NoOverlays',694 test_rect=[0, 0, 300, 300],695 revision=9,696 tolerance=10,697 browser_args=no_overlays_args),698 # Test WebGL's premultipliedAlpha:false without the CA compositor.699 PixelTestPage(700 'pixel_webgl_premultiplied_alpha_false.html',701 base_name + '_WebGL_PremultipliedAlpha_False_NoOverlays',702 test_rect=[0, 0, 150, 150],703 revision=0, # This is not used.704 browser_args=no_overlays_args,705 expected_colors=[706 SCALE_FACTOR_OVERRIDES,707 {708 'comment': 'brown',709 'location': [1, 1],710 'size': [148, 148],711 # This is the color on an NVIDIA based MacBook Pro if the712 # sRGB profile's applied correctly.713 'color': [102, 77, 0],714 # This is the color if it isn't.715 # 'color': [101, 76, 12],716 'tolerance': 3717 },718 ]),719 ]720def DirectCompositionPages(base_name):721 browser_args = ['--enable-direct-composition-layers']722 browser_args_Underlay = browser_args + [723 '--enable-features=DirectCompositionUnderlays']724 browser_args_Nonroot = browser_args +[725 '--enable-features=DirectCompositionNonrootOverlays,' +726 'DirectCompositionUnderlays']727 browser_args_Complex = browser_args + [728 '--enable-features=DirectCompositionComplexOverlays,' +729 'DirectCompositionNonrootOverlays,' +730 'DirectCompositionUnderlays']731 return [732 PixelTestPage(733 'pixel_video_mp4.html',734 base_name + '_DirectComposition_Video_MP4',735 test_rect=[0, 0, 300, 300],736 revision=8,737 browser_args=browser_args),738 PixelTestPage(739 'pixel_video_vp9.html',740 base_name + '_DirectComposition_Video_VP9',741 test_rect=[0, 0, 300, 300],742 revision=10,743 browser_args=browser_args),744 PixelTestPage(745 'pixel_video_underlay.html',746 base_name + '_DirectComposition_Underlay',747 test_rect=[0, 0, 240, 136],748 revision=0, # Golden image revision is not used749 browser_args=browser_args_Underlay,750 expected_colors=[751 {752 'comment': 'black top left',753 'location': [4, 4],754 'size': [20, 20],755 'color': [0, 0, 0],756 'tolerance': 3757 },758 {759 'comment': 'yellow top left quadrant',760 'location': [4, 34],761 'size': [110, 30],762 'color': [255, 255, 15],763 'tolerance': 3764 },765 {766 'comment': 'red top right quadrant',767 'location': [124, 4],768 'size': [110, 60],769 'color': [255, 17, 24],770 'tolerance': 3771 },772 {773 'comment': 'blue bottom left quadrant',774 'location': [4, 72],775 'size': [110, 60],776 'color': [12, 12, 255],777 'tolerance': 3778 },779 {780 'comment': 'green bottom right quadrant',781 'location': [124, 72],782 'size': [110, 60],783 'color': [44, 255, 16],784 'tolerance': 3785 }786 ]),787 PixelTestPage(788 'pixel_video_nonroot.html',789 base_name + '_DirectComposition_Nonroot',790 test_rect=[0, 0, 240, 136],791 revision=0, # Golden image revision is not used792 browser_args=browser_args_Nonroot,793 expected_colors=[794 {795 'comment': 'black top left',796 'location': [4, 4],797 'size': [20, 20],798 'color': [0, 0, 0],799 'tolerance': 3800 },801 {802 'comment': 'yellow top left quadrant',803 'location': [4, 34],804 'size': [110, 30],805 'color': [255, 255, 15],806 'tolerance': 3807 },808 {809 'comment': 'red top right quadrant',810 'location': [124, 4],811 'size': [50, 60],812 'color': [255, 17, 24],813 'tolerance': 3814 },815 {816 'comment': 'blue bottom left quadrant',817 'location': [4, 72],818 'size': [110, 60],819 'color': [12, 12, 255],820 'tolerance': 3821 },822 {823 'comment': 'green bottom right quadrant',824 'location': [124, 72],825 'size': [50, 60],826 'color': [44, 255, 16],827 'tolerance': 3828 }829 ]),830 PixelTestPage(831 'pixel_video_complex_overlays.html',832 base_name + '_DirectComposition_ComplexOverlays',833 test_rect=[0, 0, 240, 136],834 revision=0, # Golden image revision is not used835 browser_args=browser_args_Complex,836 expected_colors=[837 {838 'comment': 'black top left',839 'location': [4, 4],840 'size': [20, 20],841 'color': [0, 0, 0],842 'tolerance': 3843 },844 {845 'comment': 'yellow top left quadrant',846 'location': [60, 10],847 'size': [65, 30],848 'color': [255, 255, 15],849 'tolerance': 3850 },851 {852 'comment': 'red top right quadrant',853 'location': [150, 45],854 'size': [65, 30],855 'color': [255, 17, 24],856 'tolerance': 3857 },858 {859 'comment': 'blue bottom left quadrant',860 'location': [30, 70],861 'size': [65, 30],862 'color': [12, 12, 255],863 'tolerance': 3864 },865 {866 'comment': 'green bottom right quadrant',867 'location': [130, 100],868 'size': [65, 30],869 'color': [44, 255, 16],870 'tolerance': 3871 }872 ]),...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run uiautomator automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful