<?xml version="1.0"?>
<!--
============================================================================
Name        : test_qt.ant.xml
Part of     : Helium

Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved.
This component and the accompanying materials are made available
under the terms of the License "Eclipse Public License v1.0"
which accompanies this distribution, and is available
at the URL "http://www.eclipse.org/legal/epl-v10.html".

Initial Contributors:
Nokia Corporation - initial contribution.

Contributors:

Description:

============================================================================
-->
<!--* @package compile -->
<project name="test-qt" xmlns:au="org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
    <description>
        Testing Qt targets.
    </description>
    <property environment="env"/>
    
    <property name="helium.dir" location="../../../.." />
    <import file="${helium.dir}/build.xml"/>
    <property name="qt.temp.dir" location="${helium.build.dir}/antunit/qt" />
    
    <target name="setUp">
        <mkdir dir="${qt.temp.dir}" />
        <!--delete dir="${qt.temp.dir}" />
        <mkdir dir="${qt.temp.dir}" /-->
    </target>

    <!--target name="tearDown">
        <delete dir="${qt.temp.dir}" />
    </target-->

    <target name="test-sysdef3-namespaced-qt-ant">
        <property name="sysdef.configuration" value="demo" />
        <fmpp sourceFile="${helium.dir}/tools/compile/qt/templates/run-qmake.ant.xml.ftl"
           outputFile="${qt.temp.dir}/run-qmake3.ant.xml">
            <data expandProperties="yes">
                data: xml(${helium.dir}/tests/data/test-qt-sysdef3.xml)
                ant: antProperties()
            </data>
        </fmpp>
        <au:assertFileExists file="${qt.temp.dir}/run-qmake3.ant.xml" />
        <loadfile property="run.qmake.out" srcfile="${qt.temp.dir}/run-qmake3.ant.xml" />
        <au:assertTrue message="The output file must contain the -nomoc argument.">
            <contains string="${run.qmake.out}" substring="-nomoc" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain helloworld.pro">
            <contains string="${run.qmake.out}" substring="helloworld.pro" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain helloworldapi.pro">
            <contains string="${run.qmake.out}" substring="helloworldapi.pro" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain sf/app/helloworldcons/group ${run.qmake.out}">
            <contains string="${run.qmake.out}" substring="sf/app/helloworldcons/group" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain sf/mw/helloworldapi/group">
            <contains string="${run.qmake.out}" substring="sf/mw/helloworldapi/group" />
        </au:assertTrue>
    </target>
    
    <target name="test-sysdef151-namespaced-qt-ant">
        <property name="sysdef.configuration" value="demo" />
        <var name="sysdef3.enabled" value="false" />
        <fmpp sourceFile="${helium.dir}/tools/compile/qt/templates/run-qmake.ant.xml.ftl"
           outputFile="${qt.temp.dir}/run-qmake151.ant.xml">
            <data expandProperties="yes">
                data: xml(${helium.dir}/tests/data/test-qt-sysdef151.xml)
                ant: antProperties()
            </data>
        </fmpp>
        <var name="sysdef3.enabled" value="true" />
        <au:assertFileExists file="${qt.temp.dir}/run-qmake151.ant.xml" />
        <loadfile property="run.qmake.out" srcfile="${qt.temp.dir}/run-qmake151.ant.xml" />
        <au:assertTrue message="The output file must contain the -nomoc argument.">
            <contains string="${run.qmake.out}" substring="-nomoc" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain helloworld.pro">
            <contains string="${run.qmake.out}" substring="helloworld.pro" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain helloworldapi.pro">
            <contains string="${run.qmake.out}" substring="helloworldapi.pro" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain $${build.drive}/sf/app/HelloWorldCons/group">
            <contains string="${run.qmake.out}" substring="$${build.drive}/sf/app/HelloWorldCons/group" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain $${build.drive}/sf/mw/HelloWorldAPI/group">
            <contains string="${run.qmake.out}" substring="$${build.drive}/sf/mw/HelloWorldAPI/group" />
        </au:assertTrue>
    </target>
    
    <target name="test-sysdef151-namespaced-qt-mk">
        <propertyregex property="build.drive.slash" input="${build.drive}" regexp="\\" replace="/" />
        <property name="build.drive.slash" value="${build.drive}" />
        <property name="sysdef.configuration" value="demo" />
        <var name="sysdef3.enabled" value="false" />
        <fmpp sourceFile="${helium.dir}/tools/compile/qt/templates/run-qmake.mk.ftl"
           outputFile="${qt.temp.dir}/run-qmake151.mk">
            <data expandProperties="yes">
                data: xml(${helium.dir}/tests/data/test-qt-sysdef151.xml)
                ant: antProperties()
            </data>
        </fmpp>
        <var name="sysdef3.enabled" value="true" />
        <au:assertFileExists file="${qt.temp.dir}/run-qmake151.mk" />
        <loadfile property="run.qmake.out" srcfile="${qt.temp.dir}/run-qmake151.mk" />
        <au:assertTrue message="The output file must contain the -nomoc argument.">
            <contains string="${run.qmake.out}" substring="-nomoc" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain helloworld.pro">
            <contains string="${run.qmake.out}" substring="helloworld.pro" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain helloworldapi.pro">
            <contains string="${run.qmake.out}" substring="helloworldapi.pro" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain -@cd ${build.drive.slash}/sf/mw/HelloWorldAPI/group &amp;&amp; ${build.drive}/epoc32/tools/qmake -listgen -nomoc helloworldapi.pro, ${run.qmake.out}">
            <contains string="${run.qmake.out}" substring="-@cd ${build.drive.slash}/sf/mw/HelloWorldAPI/group &amp;&amp; ${build.drive}/epoc32/tools/qmake -listgen -nomoc helloworldapi.pro" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain -@cd ${build.drive.slash}/sf/app/HelloWorldCons/group &amp;&amp; ${build.drive}/epoc32/tools/qmake -listgen -r helloworld.pro">
            <contains string="${run.qmake.out}" substring="-@cd ${build.drive.slash}/sf/app/HelloWorldCons/group &amp;&amp; ${build.drive}/epoc32/tools/qmake -listgen -r helloworld.pro" />
        </au:assertTrue>
    </target>

    <target name="test-sysdef3-namespaced-qt-mk">
        <propertyregex property="build.drive.slash" input="${build.drive}" regexp="\\" replace="/" global="true" />
        <property name="build.drive.slash" value="${build.drive}" />
        <property name="sysdef.configuration" value="demo" />
        <fmpp sourceFile="${helium.dir}/tools/compile/qt/templates/run-qmake.mk.ftl"
           outputFile="${qt.temp.dir}/run-qmake3.mk">
            <data expandProperties="yes">
                data: xml(${helium.dir}/tests/data/test-qt-sysdef3.xml)
                ant: antProperties()
            </data>
        </fmpp>
        <au:assertFileExists file="${qt.temp.dir}/run-qmake3.mk" />
        <loadfile property="run.qmake.out" srcfile="${qt.temp.dir}/run-qmake3.mk" />
        <au:assertTrue message="The output file must contain the -nomoc argument.">
            <contains string="${run.qmake.out}" substring="-nomoc" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain helloworld.pro">
            <contains string="${run.qmake.out}" substring="helloworld.pro" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain helloworldapi.pro">
            <contains string="${run.qmake.out}" substring="helloworldapi.pro" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain sf/mw/helloworldapi/group &amp;&amp; ${build.drive}/epoc32/tools/qmake -listgen -nomoc helloworldapi.pro, ${run.qmake.out}">
            <contains string="${run.qmake.out}" substring="sf/mw/helloworldapi/group &amp;&amp; ${build.drive}/epoc32/tools/qmake -listgen -nomoc helloworldapi.pro" />
        </au:assertTrue>
        <au:assertTrue message="The output file must contain sf/app/helloworldcons/group &amp;&amp; ${build.drive}/epoc32/tools/qmake -listgen -r helloworld.pro">
            <contains string="${run.qmake.out}" substring="sf/app/helloworldcons/group &amp;&amp; ${build.drive}/epoc32/tools/qmake -listgen -r helloworld.pro" />
        </au:assertTrue>
    </target>
</project>