<?xml version="1.1" encoding="UTF-8"?>
<!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 3.0 Language//EN" "http://www.w3.org/2008/SMIL30/SMIL30Language.dtd">
<!--
Copyright: Copyright 1998-2008 W3C (MIT, ERCIM, Keio), All Rights Reserved.
See http://www.w3.org/Consortium/Legal/2008/04-testsuite-license.

Author: Daniel WECK (DAISY Consortium).

Version: January 08, 2008
Chapter: SMIL 3.0 Layout
Module: BasicLayout Module
Feature: backgroundOpacity
File Name: layout-background-opacity-region.smil

Additional Files: "ColorGrid.png"

Expected Behavior:

A 640px by 640px base canvas has a red background color (#FF0000).
The geometry of this canvas is divided into 16 non-overlapping squares of equal dimensions (160px by 160px). Each square area is occupied by a single region. Each of these regions test a different combination of background color and background opacity. There is however one exception: the last 2 regions overlap (bottom-right quarter), to test transparent regions overlapping each other.

After 5s, an image displays for 5s. The image should not be perceivable when executing this test, as this is an exact visual representation of the color pattern given by the empty 640px by 640px layout (apart from the small watermark text "Image" on the upper right corner). If any difference in color is perceived, then the test is failed. If no difference is visually perceived, the tester should make color measurements (e.g. color picker) after a full 10s to make sure that the color values conform to the expected values.
-->
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" baseProfile="Language">
  <head>
    <layout>
      <root-layout width="640" height="640" backgroundColor="red"/>

      <!-- Expected behaviour of the following region:
           blue fully opaque background, no red is visible (using percentage value).
      -->
      <region showBackground="always" xml:id="region_1" left="0" top="0" width="160" height="160" backgroundColor="blue" backgroundOpacity="100%"/>

      <!-- Expected behaviour of the following region:
           blue fully opaque background, no red is visible (using float value).
      -->
      <region showBackground="always" xml:id="region_2" left="160" top="0" width="160" height="160" backgroundColor="blue" backgroundOpacity="1.0"/>

      <!-- Expected behaviour of the following region:
           blue fully transparent background, therefore only red is visible (using percentage value).
      -->
      <region showBackground="always" xml:id="region_3" left="320" top="0" width="160" height="160" backgroundColor="blue" backgroundOpacity="0%"/>

      <!-- Expected behaviour of the following region:
           blue fully transparent background, therefore only red is visible (using float value).
      -->
      <region showBackground="always" xml:id="region_4" left="480" top="0" width="160" height="160" backgroundColor="blue" backgroundOpacity="0.0"/>


      <!-- Expected behaviour of the following region:
           blue half-transparent background, therefore the visible color is the combination of red and blue pigments: #7f0080 (using percentage value).
      -->
      <region showBackground="always" xml:id="region_5" left="0" top="160" width="160" height="160" backgroundColor="blue" backgroundOpacity="50%"/>

      <!-- Expected behaviour of the following region:
           blue half-transparent background, therefore the visible color is the combination of red and blue pigments: #7f0080 (using float value).
      -->
      <region showBackground="always" xml:id="region_6" left="160" top="160" width="160" height="160" backgroundColor="blue" backgroundOpacity="0.5"/>

      <!-- Expected behaviour of the following region:
           blue quarter-transparent background (3-quarters opaque), therefore the color shown is #4000bf (using percentage value).
      -->
      <region showBackground="always" xml:id="region_7" left="320" top="160" width="160" height="160" backgroundColor="blue" backgroundOpacity="75%"/>

      <!-- Expected behaviour of the following region:
           blue quarter-transparent background (3-quarters opaque), therefore the color shown is #4000bf (using float value).
      -->
      <region showBackground="always" xml:id="region_8" left="480" top="160" width="160" height="160" backgroundColor="blue" backgroundOpacity="0.75"/>


      <!-- Expected behaviour of the following region:
           blue 3-quarter-transparent background (quarter opaque), therefore the color shown is #bf0040 (using percentage value).
      -->
      <region showBackground="always" xml:id="region_9" left="0" top="320" width="160" height="160" backgroundColor="blue" backgroundOpacity="25%"/>

      <!-- Expected behaviour of the following region:
           blue 3-quarter-transparent background (quarter opaque), therefore the color shown is #bf0040 (using float value).
      -->
      <region showBackground="always" xml:id="region_10" left="160" top="320" width="160" height="160" backgroundColor="blue" backgroundOpacity="0.25"/>

      <!-- Expected behaviour of the following region:
           blue 10% transparent background (90% opaque), therefore the color shown is #1900e6 (using percentage value).
      -->
      <region showBackground="always" xml:id="region_11" left="320" top="320" width="160" height="160" backgroundColor="blue" backgroundOpacity="90%"/>


      <!-- Expected behaviour of the following region:
           blue 10% transparent background (90% opaque), therefore the color shown is #1900e6 (using float value).
      -->
      <region showBackground="always" xml:id="region_12" left="480" top="320" width="160" height="160" backgroundColor="blue" backgroundOpacity="0.9"/>


<!-- Expected behaviour of the following region:
     blue 90% transparent background (10% opaque), therefore the color shown is #e5001a (using percentage value).
-->
      <region showBackground="always" xml:id="region_13" left="0" top="480" width="160" height="160" backgroundColor="blue" backgroundOpacity="10%"/>

      <!-- Expected behaviour of the following region:
           blue 90% transparent background (10% opaque), therefore the color shown is #e5001a (using float value).
      -->
      <region showBackground="always" xml:id="region_14" left="160" top="480" width="160" height="160" backgroundColor="blue" backgroundOpacity="0.1"/>


      <!-- Expected behaviour of the following region:
           blue 60% transparent background (40% opaque). The region's x-coordinate is shifted +40px, which results in its peer region on the right hand-side overlapping it (the document order determines the z-index). Our 160x160 usual square is now showing the following strips, from left to right: 40px red, 80px #990066, 40px #6b0094.
      -->
      <region showBackground="always" xml:id="region_15" left="360" top="480" width="160" height="160" backgroundColor="blue" backgroundOpacity="40%"/>

      <!-- Expected behaviour of the following region:
           blue 70% transparent background (30% opaque). The region's x-coordinate is shifted -40px, which results in overlapping its peer region on the left hand-side (the document order determines the z-index, so this region is foremost). Our 160x160 usual square is now showing the following strips, from left to right: 40px #6b0094, 80px #b2004d, 40px red.
      -->
      <region showBackground="always" xml:id="region_16" left="440" top="480" width="160" height="160" backgroundColor="blue" backgroundOpacity="30%"/>


      <!-- Expected behaviour of the following region:
           fully transparent background, does not interfere with any of the other regions, despite overlapping them all (higher implicit z-index, by document order rules). This region is used after 5s to show an image that should display exactly the same color pattern as the empty test layout (this offers a visual match for when executing this test).
      -->
      <region showBackground="always" xml:id="region_full" left="0" top="0" width="100%" height="100%" backgroundColor="transparent"/>

    </layout>
  </head>
  <body dur="indefinite">
    <img begin="5s" dur="5s" src="ColorGrid.png" region="region_full"/>
  </body>
</smil>
