----------------------------------------------
License
----------------------------------------------
Copyright (c) 2012 Intel Corporation.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of works must retain the original copyright notice, this list
  of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the original copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
  may be used to endorse or promote products derived from this work without
  specific prior written permission.

THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Authors:
        Lin, Wanming <wanmingx.lin@intel.com>



----------------------------------------------
Introduction
----------------------------------------------
This test suite is for testing HTML5 2D Canvas specification:
http://www.w3.org/TR/2012/WD-2dcontext-20120329/


----------------------------------------------
Test Environment
----------------------------------------------
1. Pre-install Testkit-Lite package.
2. Run these cases as "normal" user.


----------------------------------------------
Pre-conditions
----------------------------------------------
For Test Cases:
            security.drawImage.canvas.html
            security.drawImage.image.html
            security.pattern.canvas.fillStyle.html
            security.pattern.canvas.strokeStyle.html
            security.pattern.cross.html
            security.pattern.image.fillStyle.html
            security.pattern.image.strokeStyle.html
            security.reset.html
Steps:
1. Install Apache server:
   open terminal and type in this command: sudo apt-get install apache2
   (Note: If you have installed Apache2 and configured the virtual host, you can skip to step 3.)
2. Configure virtual host, do the following steps:
     (1).Create /etc/apache2/sites-available/webtestingservice:
          NameVirtualHost *:8081
          Listen 8081

          <VirtualHost *:8081>
              ServerAdmin your-mail-address
          </VirtualHost>

          Alias /opt "/var/www/opt/"
          <Directory "/var/www/opt/">
              Options Indexes FollowSymLinks MultiViews
              AllowOverride None
              Order deny,allow
              Allow from all
          </Directory>
     (2).Enable the /etc/apache2/sites-enable/webtestingservice in Apache2:
         $cd /etc/apache2/sites-enabled/
         $sudo ln -s /etc/apache2/sites-available/webtestingservice 001-webtestingservice

3. Create the web project directory:
   open terminal and type in this command: mkdir -p /var/www/opt/tct-canvas-html5-tests;
4. Properly organize the web resources:
   opt/tct-canvas-html5-tests/resources  -->  /var/www/opt/tct-canvas-html5-tests
   opt/tct-canvas-html5-tests/canvas  -->  /var/www/opt/tct-canvas-html5-tests
5. Modify tct-canvas-html5-tests/tests.xml to change the est_script_entry node from 'http://127.0.0.1:8080' to 'http://192.168.13.28:8080'(If your IP address is 192.168.13.28);
6. Modify following TCs in /var/www/opt/tct-canvas-html5-tests/canvas/w3c/
        security.drawImage.canvas.html
        security.drawImage.image.html
        security.pattern.canvas.fillStyle.html
        security.pattern.canvas.strokeStyle.html
        security.reset.html
   change:
   'http://127.0.0.1:8081'
   to:
   http://192.168.13.28:8081'(If your IP address is 192.168.13.28);
7. Restart Apache server:
   open terminal and type in this command: sudo /etc/init.d/apache2 restart


----------------------------------------------
Build and Run
----------------------------------------------
(Suppose you only get the source code and Testkit-Lite has been set up on your test machine.
 If you have obtained tct-canvas-html5-tests ZIP packages, you can directly go to step 3 on the test machine;
 if you have not installed Testkit-Lite, you need to install the latest version.)

Steps:
1. Prepare for building by running the following command:
   cd tct-canvas-html5-tests

2. Build ZIP package by running the following command:
   ./pack.sh

3. Unzip the package on the test machine by running the following command:
   unzip -o tct-canvas-html5-tests-<version>.zip -d /opt/usr/media/tct

4. Install the package on the test machine by running the following command:
   /opt/usr/media/tct/opt/tct-canvas-html5-tests/inst.sh

5. Run test cases by running the following command on host:
   testkit-lite -f device:/opt/usr/media/tct/opt/tct-canvas-html5-tests/tests.xml -e "WRTLauncher" -o tct-canvas-html5-tests.results.xml
