--- a/common/tools/ats/smoketest/Group/bld.inf Tue Dec 15 14:31:00 2009 +0000
+++ b/common/tools/ats/smoketest/Group/bld.inf Fri Dec 18 14:46:04 2009 +0000
@@ -32,3 +32,4 @@
#include "../IM/group/bld.inf"
#include "../localisation/uiftestfw/group/BLD.INF"
#include "../localisation/apparchitecture/group/BLD.INF"
+#include "../graphics/wserv/group/bld.inf"
--- a/common/tools/ats/smoketest/Group/smoketest.pl Tue Dec 15 14:31:00 2009 +0000
+++ b/common/tools/ats/smoketest/Group/smoketest.pl Fri Dec 18 14:46:04 2009 +0000
@@ -16,6 +16,7 @@
mkpath "temp/smoketest/10003a3f/general";
mkpath "temp/smoketest/resource/general";
mkpath "temp/smoketest/localisation/general";
+mkpath "temp/smoketest/bitmap/general";
my $epoc=$ENV{'EPOCROOT'} . "epoc32/";
copy("smoketest.xml", "temp/test.xml");
@@ -38,6 +39,8 @@
copy($epoc . "data/z/smoketest/smoketest_lbs.ini", "temp/smoketest/general/smoketest_lbs.ini");
copy($epoc . "data/z/smoketest/smoketest_lbs.script", "temp/smoketest/general/smoketest_lbs.script");
copy($epoc . "data/z/smoketest/smoketest_language.script", "temp/smoketest/general/smoketest_language.script");
+copy($epoc . "data/z/smoketest/smoketest_bitmap.ini", "temp/smoketest/general/smoketest_bitmap.ini");
+copy($epoc . "data/z/smoketest/smoketest_bitmap.script", "temp/smoketest/general/smoketest_bitmap.script");
copy($epoc . "data/z/smoketest/sms/message1.txt", "temp/smoketest/sms/general/message1.txt");
copy($epoc . "data/z/smoketest/MachineName.txt", "temp/smoketest/general/MachineName.txt");
copy($epoc . "data/z/smoketest/emailmessage/20KBody.txt", "temp/smoketest/emailmessage/general/20KBody.txt");
@@ -81,6 +84,7 @@
copy($epoc . "data/z/private/10003a3f/import/apps/testuntrustedpriorityapp2_reg.rsc","temp/smoketest/localisation/general/testuntrustedpriorityapp2_reg.rsc");
copy($epoc . "data/z/private/10003a3f/import/apps/tstapp_reg.rsc", "temp/smoketest/localisation/general/tstapp_reg.rsc");
copy($epoc . "data/z/resource/plugins/tstapp_embedded.rsc", "temp/smoketest/localisation/general/tstapp_embedded.rsc");
+copy($epoc . "data/z/smoketest/bitmap/uibench_16bit.mbm", "temp/smoketest/bitmap/general/uibench_16bit.mbm");
copy($epoc . "release/winscw/udeb/SmokeTestSecureFSclient.dll", "temp/smoketest/winscw_udeb/SmokeTestSecureFSclient.dll");
copy($epoc . "release/winscw/udeb/SmokeTestSecureFSserver.exe", "temp/smoketest/winscw_udeb/SmokeTestSecureFSserver.exe");
copy($epoc . "release/winscw/udeb/Smoketest_Agenda_Server.exe", "temp/smoketest/winscw_udeb/Smoketest_Agenda_Server.exe");
@@ -105,6 +109,10 @@
copy($epoc . "release/winscw/udeb/TSTAPP_embedded.dll", "temp/smoketest/winscw_udeb/TSTAPP_embedded.dll");
copy($epoc . "release/winscw/udeb/apparctestserver.exe", "temp/smoketest/winscw_udeb/apparctestserver.exe");
copy($epoc . "release/winscw/udeb/tstapp.exe", "temp/smoketest/winscw_udeb/tstapp.exe");
+copy($epoc . "release/winscw/udeb/t_animplugin.dll", "temp/smoketest/winscw_udeb/t_animplugin.dll");
+copy($epoc . "release/winscw/udeb/t_graphicswservapi.exe", "temp/smoketest/winscw_udeb/t_graphicswservapi.exe");
+copy($epoc . "release/winscw/udeb/twsgraphicshare.exe", "temp/smoketest/winscw_udeb/twsgraphicshare.exe");
+copy($epoc . "release/winscw/udeb/twsgraphicunshare.exe", "temp/smoketest/winscw_udeb/twsgraphicunshare.exe");
copy($epoc . "release/winscw/udeb/ProfileSmokeTestModule.dll", "temp/smoketest/winscw_udeb/ProfileSmokeTestModule.dll");
copy($epoc . "winscw/c/smoketest/ProfileSmokeTestModule.cfg", "temp/smoketest/general/ProfileSmokeTestModule.cfg");
--- a/common/tools/ats/smoketest/Group/smoketest.xml Tue Dec 15 14:31:00 2009 +0000
+++ b/common/tools/ats/smoketest/Group/smoketest.xml Fri Dec 18 14:46:04 2009 +0000
@@ -415,16 +415,16 @@
<param dst="z:/resource/plugins/tstapp_embedded.rsc"/>
<param component-path="smoketest\localisation" />
</params>
- </step>
+ </step>
<step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
<command>install</command>
<params>
- <param type="binary"/>
- <param src="Smoketest_Agenda_Server.exe"/>
- <param dst="c:\sys\bin\Smoketest_Agenda_Server.exe"/>
- <param component-path="smoketest" />
+ <param type="data"/>
+ <param src="uibench_16bit.mbm"/>
+ <param dst="c:/smoketest/bitmap/uibench_16bit.mbm"/>
+ <param component-path="smoketest\bitmap" />
</params>
- </step>
+ </step>
<step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
<command>install</command>
<params>
@@ -640,6 +640,42 @@
<param dst="c:\sys\bin\tstapp.exe"/>
<param component-path="smoketest" />
</params>
+ </step>
+ <step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
+ <command>install</command>
+ <params>
+ <param type="binary"/>
+ <param src="t_animplugin.dll"/>
+ <param dst="c:\sys\bin\t_animplugin.dll"/>
+ <param component-path="smoketest" />
+ </params>
+ </step>
+ <step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
+ <command>install</command>
+ <params>
+ <param type="binary"/>
+ <param src="t_graphicswservapi.exe"/>
+ <param dst="c:\sys\bin\t_graphicswservapi.exe"/>
+ <param component-path="smoketest" />
+ </params>
+ </step>
+ <step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
+ <command>install</command>
+ <params>
+ <param type="binary"/>
+ <param src="twsgraphicshare.exe"/>
+ <param dst="c:\sys\bin\twsgraphicshare.exe"/>
+ <param component-path="smoketest" />
+ </params>
+ </step>
+ <step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
+ <command>install</command>
+ <params>
+ <param type="binary"/>
+ <param src="twsgraphicunshare.exe"/>
+ <param dst="c:\sys\bin\twsgraphicunshare.exe"/>
+ <param component-path="smoketest" />
+ </params>
</step>
<step id="" name="Test Step 2 (execute)" harness="GENERIC" enabled="true" passrate="100" significant="true">
<command>execute</command>
@@ -729,6 +765,23 @@
<param leave-old-result="true"/>
</params>
</step>
+ <step id="" name="Test Step 2 (execute)" harness="GENERIC" enabled="true" passrate="100" significant="true">
+ <command>execute</command>
+ <params>
+ <param file="testexecute.exe"/>
+ <param parameters="c:\smoketest\smoketest_bitmap.script"/>
+ <param result-file="c:\logs\testexecute\smoketest_bitmap.htm"/>
+ <param timeout="1200"/>
+ <param parser="TEFTestResultParser"/>
+ <param leave-old-result="true"/>
+ </params>
+ </step>
+ <step id="" name="Test Step 3 (fetch-log)" harness="GENERIC" enabled="true" passrate="100">
+ <command>fetch-log</command>
+ <params>
+ <param path="c:\logs\testexecute\screen.mbm" />
+ </params>
+ </step>
</case>
</set>
<set id="" name="ATSINTERFACE smoke tests" harness="ATSINTERFACE" enabled="true" passrate="100">
@@ -970,6 +1023,8 @@
<file>smoketest/general/smoketest_email.script</file>
<file>smoketest/general/smoketest_lbs.ini</file>
<file>smoketest/general/smoketest_lbs.script</file>
+ <file>smoketest/general/smoketest_bitmap.ini</file>
+ <file>smoketest/general/smoketest_bitmap.script</file>
<file>smoketest/general/smoketest_language.script</file>
<file>smoketest/sms/general/message1.txt</file>
<file>smoketest/general/MachineName.txt</file>
@@ -1014,6 +1069,7 @@
<file>smoketest/localisation/general/testuntrustedpriorityapp2_reg.rsc</file>
<file>smoketest/localisation/general/tstapp_reg.rsc</file>
<file>smoketest/localisation/general/tstapp_embedded.rsc</file>
+ <file>smoketest/bitmap/general/uibench_16bit.mbm</file>
<file>smoketest/winscw_udeb/SmokeTestSecureFSclient.dll</file>
<file>smoketest/winscw_udeb/SmokeTestSecureFSserver.exe</file>
<file>smoketest/winscw_udeb/Smoketest_Agenda_Server.exe</file>
@@ -1038,6 +1094,10 @@
<file>smoketest/winscw_udeb/TSTAPP_embedded.dll</file>
<file>smoketest/winscw_udeb/apparctestserver.exe</file>
<file>smoketest/winscw_udeb/tstapp.exe</file>
+ <file>smoketest/winscw_udeb/t_animplugin.dll</file>
+ <file>smoketest/winscw_udeb/t_graphicswservapi.exe</file>
+ <file>smoketest/winscw_udeb/twsgraphicshare.exe</file>
+ <file>smoketest/winscw_udeb/twsgraphicunshare.exe</file>
<file>smoketest/winscw_udeb/ProfileSmokeTestModule.dll</file>
<file>smoketest/general/ProfileSmokeTestModule.cfg</file>
<file>smoketest/winscw_udeb/TestNpdApi.dll</file>
--- a/common/tools/ats/smoketest/apploader/testdata/smoketest_apploader.ini Tue Dec 15 14:31:00 2009 +0000
+++ b/common/tools/ats/smoketest/apploader/testdata/smoketest_apploader.ini Fri Dec 18 14:46:04 2009 +0000
@@ -26,18 +26,14 @@
program =Contacts
[SMOKE_APP_KEYEVENTS_0008]
+delay1 =2000
key1 =EKeyDevice0
-delay1 =5000
+delay2 =1000
key2 =EKeyDevice0
-delay2 =5000
+delay3 =1000
key3 =EKeyDevice0
-delay3 =5000
+delay4 =1000
key4 =EKeyDevice0
-delay4 =5000
-key5 =EKeyDevice1
-delay5 =5000
-key6 =EKeyDevice1
-delay6 =5000
[SMOKE_APP_LAUNCH_0009]
program =eshell.exe
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/inc/T_DataFbsBitGc.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,88 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#if (!defined __T_DATA_FBS_BIT_GC_H__)
+#define __T_DATA_FBS_BIT_GC_H__
+
+// User includes
+#include "T_DataBitmapContext.h"
+
+class CT_DataFbsBitGc : public CT_DataBitmapContext
+ {
+public:
+ static CT_DataFbsBitGc* NewL();
+
+ ~CT_DataFbsBitGc();
+
+ // CTPData implementation
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aObject);
+ virtual void DisownObjectL();
+ void DestroyData();
+
+ // CT_DataGraphicsContext implementation
+ virtual CGraphicsContext* GetGraphicsContext() const;
+
+ // CT_DataBitmapContext implementation
+ virtual CBitmapContext* GetBitmapContext() const;
+
+protected:
+ CT_DataFbsBitGc();
+ void ConstructL();
+
+private:
+ void DoCmdNewL();
+ void DoCmdDestructor();
+ void DoCmdActivateL(const TDesC& aSection);
+ void DoCmdActivateNoJustAutoUpdateL(const TDesC& aSection);
+ TBool DoCmdAlphaBlendBitmapsL(const TDesC& aSection);
+ void DoCmdDrawPolyLineNoEndPointL(const TDesC& aSection);
+
+ void DoCmdCancelClipping(const TDesC& aSection);
+ void DoCmdCopySettingsL(const TDesC& aSection);
+ TBool DoCmdBitBltL(const TDesC& aSection);
+
+ void DoCmdDrawTextL(const TDesC& aSection);
+ void DoCmdDrawTextVerticalL(const TDesC& aSection);
+ void DoCmdUpdateJustificationL(const TDesC& aSection);
+ void DoCmdUpdateJustificationVerticalL(const TDesC& aSection);
+
+ void DoCmdFadeArea(const TDesC& aSection);
+ void DoCmdIsBrushPatternUsed(const TDesC& aSection);
+ void DoCmdIsFontUsed(const TDesC& aSection);
+ void DoCmdOrientationsAvailable(const TDesC& aSection);
+ void DoCmdRectDrawnTo(const TDesC& aSection);
+ void DoCmdResized(const TDesC& aSection);
+ void DoCmdSetDitherOrigin(const TDesC& aSection);
+ void DoCmdSetFadeMode(const TDesC& aSection);
+ TBool DoCmdSetFadingParameters(const TDesC& aSection);
+ void DoCmdSetOrientation(const TDesC& aSection);
+ void DoCmdSetShadowMode(const TDesC& aSection);
+ void DoCmdSetUserDisplayMode(const TDesC& aSection);
+ void DoCmdShadowArea(const TDesC& aSection);
+ void DoCmdUseBrushPatternL(const TDesC& aSection);
+ void DoCmdUseFontL(const TDesC& aSection);
+ void DoCmdUseFontNoDuplicateL(const TDesC& aSection);
+ void DoCmdPromptMessageL(const TDesC& aSection);
+protected:
+ /** test step reference*/
+ CFbsBitGc* iFbsBitGc;
+
+ };
+
+#endif /* __T_DATA_FBS_BIT_GC_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/inc/T_DataFbsBitGcBitmap.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,53 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef T_DATAFBSBITGCBITMAP_H_
+#define T_DATAFBSBITGCBITMAP_H_
+
+#include "T_DataFbsBitmap.h"
+
+
+class CT_DataFbsBitGcBitmap : public CT_DataFbsBitmap
+ {
+public:
+ static CT_DataFbsBitGcBitmap* NewL();
+
+ ~CT_DataFbsBitGcBitmap();
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataFbsBitGcBitmap();
+ void ConstructL();
+ virtual CFbsBitmap* GetFbsBitmap() const;
+
+private:
+ void DestroyData();
+ void DoCmdDestructor();
+ void DoCmdNewL();
+ void DoCmdAddress(const TDesC& aSection);
+ void DoCmdLockHeap();
+ void DoCmdUnlockHeap();
+private:
+ CFbsBitGcBitmap* iFbsBitGcBitmap;
+
+ };
+
+#endif /*T_DATAFBSBITGCBITMAP_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/inc/T_DataFbsBitGcFont.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,60 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#if (!defined __T_DATA_FBS_BITGC_FONT_H__)
+#define __T_DATA_FBS_BITGC_FONT_H__
+
+// User includes
+#include "T_DataFbsFont.h"
+
+class CT_DataFbsBitGcFont : public CT_DataFbsFont
+ {
+public:
+ static CT_DataFbsBitGcFont* NewL();
+
+ ~CT_DataFbsBitGcFont();
+
+ // CTPData implementation
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aObject);
+ virtual void DisownObjectL();
+
+protected:
+ CT_DataFbsBitGcFont();
+ void ConstructL();
+
+ // CT_DataFont implementation
+ virtual CFont* GetFont() const;
+
+ // CT_DataFbsFont implementation
+ virtual CFbsFont* GetFbsFont() const;
+
+private:
+ void DoCmdNewL();
+ void DoCmdDestructor();
+
+ void DoCmdAddress();
+ void DoCmdDuplicate(const TDesC& aSection);
+ void DoCmdReset();
+
+
+protected:
+ /** test step reference*/
+ CFbsBitGcFont* iFbsBitGcFont;
+ };
+
+#endif /* __T_DATA_FBS_BITGC_FONT_H__ */
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/inc/T_DataFbsBitmapDevice.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,68 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#if (!defined __T_DATA_FBS_BITMAP_DEVICE_H__)
+#define __T_DATA_FBS_BITMAP_DEVICE_H__
+
+// User includes
+#include "T_DataFbsDevice.h"
+
+class CT_DataFbsBitmapDevice : public CT_DataFbsDevice
+ {
+public:
+ static CT_DataFbsBitmapDevice* NewL();
+
+ ~CT_DataFbsBitmapDevice();
+
+ // CTPData implementation
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aObject);
+ virtual void DisownObjectL();
+ void DestroyData();
+
+protected:
+ CT_DataFbsBitmapDevice();
+ void ConstructL();
+
+ // CT_DataGraphicsDeviceMap implementation
+ virtual MGraphicsDeviceMap* GetGraphicsDeviceMap() const;
+
+ // CT_DataGraphicsDevice implementation
+ virtual CGraphicsDevice* GetGraphicsDevice() const;
+
+ // CT_DataBitmapDevice implementation
+ virtual CBitmapDevice* GetBitmapDevice() const;
+
+ // CT_DataFbsDevice implementation
+ virtual CFbsDevice* GetFbsDevice() const;
+
+private:
+ void DoCmdNewL(const TDesC& aSection);
+ void DoCmdDestructor();
+ void DoCmdDrawingBegin(const TDesC& aSection);
+ void DoCmdDrawingEnd(const TDesC& aSection);
+ void DoCmdResize(const TDesC& aSection);
+ void DoCmdSwapWidthAndHeight();
+
+
+protected:
+ /** test step reference*/
+ CFbsBitmapDevice* iFbsBitmapDevice;
+ };
+
+#endif /* __T_DATA_FBS_BITMAP_DEVICE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/inc/T_DataFbsDevice.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,56 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#if (!defined __T_DATA_FBS_DEVICE_H__)
+#define __T_DATA_FBS_DEVICE_H__
+
+// User includes
+#include "DataWrapperBase.h"
+#include "T_DataBitmapDevice.h"
+
+class CT_DataFbsDevice : public CT_DataBitmapDevice
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ CT_DataFbsDevice();
+
+protected:
+ void DoCmdCheckPixels(const TDesC& aSection);
+ void DoCmdCheckLineColor(const TDesC& aSection);
+ void DoCmdCheckRectColor(const TDesC& aSection);
+ void DoCmdGetFontByIdL(const TDesC& aSection);
+ TBool DoCmdGetNearestFontInPixelsL(const TDesC& aSection);
+ TBool DoCmdGetNearestFontInTwipsL(const TDesC& aSection);
+ TBool DoCmdGetNearestFontToDesignHeightInPixelsL(const TDesC& aSection);
+ TBool DoCmdGetNearestFontToDesignHeightInTwipsL(const TDesC& aSection);
+ TBool DoCmdGetNearestFontToMaxHeightInPixelsL(const TDesC& aSection);
+ TBool DoCmdGetNearestFontToMaxHeightInTwipsL(const TDesC& aSection);
+ void DoCmdSizeInPixels(const TDesC& aSection);
+
+ TBool DoCmdCreateContextL(const TDesC& aSection);
+ void DoCmdRectCompareL(const TDesC& aSection);
+ void DoCmdSetCustomPaletteL(const TDesC& aSection);
+ void DoCmdGraphicsAccelerator();
+ void DoCmdOrientation(const TDesC& aSection);
+ void DoCmdDisplayMode16M(const TDesC& aSection);
+ void DoCmdSetScalingFactor(const TDesC& aSection);
+ void DoCmdGetDrawRect(const TDesC& aSection);
+ void DoCmdRegisterLinkedTypefaceL(const TDesC& aSection);
+
+ virtual CFbsDevice* GetFbsDevice() const = 0;
+ };
+
+#endif /* __T_DATA_FBS_DEVICE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/inc/T_DataFbsScreenDevice.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,74 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#if (!defined __T_DATA_FBS_SCREEN_DEVICE_H__)
+#define __T_DATA_FBS_SCREEN_DEVICE_H__
+
+// User includes
+#include "T_DataFbsDevice.h"
+
+class CT_DataFbsScreenDevice : public CT_DataFbsDevice
+ {
+public:
+ static CT_DataFbsScreenDevice* NewL();
+
+ // CTPData implementation
+ virtual TAny* GetObject();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ virtual void SetObjectL(TAny* aAny);
+ ~CT_DataFbsScreenDevice();
+ void DestroyData();
+ virtual void DisownObjectL();
+
+protected:
+ CT_DataFbsScreenDevice();
+ void ConstructL();
+
+ // CT_DataGraphicsDeviceMap implementation
+ virtual MGraphicsDeviceMap* GetGraphicsDeviceMap() const;
+
+ // CT_DataGraphicsDevice implementation
+ virtual CGraphicsDevice* GetGraphicsDevice() const;
+
+ // CT_DataBitmapDevice implementation
+ virtual CBitmapDevice* GetBitmapDevice() const;
+
+ // CT_DataFbsDevice implementation
+ virtual CFbsDevice* GetFbsDevice() const;
+
+private:
+ void DoCmdNew(const TDesC& aSection);
+ void DoCmdDestructor();
+// void DoCmdSizeInTwips();
+
+ void DoCmdChangeScreenDeviceL(const TDesC& aSection);
+ void DoCmdDrawSpriteBegin();
+ void DoCmdDrawSpriteEnd();
+ void DoCmdHardwareBitmap();
+ void DoCmdScreenNo(const TDesC& aSection);
+ void DoCmdSetAutoUpdate(const TDesC& aSection);
+ void DoCmdUpdateL(const TDesC& aSection);
+ void DoCmdCancelSprite();
+ void DoCmdHideSpriteL(const TDesC& aSection);
+ void DoCmdShowSpriteL(const TDesC& aSection);
+
+
+protected:
+ /** test step reference*/
+ CFbsScreenDevice* iFbsScreenDevice;
+ };
+
+#endif /* __T_DATA_FBS_SCREEN_DEVICE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/inc/T_DataPolygonFiller.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,55 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef T_DATAPOLYGONFILLER_H_
+#define T_DATAPOLYGONFILLER_H_
+
+
+#include "DataWrapperBase.h"
+
+
+class CT_DataPolygonFiller : public CDataWrapperBase
+ {
+public:
+ static CT_DataPolygonFiller* NewL();
+
+ ~CT_DataPolygonFiller();
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt);
+ //void RunL(CActive* aActive, TInt aIndex);
+
+protected:
+ CT_DataPolygonFiller();
+ void ConstructL();
+
+private:
+ void DestroyData();
+ void DoCmdnewL();
+ void DoCmdConstructL(const TDesC& aSection);
+ void DoCmdReset();
+ void DoCmdGetNextPixelRun(const TDesC& aSection);
+ void DoCmdGetNextPixelRunOnSpecifiedScanLine(const TDesC& aSection);
+ void DoCmdDestructor();
+private:
+ CPolygonFiller* iPolygonFiller;
+ CArrayFix<TPoint>* iPointsArray;
+ TPoint* iPoints;
+ };
+
+#endif /*T_DATAPOLYGONFILLER_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/inc/T_GraphicsBitgdiAPIServer.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,46 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#if (!defined __T_GRAPHICS_BITGDI_API_SERVER_H__)
+#define __T_GRAPHICS_BITGDI_API_SERVER_H__
+
+// User Include
+#include "TestServerBase.h"
+
+class CT_GraphicsBitgdiAPIServer : public CTestServerBase
+ {
+private:
+ class CT_GraphicsBitgdiAPIBlock : public CTestBlockController
+ {
+ public:
+ inline CT_GraphicsBitgdiAPIBlock();
+ inline ~CT_GraphicsBitgdiAPIBlock();
+
+ CDataWrapper* CreateDataL(const TDesC& aData);
+ };
+
+public:
+ inline CT_GraphicsBitgdiAPIServer();
+ inline ~CT_GraphicsBitgdiAPIServer();
+
+ static CT_GraphicsBitgdiAPIServer* NewL();
+
+ inline CTestBlockController* CreateTestBlock();
+ };
+
+#include "T_GraphicsBitgdiAPIServer.inl"
+
+#endif /* __T_GRAPHICS_BITGDI_API_SERVER_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/inc/T_GraphicsBitgdiAPIServer.inl Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,39 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/*@{*/
+/*@}*/
+
+inline CT_GraphicsBitgdiAPIServer::CT_GraphicsBitgdiAPIBlock::CT_GraphicsBitgdiAPIBlock()
+ {
+ }
+
+inline CT_GraphicsBitgdiAPIServer::CT_GraphicsBitgdiAPIBlock::~CT_GraphicsBitgdiAPIBlock()
+ {
+ }
+
+inline CT_GraphicsBitgdiAPIServer::CT_GraphicsBitgdiAPIServer()
+ {
+ }
+
+inline CT_GraphicsBitgdiAPIServer::~CT_GraphicsBitgdiAPIServer()
+ {
+ }
+
+inline CTestBlockController* CT_GraphicsBitgdiAPIServer::CreateTestBlock()
+ {
+ return new CT_GraphicsBitgdiAPIBlock();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/src/T_DataFbsBitGc.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,1113 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+#include <e32cmn.h>
+#include <e32property.h>
+#include "T_DataFbsBitGc.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdNewL, "NewL");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdActivate, "Activate");
+_LIT(KCmdActivateNoJustAutoUpdate, "ActivateNoJustAutoUpdate");
+_LIT(KCmdAlphaBlendBitmaps, "AlphaBlendBitmaps");
+_LIT(KCmdDisown, "disown");
+_LIT(KCmdDrawPolyLineNoEndPoint, "DrawPolyLineNoEndPoint");
+
+_LIT(KCmdCancelClipping, "CancelClipping");
+_LIT(KCmdCopySettings, "CopySettings");
+_LIT(KCmdBitBlt, "BitBlt");
+
+_LIT(KCmdDrawText, "DrawText");
+_LIT(KCmdDrawTextVertical, "DrawTextVertical");
+_LIT(KCmdUpdateJustification, "UpdateJustification");
+_LIT(KCmdUpdateJustificationVertical,"UpdateJustificationVertical");
+
+_LIT(KCmdFadeArea, "FadeArea");
+_LIT(KCmdIsBrushPatternUsed, "IsBrushPatternUsed");
+_LIT(KCmdIsFontUsed, "IsFontUsed");
+_LIT(KCmdOrientationsAvailable, "OrientationsAvailable");
+_LIT(KCmdRectDrawnTo, "RectDrawnTo");
+_LIT(KCmdResized, "Resized");
+_LIT(KCmdSetDitherOrigin, "SetDitherOrigin");
+_LIT(KCmdSetFadeMode, "SetFadeMode");
+_LIT(KCmdSetFadingParameters, "SetFadingParameters");
+_LIT(KCmdSetOrientation, "SetOrientation");
+_LIT(KCmdSetShadowMode, "SetShadowMode");
+_LIT(KCmdSetUserDisplayMode, "SetUserDisplayMode");
+_LIT(KCmdShadowArea, "ShadowArea");
+_LIT(KCmdUseBrushPattern, "UseBrushPattern");
+_LIT(KCmdUseFont, "UseFont");
+_LIT(KCmdUseFontNoDuplicate, "UseFontNoDuplicate");
+_LIT(KCmdGetAvailableOrientation, "GetAvailableOrientation");
+_LIT(KCmdPromptMessage, "PromptMessage");
+/// Fields
+_LIT(KFldAlphaBmp, "alphabmp");
+_LIT(KFldAlphaPt, "alphapt");
+_LIT(KFldDestPt, "destpt");
+_LIT(KFldDevice, "device");
+_LIT(KFldSrcBmp1, "srcbmp1");
+_LIT(KFldSrcBmp2, "srcbmp2");
+_LIT(KFldSrcPt, "srcpt");
+_LIT(KFldSrcRect, "srcrect");
+_LIT(KFldNumPoints, "numpoints");
+_LIT(KFldPointList, "pointlist");
+
+_LIT(KFldFbsBitGc, "fbsBitGc");
+_LIT(KFldPoint, "point");
+
+_LIT(KFldRect, "rect");
+_LIT(KFldTextAlign, "textalign");
+_LIT(KFldText, "text");
+_LIT(KFldLeftMargin, "leftmargin");
+_LIT(KFldBaselineOffset, "baselineoffset");
+_LIT(KFldTextWidth, "textwidth");
+_LIT(KFldUp, "up");
+_LIT(KFldParam, "param");
+
+_LIT(KFldRegion, "region");
+_LIT(KFldFadeMode, "fademode");
+_LIT(KFldBlackMap, "blackmap");
+_LIT(KFldWhiteMap, "whitemap");
+_LIT(KFldGraphicsOrientation, "orientation");
+_LIT(KFldShadowMode, "shadowmode");
+_LIT(KFldDisplayMode, "displaymode");
+_LIT(KFldHandle, "handle");
+_LIT(KFldFont, "font");
+_LIT(KFldBitmap, "bitmap");
+_LIT(KFldUseHandle, "usehandle");
+_LIT(KFldPromptText, "message");
+_LIT(KFldExpectedKey, "keyCode");
+
+_LIT(KFldExpect, "expect");
+_LIT(KFormatFieldNumber, "Orientation_%d=%d");
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value,get %d, expectd %d");
+/*@}*/
+_LIT(KPromptProcess, "t_prompt.exe");
+
+
+/**
+* Two phase constructor
+*/
+CT_DataFbsBitGc* CT_DataFbsBitGc::NewL()
+ {
+ CT_DataFbsBitGc* ret=new (ELeave) CT_DataFbsBitGc();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataFbsBitGc::CT_DataFbsBitGc()
+: CT_DataBitmapContext()
+, iFbsBitGc(NULL)
+ {
+ }
+
+/**
+* Protected second phase construction
+*/
+void CT_DataFbsBitGc::ConstructL()
+ {
+
+ }
+
+/**
+* Destructor.
+*/
+CT_DataFbsBitGc::~CT_DataFbsBitGc()
+ {
+
+ DestroyData();
+ }
+
+void CT_DataFbsBitGc::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iFbsBitGc = static_cast<CFbsBitGc*> (aAny);
+ }
+
+void CT_DataFbsBitGc::DisownObjectL()
+ {
+ iFbsBitGc = NULL;
+ }
+
+void CT_DataFbsBitGc::DestroyData()
+ {
+ delete iFbsBitGc;
+ iFbsBitGc=NULL;
+ }
+
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataFbsBitGc::GetObject()
+ {
+ return iFbsBitGc;
+ }
+
+// CT_DataBitmapContext implementation
+CBitmapContext* CT_DataFbsBitGc::GetBitmapContext() const
+ {
+ return iFbsBitGc;
+ }
+
+// CT_DataGraphicsContext implementation
+CGraphicsContext* CT_DataFbsBitGc::GetGraphicsContext() const
+ {
+ return iFbsBitGc;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsBitGc::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ /* Another work package will complete the implement of this */
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdNewL )
+ {
+ DoCmdNewL();
+ }
+ else if ( aCommand==KCmdDestructor )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdActivate )
+ {
+ DoCmdActivateL(aSection);
+ }
+ else if ( aCommand == KCmdDisown )
+ {
+ DisownObjectL();
+ }
+ else if ( aCommand==KCmdActivateNoJustAutoUpdate )
+ {
+ DoCmdActivateNoJustAutoUpdateL(aSection);
+ }
+ else if ( aCommand==KCmdAlphaBlendBitmaps )
+ {
+ if ( !DoCmdAlphaBlendBitmapsL(aSection) )
+ {
+ ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if ( aCommand==KCmdDrawPolyLineNoEndPoint )
+ {
+ DoCmdDrawPolyLineNoEndPointL(aSection);
+ }
+ else if ( aCommand==KCmdCancelClipping)
+ {
+ DoCmdCancelClipping(aSection);
+ }
+ else if ( aCommand==KCmdCopySettings)
+ {
+ DoCmdCopySettingsL(aSection);
+ }
+ else if ( aCommand==KCmdBitBlt)
+ {
+ if(!DoCmdBitBltL(aSection))
+ {
+ ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if(aCommand==KCmdDrawText)
+ {
+ DoCmdDrawTextL(aSection);
+ }
+ else if(aCommand==KCmdDrawTextVertical)
+ {
+ DoCmdDrawTextVerticalL(aSection);
+ }
+ else if(aCommand==KCmdUpdateJustification)
+ {
+ DoCmdUpdateJustificationL(aSection);
+ }
+ else if(aCommand==KCmdUpdateJustificationVertical)
+ {
+ DoCmdUpdateJustificationVerticalL(aSection);
+ }
+ else if(aCommand==KCmdFadeArea)
+ {
+ DoCmdFadeArea(aSection);
+ }
+ else if(aCommand==KCmdIsBrushPatternUsed)
+ {
+ DoCmdIsBrushPatternUsed(aSection);
+ }
+ else if(aCommand==KCmdIsFontUsed)
+ {
+ DoCmdIsFontUsed(aSection);
+ }
+ else if(aCommand==KCmdOrientationsAvailable)
+ {
+ DoCmdOrientationsAvailable(aSection);
+ }
+ else if(aCommand==KCmdRectDrawnTo)
+ {
+ DoCmdRectDrawnTo(aSection);
+ }
+ else if(aCommand==KCmdResized)
+ {
+ DoCmdResized(aSection);
+ }
+ else if(aCommand==KCmdSetDitherOrigin)
+ {
+ DoCmdSetDitherOrigin(aSection);
+ }
+ else if(aCommand==KCmdSetFadeMode)
+ {
+ DoCmdSetFadeMode(aSection);
+ }
+ else if(aCommand==KCmdSetFadingParameters)
+ {
+ if(!DoCmdSetFadingParameters(aSection))
+ {
+ ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if(aCommand==KCmdSetOrientation)
+ {
+ DoCmdSetOrientation(aSection);
+ }
+ else if(aCommand==KCmdSetShadowMode)
+ {
+ DoCmdSetShadowMode(aSection);
+ }
+ else if(aCommand==KCmdSetUserDisplayMode)
+ {
+ DoCmdSetUserDisplayMode(aSection);
+ }
+ else if(aCommand==KCmdShadowArea)
+ {
+ DoCmdShadowArea(aSection);
+ }
+ else if(aCommand==KCmdUseBrushPattern)
+ {
+ DoCmdUseBrushPatternL(aSection);
+ }
+ else if(aCommand==KCmdUseFont)
+ {
+ DoCmdUseFontL(aSection);
+ }
+ else if(aCommand==KCmdUseFontNoDuplicate)
+ {
+ DoCmdUseFontNoDuplicateL(aSection);
+ }
+ else if(aCommand==KCmdPromptMessage)
+ {
+ DoCmdPromptMessageL(aSection);
+ }
+ else
+ {
+ ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+void CT_DataFbsBitGc::DoCmdNewL()
+ {
+ DestroyData();
+
+ INFO_PRINTF1(_L("execute CFbsBitGc::NewL"));
+ TRAPD( err, iFbsBitGc = CFbsBitGc::NewL() );
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdDestructor()
+ {
+ DestroyData();
+ }
+
+void CT_DataFbsBitGc::DoCmdActivateL(const TDesC& aSection)
+ {
+ CFbsDevice* device=NULL;
+ if ( !CT_GraphicsUtil::GetFbsDeviceL(*this, aSection, KFldDevice, device) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldDevice());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Activate(CFbsDevice*)"));
+ iFbsBitGc->Activate(device);
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdActivateNoJustAutoUpdateL(const TDesC& aSection)
+ {
+ CFbsDevice* device=NULL;
+ if ( !CT_GraphicsUtil::GetFbsDeviceL(*this, aSection, KFldDevice, device) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldDevice());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute ActivateNoJustAutoUpdate(CFbsDevice*)"));
+ iFbsBitGc->ActivateNoJustAutoUpdate(device);
+ }
+ }
+
+TBool CT_DataFbsBitGc::DoCmdAlphaBlendBitmapsL(const TDesC& aSection)
+ {
+ CFbsBitmap* fbsBitmap1=NULL;
+ TBool ret=CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldSrcBmp1, fbsBitmap1);
+ if ( ret )
+ {
+ TBool dataOk=ETrue;
+
+ CFbsBitmap* fbsBitmap2=NULL;
+ if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldSrcBmp2, fbsBitmap2) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSrcBmp2());
+ SetBlockResult(EFail);
+ }
+
+ CFbsBitmap* alphaBitmap=NULL;
+ if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldAlphaBmp, alphaBitmap) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldAlphaBmp());
+ SetBlockResult(EFail);
+ }
+
+ TPoint destinationPoint;
+ if ( !GetPointFromConfig(aSection, KFldDestPt, destinationPoint) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDestPt());
+ SetBlockResult(EFail);
+ }
+
+ TRect sourceRect;
+ if ( !GetRectFromConfig(aSection, KFldSrcRect, sourceRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSrcRect());
+ SetBlockResult(EFail);
+ }
+
+ TPoint sourcePoint;
+ if ( !GetPointFromConfig(aSection, KFldSrcPt, sourcePoint) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSrcPt());
+ SetBlockResult(EFail);
+ }
+
+ TPoint alphaPoint;
+ if ( !GetPointFromConfig(aSection, KFldAlphaPt, alphaPoint) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldAlphaPt());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute AlphaBlendBitmaps(const TPoint&,const CFbsBitmap*,const CFbsBitmap*,const TRect&,const TPoint&,const CFbsBitmap*,const TPoint&"));
+ TInt err=iFbsBitGc->AlphaBlendBitmaps(destinationPoint, fbsBitmap1, fbsBitmap2, sourceRect, sourcePoint, alphaBitmap, alphaPoint);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+ return ret;
+ }
+
+void CT_DataFbsBitGc::DoCmdDrawPolyLineNoEndPointL(const TDesC& aSection)
+ {
+ TInt datNumPoints;
+ if ( GetIntFromConfig(aSection, KFldNumPoints, datNumPoints) )
+ {
+ TPoint* points=new (ELeave) TPoint[datNumPoints];
+
+ if ( !GetPointListFromConfig(aSection, KFldPointList, datNumPoints, points) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawPolyLineNoEndPoint(TPoint*, TInt)"));
+ iFbsBitGc->DrawPolyLineNoEndPoint(points, datNumPoints);
+ }
+ delete [] points;
+ }
+ else
+ {
+ CArrayFix<TPoint>* points=new (ELeave) CArrayFixFlat<TPoint>(1);
+ CleanupStack::PushL(points);
+ TBool hasPointList=GetPointListFromConfigL(aSection, KFldPointList, *points);
+
+ if ( !hasPointList )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawPolyLineNoEndPoint(CArrayFix<TPoint>*)"));
+ iFbsBitGc->DrawPolyLineNoEndPoint(points);
+ }
+ CleanupStack::PopAndDestroy(points);
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdCancelClipping(const TDesC& /*aSection*/)
+ {
+ INFO_PRINTF1(_L("execute CancelClipping()"));
+ iFbsBitGc->CancelClipping();
+ }
+
+void CT_DataFbsBitGc::DoCmdCopySettingsL(const TDesC& aSection)
+ {
+ CFbsBitGc* fbsBitGc=NULL;
+
+ if ( !CT_GraphicsUtil::GetFbsBitGcL(*this, aSection, KFldFbsBitGc, fbsBitGc) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFbsBitGc());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute CopySettings(CFbsBitGc&)"));
+ iFbsBitGc->CopySettings(*fbsBitGc);
+ }
+ }
+
+TBool CT_DataFbsBitGc::DoCmdBitBltL(const TDesC& aSection)
+ {
+ TBool ret=ETrue;
+ CFbsBitGc* fbsBitGc=NULL;
+
+ if ( !CT_GraphicsUtil::GetFbsBitGcL(*this, aSection, KFldFbsBitGc, fbsBitGc) )
+ {
+ ret=EFalse;
+ }
+ else
+ {
+ // Execute command and log parameters
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ //Case failed, needn't execute other step.
+ return ret;
+ }
+
+ TRect sourceRect;
+ if(!GetRectFromConfig(aSection, KFldSrcRect, sourceRect))
+ {
+ INFO_PRINTF1(_L("execute BitBlt(const TPoint&, const CFbsBitGc&)"));
+ iFbsBitGc->BitBlt(point,*fbsBitGc);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute BitBlt(const TPoint&, const CFbsBitGc&,const TRect &)"));
+ iFbsBitGc->BitBlt(point,*fbsBitGc,sourceRect);
+ }
+ }
+
+ return ret;
+ }
+
+void CT_DataFbsBitGc::DoCmdDrawTextL(const TDesC& aSection)
+ {
+ TRect rect;
+ TInt baselineOffset=0;
+ TPtrC text;
+ TInt datTextWidth;
+
+ if ( !GetStringFromConfig(aSection, KFldText(), text) )
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
+ SetBlockResult(EFail);
+ return;
+ }
+
+ if (GetRectFromConfig(aSection, KFldRect, rect) )
+ {
+ if (GetIntFromConfig(aSection, KFldBaselineOffset, baselineOffset))
+ {
+ TInt datMargin=0;
+ CGraphicsContext::TTextAlign textAlign=CGraphicsContext::ELeft;
+ CT_GraphicsUtil::ReadTextAlign(*this, aSection, KFldTextAlign,
+ textAlign);
+ if (!GetIntFromConfig(aSection, KFldLeftMargin, datMargin))
+ {
+ INFO_PRINTF1(_L("Using the default value aMargin=0"));
+ }
+
+ if (GetIntFromConfig(aSection, KFldTextWidth, datTextWidth))
+ {
+ INFO_PRINTF1(_L("execute DrawText(const TDesC &,const TRect &,TInt,TInt,TTextAlign,TInt)"));
+ iFbsBitGc->DrawText(text, rect, baselineOffset, datTextWidth,
+ textAlign, datMargin);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute DrawText(const TDesC &,const TRect &,TInt,TTextAlign,TInt)"));
+ iFbsBitGc->DrawText(text, rect, baselineOffset, textAlign,
+ datMargin);
+ }
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute DrawText(const TDesC&,const TRect&)"));
+ iFbsBitGc->DrawText(text, rect);
+ }
+ }
+ else
+ {
+ TPoint point;
+ if (!GetPointFromConfig(aSection, KFldPoint, point))
+ {
+ INFO_PRINTF1(_L("execute DrawText(const TDesC&)"));
+ iFbsBitGc->DrawText(text);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute DrawText(const TDesC&,const TPoint&)"));
+ iFbsBitGc->DrawText(text, point);
+ }
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdDrawTextVerticalL(const TDesC& aSection)
+ {
+ TPtrC text;
+ TInt datTextWidth;
+ TBool up=EFalse;
+
+ if ( !GetStringFromConfig(aSection, KFldText(), text) )
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
+ SetBlockResult(EFail);
+ return;
+ }
+
+ if ( !GetBoolFromConfig(aSection, KFldUp, up))
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldUp());
+ SetBlockResult(EFail);
+ return;
+ }
+
+ TRect rect;
+ TInt baselineOffset=0;
+ if (GetRectFromConfig(aSection, KFldRect, rect) )
+ {
+ if (GetIntFromConfig(aSection, KFldBaselineOffset, baselineOffset))
+ {
+ TInt datMargin=0;
+ CGraphicsContext::TTextAlign textAlign=CGraphicsContext::ELeft;
+ CT_GraphicsUtil::ReadTextAlign(*this, aSection, KFldTextAlign,
+ textAlign);
+ if (!GetIntFromConfig(aSection, KFldLeftMargin, datMargin))
+ {
+ INFO_PRINTF1(_L("Using the default value aMargin=0"));
+ }
+
+ if (GetIntFromConfig(aSection, KFldTextWidth, datTextWidth))
+ {
+ INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TRect &,TInt,TInt,TBool,TTextAlign,TInt)"));
+ iFbsBitGc->DrawTextVertical(text, rect, baselineOffset,
+ datTextWidth, up, textAlign, datMargin);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TRect &,TInt,TBool,TTextAlign,TInt)"));
+ iFbsBitGc->DrawTextVertical(text, rect, baselineOffset, up,
+ textAlign, datMargin);
+ }
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TRect &,TBool)"));
+ iFbsBitGc->DrawTextVertical(text, rect, up);
+ }
+ }
+ else
+ {
+ TPoint point;
+ if (!GetPointFromConfig(aSection, KFldPoint, point))
+ {
+ INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,TBool)"));
+ iFbsBitGc->DrawTextVertical(text, up);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TPoint &,TBool)"));
+ iFbsBitGc->DrawTextVertical(text, point, up);
+ }
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdUpdateJustificationL(const TDesC& aSection)
+ {
+ TPtrC text;
+ if ( !GetStringFromConfig(aSection, KFldText(), text) )
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
+ SetBlockResult(EFail);
+ return;
+ }
+ INFO_PRINTF1(_L("execute UpdateJustification(const TDesC &)"));
+ iFbsBitGc->UpdateJustification(text);
+ }
+
+void CT_DataFbsBitGc::DoCmdUpdateJustificationVerticalL(const TDesC& aSection)
+ {
+ TPtrC text;
+ TBool up=EFalse;
+
+ if ( !GetStringFromConfig(aSection, KFldText(), text) )
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
+ SetBlockResult(EFail);
+ return;
+ }
+
+ if ( !GetBoolFromConfig(aSection, KFldUp, up))
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldUp());
+ SetBlockResult(EFail);
+ return;
+ }
+ INFO_PRINTF1(_L("execute UpdateJustificationVertical(const TDesC &,TBool)"));
+ iFbsBitGc->UpdateJustificationVertical(text, up);
+ }
+
+void CT_DataFbsBitGc::DoCmdFadeArea(const TDesC& aSection)
+ {
+ RRegion reg;
+ if(GetRegionFromConfig(aSection,KFldRegion,reg))
+ {
+ INFO_PRINTF1(_L("execute FadeArea(const TRegion *)"));
+ iFbsBitGc->FadeArea(®);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("Missing parameter %S"), &KFldRegion());
+ INFO_PRINTF1(_L("execute FadeArea(NULL)"));
+ iFbsBitGc->FadeArea(NULL);
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdIsBrushPatternUsed(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute IsBrushPatternUsed()"));
+ TBool bUsed=iFbsBitGc->IsBrushPatternUsed();
+
+ TBool expect;
+ if(GetBoolFromConfig(aSection,KFldExpect,expect))
+ {
+ if(expect!=bUsed)
+ {
+ ERR_PRINTF3(KLogNotExpectedValue, bUsed,expect);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdIsFontUsed(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute IsFontUsed()"));
+ TBool bUsed=iFbsBitGc->IsFontUsed();
+
+ TBool expect;
+ if(GetBoolFromConfig(aSection,KFldExpect,expect))
+ {
+ if(expect!=bUsed)
+ {
+ ERR_PRINTF3(KLogNotExpectedValue, bUsed,expect);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdOrientationsAvailable(const TDesC& /*aSection*/)
+ {
+ INFO_PRINTF1(_L("execute OrientationsAvailable(TBool aOrientation[4])"));
+
+ //iGraphicsOrientation defined in CDataWrapperBase
+ iFbsBitGc->OrientationsAvailable(iGraphicsOrientation);
+
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ for(TInt i=0;i<4;i++)
+ {
+ tempStore.Format(KFormatFieldNumber, i+1,iGraphicsOrientation[i]);
+ INFO_PRINTF1(KFormatFieldNumber);
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdRectDrawnTo(const TDesC& aSection)
+ {
+ TRect rect;
+ if(GetRectFromConfig(aSection, KFldRect, rect))
+ {
+ INFO_PRINTF1(_L("execute RectDrawnTo(TRect&)"));
+ iFbsBitGc->RectDrawnTo(rect);
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldRect());
+ SetBlockResult(EFail);
+ }
+
+ }
+
+void CT_DataFbsBitGc::DoCmdResized(const TDesC& /*aSection*/)
+ {
+ INFO_PRINTF1(_L("execute Resized()"));
+ iFbsBitGc->Resized();
+
+ }
+
+void CT_DataFbsBitGc::DoCmdSetDitherOrigin(const TDesC& aSection)
+ {
+ TPoint point;
+ if (GetPointFromConfig(aSection, KFldPoint, point))
+ {
+ INFO_PRINTF1(_L("execute SetDitherOrigin(const TPoint &)"));
+ iFbsBitGc->SetDitherOrigin(point);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdSetFadeMode(const TDesC& aSection)
+ {
+ TBool fade;
+ if(GetBoolFromConfig(aSection,KFldFadeMode,fade))
+ {
+ INFO_PRINTF1(_L("execute SetFadeMode(TBool)"));
+ iFbsBitGc->SetFadeMode(fade);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetFadeMode(TBool aFadeMode=EFalse)"));
+ iFbsBitGc->SetFadeMode();
+ }
+ }
+
+TBool CT_DataFbsBitGc::DoCmdSetFadingParameters(const TDesC& aSection)
+ {
+ TInt blackmap=0;
+ TInt whitemap=255;
+ if(GetIntFromConfig(aSection,KFldWhiteMap,whitemap))
+ {
+ //let base class handle this
+ return EFalse;
+ }
+ else
+ {
+ if(GetBoolFromConfig(aSection,KFldBlackMap,blackmap))
+ {
+ INFO_PRINTF1(_L("execute SetFadingParameters(TUint8)"));
+ iFbsBitGc->SetFadingParameters(blackmap);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetFadingParameters(TUint8 aBlackMap=0)"));
+ iFbsBitGc->SetFadingParameters();
+ }
+ }
+ return ETrue;
+ }
+
+void CT_DataFbsBitGc::DoCmdSetOrientation(const TDesC& aSection)
+ {
+ CFbsBitGc::TGraphicsOrientation orientation;
+ TBool ret=EFalse;
+ if(CT_GraphicsUtil::GetGraphicsOrientation(*this,aSection,KFldGraphicsOrientation,orientation))
+ {
+ INFO_PRINTF1(_L("execute SetOrientation(TGraphicsOrientation)"));
+ ret=iFbsBitGc->SetOrientation(orientation);
+ if(ret!=iGraphicsOrientation[orientation])
+ {
+ INFO_PRINTF1(_L("SetOrientation and OrientationsAvailable return values are not match!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldGraphicsOrientation());
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdSetShadowMode(const TDesC& aSection)
+ {
+ TBool mode;
+ if(GetBoolFromConfig(aSection,KFldShadowMode,mode))
+ {
+ INFO_PRINTF1(_L("execute SetShadowMode(TBool)"));
+ iFbsBitGc->SetShadowMode(mode);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetShadowMode(TBool aShadowMode=EFalse)"));
+ iFbsBitGc->SetShadowMode();
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdSetUserDisplayMode(const TDesC& aSection)
+ {
+ TDisplayMode mode;
+ if(CT_GraphicsUtil::ReadDisplayMode(*this,aSection,KFldDisplayMode,mode))
+ {
+ INFO_PRINTF1(_L("execute SetUserDisplayMode(TDisplayMode)"));
+ iFbsBitGc->SetUserDisplayMode(mode);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldDisplayMode());
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdShadowArea(const TDesC& aSection)
+ {
+ RRegion reg;
+ if(GetRegionFromConfig(aSection,KFldRegion,reg))
+ {
+ INFO_PRINTF1(_L("execute ShadowArea(const TRegion *)"));
+ iFbsBitGc->ShadowArea(®);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("Missing parameter %S"), &KFldRegion());
+ INFO_PRINTF1(_L("execute ShadowArea(NULL)"));
+ iFbsBitGc->ShadowArea(NULL);
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdUseBrushPatternL(const TDesC& aSection)
+ {
+ TInt handle;
+ if(GetIntFromConfig(aSection,KFldHandle,handle))
+ {
+ INFO_PRINTF1(_L("execute UseBrushPattern(TInt) using the specified handle."));
+ TInt err=iFbsBitGc->UseBrushPattern(handle);
+ if(KErrNone!=err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ else
+ {
+ CFbsBitmap* bitmap=NULL;
+ if (CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap))
+ {
+ TBool usehandle;
+ if(GetBoolFromConfig(aSection,KFldUseHandle,usehandle))
+ {
+ INFO_PRINTF1(_L("execute UseBrushPattern(TInt) using the bitmap object's handle."));
+ TInt err=iFbsBitGc->UseBrushPattern(bitmap->Handle());
+ if(KErrNone!=err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute UseBrushPattern(CFbsBitmap*)"));
+ iFbsBitGc->UseBrushPattern(bitmap);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldBitmap());
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdUseFontL(const TDesC& aSection)
+ {
+ TInt handle;
+ if(GetIntFromConfig(aSection,KFldHandle,handle))
+ {
+ INFO_PRINTF1(_L("execute UseFont(TInt) using the specified handle"));
+ TInt err=iFbsBitGc->UseFont(handle);
+ if(KErrNone!=err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ else
+ {
+ CFont* font=NULL;
+ if(CT_GraphicsUtil::GetFontL(*this,aSection,KFldFont,font))
+ {
+ TBool usehandle;
+ if(GetBoolFromConfig(aSection,KFldUseHandle,usehandle))
+ {
+ INFO_PRINTF1(_L("execute UseFont(TInt) using the font object's handle"));
+ TInt err=iFbsBitGc->UseFont(((CFbsFont*)font)->Handle());
+ if(KErrNone!=err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute UseFont(CFont*)"));
+ iFbsBitGc->UseFont(font);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldFont());
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdUseFontNoDuplicateL(const TDesC& aSection)
+ {
+ CFont* font=NULL;
+ if(CT_GraphicsUtil::GetFontL(*this,aSection,KFldFont,font))
+ {
+ INFO_PRINTF1(_L("execute UseFontNoDuplicate(const CFbsBitGcFont*)"));
+ iFbsBitGc->UseFontNoDuplicate((CFbsBitGcFont*)font);
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldFont());
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataFbsBitGc::DoCmdPromptMessageL(const TDesC& aSection)
+ {
+ TPtrC text;
+ //get prompt text to display in console in order to help user verify.
+ if(!GetStringFromConfig(aSection, KFldPromptText(), text))
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldPromptText());
+ SetBlockResult(EFail);
+ }
+ TInt expectedKey;
+ if(!GetIntFromConfig(aSection, KFldExpectedKey(), expectedKey))
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldExpectedKey());
+ SetBlockResult(EFail);
+ }
+ TInt actualKey;
+ RProperty property;
+ const TUid KMyPropertyCat={0x10012345};
+ TUint key=1;
+ TSecurityPolicy read(TSecurityPolicy::EAlwaysPass);
+ TSecurityPolicy write(TSecurityPolicy::EAlwaysPass);
+ TInt err=property.Define(KMyPropertyCat,key,RProperty::EInt,read,write);
+ if (err==KErrAlreadyExists)
+ {
+ ERR_PRINTF1(_L("RProperty has existed!"));
+ SetBlockResult(EFail);
+ User::LeaveIfError(err);
+ }
+ err=property.Attach(KMyPropertyCat,key);
+ TRequestStatus substatus;
+ //issue a request to get property change information.
+ property.Subscribe(substatus);
+ RProcess promptProcess;
+ err = promptProcess.Create(KPromptProcess, text);
+ if (err == KErrNone)
+ {
+ CleanupClosePushL(promptProcess);
+ TRequestStatus promptStatus;
+ promptProcess.Rendezvous(promptStatus);
+ if (promptStatus == KRequestPending)
+ {
+ promptProcess.Resume();
+ User::WaitForRequest(promptStatus);
+ }
+ else
+ {
+ promptProcess.RendezvousCancel(promptStatus);
+ promptProcess.Kill(0);
+ ERR_PRINTF2(_L("Executing of prompt process failed with error %d"), promptStatus.Int());
+ SetBlockResult(EFail);
+ }
+ CleanupStack::PopAndDestroy();
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Failed to create prompt process with error %d"), err);
+ SetBlockResult(EFail);
+ }
+ //get property change information.
+ User::WaitForRequest(substatus);
+ if (substatus!=KRequestPending)
+ {
+ property.Get(KMyPropertyCat,key,actualKey);
+ INFO_PRINTF2(_L("property.Get %d"), actualKey);
+ }
+ err=RProperty::Delete(KMyPropertyCat,key);
+ if (err!=KErrNotFound)
+ User::LeaveIfError(err);
+ property.Close();
+ if(actualKey != expectedKey)
+ {
+ ERR_PRINTF3(_L("expectedKey=%d pressed key=%d"), expectedKey, actualKey);
+ SetBlockResult(EFail);
+ }
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/src/T_DataFbsBitGcBitmap.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,199 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "T_DataFbsBitGcBitmap.h"
+
+
+/// Commands
+_LIT(KCmdNewL, "new");
+_LIT(KCmdAddress, "Address");
+_LIT(KCmdLockHeap, "LockHeap");
+_LIT(KCmdUnlockHeap, "UnlockHeap");
+_LIT(KCmdDestructorGeneral, "~");
+_LIT(KCmdDestructor, "~CFbsBitGcBitmap");
+
+//Log
+_LIT(KLogErrNum, "Error=%d");
+_LIT(KLogInfoCmdnewL, "execute new CFbsBitGcBitmap()");
+_LIT(KLogInfoCmdDestructor1, "execute ~CFbsBitGcBitmap()");
+
+//Fields
+_LIT(KFldExpectedWidth, "expectedWidth");
+_LIT(KFldExpectedHeight, "expectedHeight");
+
+
+CT_DataFbsBitGcBitmap* CT_DataFbsBitGcBitmap::NewL()
+ {
+ CT_DataFbsBitGcBitmap* ret = new (ELeave) CT_DataFbsBitGcBitmap();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataFbsBitGcBitmap::CT_DataFbsBitGcBitmap()
+: iFbsBitGcBitmap(NULL)
+ {
+
+ }
+
+void CT_DataFbsBitGcBitmap::ConstructL()
+ {
+
+ }
+
+CT_DataFbsBitGcBitmap::~CT_DataFbsBitGcBitmap()
+ {
+ DestroyData();
+ }
+
+TAny* CT_DataFbsBitGcBitmap::GetObject()
+ {
+ return iFbsBitGcBitmap;
+ }
+
+void CT_DataFbsBitGcBitmap::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iFbsBitGcBitmap = static_cast<CFbsBitGcBitmap*> (aAny);
+ }
+
+void CT_DataFbsBitGcBitmap::DisownObjectL()
+ {
+ iFbsBitGcBitmap = NULL;
+ }
+
+CFbsBitmap* CT_DataFbsBitGcBitmap::GetFbsBitmap() const
+ {
+ return iFbsBitGcBitmap;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsBitGcBitmap::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+ if (aCommand==KCmdNewL)
+ {
+ DoCmdNewL();
+ }
+ else if ( aCommand==KCmdDestructorGeneral || aCommand==KCmdDestructor )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdAddress)
+ {
+ DoCmdAddress(aSection);
+ }
+ else if(aCommand==KCmdLockHeap)
+ {
+ DoCmdLockHeap();
+ }
+ else if(aCommand==KCmdUnlockHeap)
+ {
+ DoCmdUnlockHeap();
+ }
+ else
+ {
+ ret=CT_DataFbsBitmap::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+void CT_DataFbsBitGcBitmap::DestroyData()
+ {
+ delete iFbsBitGcBitmap;
+ iFbsBitGcBitmap = NULL;
+ }
+
+void CT_DataFbsBitGcBitmap::DoCmdDestructor()
+ {
+ INFO_PRINTF1(KLogInfoCmdDestructor1);
+ DestroyData();
+ }
+
+void CT_DataFbsBitGcBitmap::DoCmdNewL()
+ {
+ DestroyData();
+ TInt err = KErrNone;
+ INFO_PRINTF1(KLogInfoCmdnewL);
+ TRAP(err, iFbsBitGcBitmap = new (ELeave) CFbsBitGcBitmap());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogErrNum, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataFbsBitGcBitmap::DoCmdAddress(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute CFbsBitGcBitmap::Address()"));
+ CBitwiseBitmap* bmp=iFbsBitGcBitmap->Address();
+ if(bmp==NULL)
+ {
+ INFO_PRINTF1(_L("The bitmap address is NULL"));
+ return;
+ }
+
+ TInt displaymode=bmp->DisplayMode();
+ TSize size=bmp->SizeInPixels();
+ TInt sizeH=size.iHeight;
+ TInt sizeW=size.iWidth;
+ TInt expectedWidth, expectedHeight;
+ if(GetIntFromConfig(aSection,KFldExpectedWidth, expectedWidth))
+ {
+ if(expectedWidth!=sizeW)
+ {
+ ERR_PRINTF3(_L("The bitmap width in pixel is: %d not as expected: %d"), sizeW, expectedWidth);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("The bitmap width in pixel is: %d as expected"),sizeW);
+ }
+ }
+
+ if(GetIntFromConfig(aSection, KFldExpectedHeight, expectedHeight))
+ {
+ if(expectedHeight!=sizeH)
+ {
+ ERR_PRINTF3(_L("The bitmap height in pixel is: %d not as expected: %d"), sizeH, expectedHeight);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("The bitmap height in pixel is: %d as expected"),sizeH);
+ }
+ }
+ }
+
+void CT_DataFbsBitGcBitmap::DoCmdLockHeap()
+ {
+ INFO_PRINTF1(_L("execute CFbsBitGcBitmap::LockHeap()"));
+ iFbsBitGcBitmap->LockHeap();
+ }
+
+void CT_DataFbsBitGcBitmap::DoCmdUnlockHeap()
+ {
+ INFO_PRINTF1(_L("execute CFbsBitGcBitmap::UnlockHeap"));
+ iFbsBitGcBitmap->UnlockHeap();
+ }
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/src/T_DataFbsBitGcFont.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,225 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "T_DataFbsBitGcFont.h"
+
+/*@{*/
+/// Parameters
+_LIT(KFldHandle, "handle");
+_LIT(KFontDataObjectName, "font_data_object_name");
+
+/// Commands
+_LIT(KCmdNewL, "NewL");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdAddress, "Address");
+_LIT(KCmdDuplicate, "Duplicate");
+_LIT(KCmdReset, "Reset");
+
+
+/// Logs
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogErrNum, "Execute failed with error = %d!");
+/*@}*/
+
+
+/**
+* Constructor
+*/
+CT_DataFbsBitGcFont* CT_DataFbsBitGcFont::NewL()
+ {
+ CT_DataFbsBitGcFont* ret = new (ELeave) CT_DataFbsBitGcFont();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataFbsBitGcFont::CT_DataFbsBitGcFont()
+: CT_DataFbsFont()
+, iFbsBitGcFont(NULL)
+ {
+ }
+
+/**
+* Protected second phase construction
+*/
+void CT_DataFbsBitGcFont::ConstructL()
+ {
+ }
+
+/**
+* Destructor.
+*/
+CT_DataFbsBitGcFont::~CT_DataFbsBitGcFont()
+ {
+ DisownObjectL();
+ }
+
+
+CFont* CT_DataFbsBitGcFont::GetFont() const
+ {
+ return iFbsBitGcFont;
+ }
+
+CFbsFont* CT_DataFbsBitGcFont::GetFbsFont() const
+ {
+ return iFbsBitGcFont;
+ }
+
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataFbsBitGcFont::GetObject()
+ {
+ return iFbsBitGcFont;
+ }
+
+void CT_DataFbsBitGcFont::SetObjectL(TAny* aObject)
+ {
+ iFbsBitGcFont = static_cast<CFbsBitGcFont*> (aObject);
+ }
+
+void CT_DataFbsBitGcFont::DisownObjectL()
+ {
+ iFbsBitGcFont = NULL;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsBitGcFont::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ /* Another work package will complete the implement of this */
+ TBool retVal = ETrue;
+
+ if ( aCommand == KCmdNewL )
+ {
+ DoCmdNewL();
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DoCmdDestructor();
+ }
+ else if (aCommand == KCmdAddress)
+ {
+ DoCmdAddress();
+ }
+ else if (aCommand == KCmdDuplicate)
+ {
+ DoCmdDuplicate(aSection);
+ }
+ else if (aCommand == KCmdReset)
+ {
+ DoCmdReset();
+ }
+ else
+ {
+ retVal = CT_DataFbsFont::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ return retVal;
+ }
+
+
+void CT_DataFbsBitGcFont::DoCmdNewL()
+ {
+ TInt err = KErrNone;
+ INFO_PRINTF1(_L("Create CFbsBitGcFont Object by CFbsBitGcFont() constructor function."));
+ TRAP(err, iFbsBitGcFont = new (ELeave) CFbsBitGcFont());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogErrNum, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataFbsBitGcFont::DoCmdDestructor()
+ {
+ DisownObjectL();
+ }
+
+void CT_DataFbsBitGcFont::DoCmdAddress()
+ {
+ CBitmapFont* BitmapFontPtr = NULL;
+ INFO_PRINTF1(_L("Execute CFbsBitGcFont::Address() function."));
+
+ BitmapFontPtr = iFbsBitGcFont->Address();
+ if (NULL == BitmapFontPtr)
+ {
+ INFO_PRINTF1(_L("The CBitmapFont* returned is NULL."));
+ }
+ }
+
+void CT_DataFbsBitGcFont::DoCmdDuplicate(const TDesC& aSection)
+ {
+ TInt handle = 0;
+ INFO_PRINTF1(_L("Execute CFbsBitGcFont::Duplicate(TInt aHandle) function."));
+
+ if(GetIntFromConfig(aSection,KFldHandle,handle))
+ {
+ INFO_PRINTF2(_L("Execute Duplicate(TInt aHandle) using the specified handle = %d"), handle);
+ }
+ else
+ {
+ TPtrC fontDataObjectName;
+ if (!GetStringFromConfig(aSection, KFontDataObjectName(), fontDataObjectName))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFontDataObjectName);
+ SetBlockResult(EFail);
+ return;
+ }
+ else
+ {
+ CT_DataFbsBitGcFont* fontDataObject = NULL;
+ fontDataObject = static_cast<CT_DataFbsBitGcFont*>(GetDataWrapperL(fontDataObjectName));
+ if (NULL == fontDataObject)
+ {
+ ERR_PRINTF1(_L("Bad Object!"));
+ SetBlockResult(EFail);
+ return;
+ }
+ else
+ {
+ handle = ((CFbsBitGcFont*)fontDataObject->GetObject())->Handle();
+ INFO_PRINTF2(_L("Execute Duplicate(TInt aHandle) using CFbsBitGcFont Object's handle = %d"), handle);
+ }
+ }
+ }
+
+ TInt err = iFbsBitGcFont->Duplicate(handle);
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogErrNum, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataFbsBitGcFont::DoCmdReset()
+ {
+ INFO_PRINTF1(_L("Execute CFbsBitGcFont::Reset() function."));
+ iFbsBitGcFont->Reset();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/src/T_DataFbsBitmapDevice.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,253 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+// User includes
+#include "T_DataFbsBitmapDevice.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdNewL, "NewL");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdDrawingBegin, "DrawingBegin");
+_LIT(KCmdDrawingEnd, "DrawingEnd");
+_LIT(KCmdResize, "Resize");
+_LIT(KCmdSwapWidthAndHeight, "SwapWidthAndHeight");
+
+/// Parameters
+_LIT(KFldBitmap, "bitmap");
+_LIT(KFldLibName, "libname");
+_LIT(KFldSize, "size");
+_LIT(KFldResize, "resize");
+_LIT(KFldAlways, "Always");
+
+// Logs
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogErrNum, "Execute failed with error = %d!");
+/*@}*/
+
+
+/**
+* Two phase constructor
+*/
+CT_DataFbsBitmapDevice* CT_DataFbsBitmapDevice::NewL()
+ {
+ CT_DataFbsBitmapDevice* ret = new (ELeave) CT_DataFbsBitmapDevice();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataFbsBitmapDevice::CT_DataFbsBitmapDevice()
+: CT_DataFbsDevice()
+, iFbsBitmapDevice(NULL)
+ {
+ }
+
+/**
+* Protected second phase construction
+*/
+void CT_DataFbsBitmapDevice::ConstructL()
+ {
+ }
+
+/**
+* Destructor.
+*/
+CT_DataFbsBitmapDevice::~CT_DataFbsBitmapDevice()
+ {
+ DestroyData();
+ }
+
+void CT_DataFbsBitmapDevice::DestroyData()
+ {
+ delete iFbsBitmapDevice;
+ iFbsBitmapDevice=NULL;
+ }
+
+MGraphicsDeviceMap* CT_DataFbsBitmapDevice::GetGraphicsDeviceMap() const
+ {
+ return iFbsBitmapDevice;
+ }
+
+CGraphicsDevice* CT_DataFbsBitmapDevice::GetGraphicsDevice() const
+ {
+ return iFbsBitmapDevice;
+ }
+
+CBitmapDevice* CT_DataFbsBitmapDevice::GetBitmapDevice() const
+ {
+ return iFbsBitmapDevice;
+ }
+
+CFbsDevice* CT_DataFbsBitmapDevice::GetFbsDevice() const
+ {
+ return iFbsBitmapDevice;
+ }
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataFbsBitmapDevice::GetObject()
+ {
+ return iFbsBitmapDevice;
+ }
+
+void CT_DataFbsBitmapDevice::SetObjectL(TAny* aObject)
+ {
+ DestroyData();
+ iFbsBitmapDevice = static_cast<CFbsBitmapDevice*> (aObject);
+ }
+
+void CT_DataFbsBitmapDevice::DisownObjectL()
+ {
+ iFbsBitmapDevice = NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsBitmapDevice::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ /* Another work package will complete the implement of this */
+ TBool retVal = ETrue;
+
+ if ( aCommand == KCmdNewL )
+ {
+ DoCmdNewL(aSection);
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DoCmdDestructor();
+ }
+ else if (aCommand == KCmdDrawingBegin)
+ {
+ DoCmdDrawingBegin(aSection);
+ }
+ else if (aCommand == KCmdDrawingEnd)
+ {
+ DoCmdDrawingEnd(aSection);
+ }
+ else if (aCommand == KCmdResize)
+ {
+ DoCmdResize(aSection);
+ }
+ else if (aCommand == KCmdSwapWidthAndHeight)
+ {
+ DoCmdSwapWidthAndHeight();
+ }
+ else
+ {
+ retVal=CT_DataFbsDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ return retVal;
+ }
+
+void CT_DataFbsBitmapDevice::DoCmdNewL(const TDesC& aSection)
+ {
+ DestroyData();
+ CFbsBitmap* bitmap = NULL;
+
+ if (!CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldBitmap);
+ SetBlockResult(EFail);
+ return;
+ }
+ TInt err = KErrNone;
+ TPtrC libName;
+ if ( GetStringFromConfig(aSection, KFldLibName(), libName) )
+ {
+ INFO_PRINTF1(_L("execute NewL(CFbsBitmap*, const TDesC&)."));
+ TRAP(err, iFbsBitmapDevice=CFbsBitmapDevice::NewL(bitmap, libName));
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute NewL(CFbsBitmap*)."));
+ TRAP(err, iFbsBitmapDevice=CFbsBitmapDevice::NewL(bitmap));
+ }
+
+ if ( err != KErrNone )
+ {
+ ERR_PRINTF2(KLogErrNum, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataFbsBitmapDevice::DoCmdDestructor()
+ {
+ DestroyData();
+ }
+
+void CT_DataFbsBitmapDevice::DoCmdDrawingBegin(const TDesC& aSection)
+ {
+ TBool Always = EFalse;
+ GetBoolFromConfig(aSection, KFldAlways, Always);
+ INFO_PRINTF2(_L("execute DrawingBegin function with the Always parameter=%d."), Always);
+ iFbsBitmapDevice->DrawingBegin(Always);
+ }
+
+void CT_DataFbsBitmapDevice::DoCmdDrawingEnd(const TDesC& aSection)
+ {
+ TBool Always = EFalse;
+ GetBoolFromConfig(aSection, KFldAlways, Always);
+ INFO_PRINTF2(_L("execute DrawingEnd function with the Always parameter=%d."), Always);
+ iFbsBitmapDevice->DrawingEnd(Always);
+ }
+
+void CT_DataFbsBitmapDevice::DoCmdResize(const TDesC& aSection)
+ {
+ TSize datSize;
+ TInt err = KErrNone;
+ INFO_PRINTF1(_L("execute Resize(const TSize&)"));
+ if (!GetSizeFromConfig(aSection, KFldResize, datSize))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldResize);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ err = iFbsBitmapDevice->Resize(datSize);
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogErrNum, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataFbsBitmapDevice::DoCmdSwapWidthAndHeight()
+ {
+ INFO_PRINTF1(_L("execute SwapWidthAndHeight()"));
+ TInt err = iFbsBitmapDevice->SwapWidthAndHeight();
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogErrNum, err);
+ SetError(err);
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/src/T_DataFbsDevice.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,1058 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "T_DataFbsDevice.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdcheckPixels, "checkPixels");
+_LIT(KCmdcheckLineColor, "checkLineColor");
+_LIT(KCmdcheckRectColor, "checkRectColor");
+_LIT(KCmdSizeInPixels, "SizeInPixels");
+_LIT(KCmdGetFontById, "GetFontById");
+_LIT(KCmdGetNearestFontInPixels, "GetNearestFontInPixels");
+_LIT(KCmdGetNearestFontInTwips, "GetNearestFontInTwips");
+_LIT(KCmdGetNearestFontToDesignHeightInPixels, "GetNearestFontToDesignHeightInPixels");
+_LIT(KCmdGetNearestFontToDesignHeightInTwips, "GetNearestFontToDesignHeightInTwips");
+_LIT(KCmdGetNearestFontToMaxHeightInPixels, "GetNearestFontToMaxHeightInPixels");
+_LIT(KCmdGetNearestFontToMaxHeightInTwips, "GetNearestFontToMaxHeightInTwips");
+_LIT(KCmdCreateContext, "CreateContext");
+_LIT(KCmdRectCompare, "RectCompare");
+_LIT(KCmdSetCustomPalette, "SetCustomPalette");
+_LIT(KCmdGraphicsAccelerator, "GraphicsAccelerator");
+_LIT(KCmdOrientation, "Orientation");
+_LIT(KCmdDisplayMode16M, "DisplayMode16M");
+_LIT(KCmdSetScalingFactor, "SetScalingFactor");
+_LIT(KCmdGetDrawRect, "GetDrawRect");
+_LIT(KCmdRegisterLinkedTypeface, "RegisterLinkedTypeface");
+
+//Fields
+_LIT(KFldAlgStyle, "alg_style");
+_LIT(KFldExpected, "expected");
+_LIT(KFldFinish, "finish");
+_LIT(KFldFormatFieldNumber, "%S%d");
+_LIT(KFldFont, "font");
+_LIT(KFldFbsFont, "fbsfont");
+_LIT(KFldFontUid, "font_uid");
+_LIT(KFldMaxHeight, "maxheight");
+_LIT(KFldPixel, "pixel");
+_LIT(KFldRect, "rect");
+_LIT(KFldStart, "start");
+_LIT(KFldBitGc, "bitgc");
+_LIT(KFldRect1, "rect1");
+_LIT(KFldRect2, "rect2");
+_LIT(KFldFbsDevice, "fbsdevice");
+_LIT(KFldExpectedOrientation, "expectedorientation");
+_LIT(KFldPalette, "palette");
+_LIT(KFldGraphicsAccelerator, "graphicsaccelerator");
+_LIT(KFldExpectedDisplayMode, "expecteddisplaymode");
+_LIT(KFldOrigin, "origin");
+_LIT(KFldFactorX, "factorx");
+_LIT(KFldFactorY, "factory");
+_LIT(KFldDivisorX, "divisorx");
+_LIT(KFldDivisorY, "divisory");
+_LIT(KFldExpectedDrawRect, "expecteddrawrect");
+_LIT(KFldOffset, "offset");
+_LIT(KFldLinkedTypefaceSpec, "linkedtypefacespec");
+_LIT(KFldExpectedUid, "expecteduid");
+
+//Logs
+_LIT(KLogColor, "Color Red=%d Green=%d Blue=%d Alpha=%d");
+_LIT(KLogPoint, "Point X=%d Y=%d");
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogMissingWrapper, "Missing wrapper for '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+/*@}*/
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataFbsDevice::CT_DataFbsDevice()
+: CT_DataBitmapDevice()
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsDevice::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ /* Another work package will implement this */
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdcheckPixels)
+ {
+ DoCmdCheckPixels(aSection);
+ }
+ else if (aCommand == KCmdcheckLineColor)
+ {
+ DoCmdCheckLineColor(aSection);
+ }
+ else if (aCommand == KCmdcheckRectColor)
+ {
+ DoCmdCheckRectColor(aSection);
+ }
+ else if (aCommand == KCmdSizeInPixels)
+ {
+ DoCmdSizeInPixels(aSection);
+ }
+ else if (aCommand == KCmdGetFontById)
+ {
+ DoCmdGetFontByIdL(aSection);
+ }
+ else if (aCommand == KCmdGetNearestFontInPixels)
+ {
+ if( !DoCmdGetNearestFontInPixelsL(aSection) )
+ {
+ retVal = CT_DataBitmapDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if (aCommand == KCmdGetNearestFontInTwips)
+ {
+ if( !DoCmdGetNearestFontInTwipsL(aSection) )
+ {
+ retVal = CT_DataBitmapDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if (aCommand == KCmdGetNearestFontToDesignHeightInPixels)
+ {
+ if( !DoCmdGetNearestFontToDesignHeightInPixelsL(aSection) )
+ {
+ retVal = CT_DataBitmapDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if (aCommand == KCmdGetNearestFontToDesignHeightInTwips)
+ {
+ if( !DoCmdGetNearestFontToDesignHeightInTwipsL(aSection) )
+ {
+ retVal = CT_DataBitmapDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if (aCommand == KCmdGetNearestFontToMaxHeightInPixels)
+ {
+ if( !DoCmdGetNearestFontToMaxHeightInPixelsL(aSection) )
+ {
+ retVal = CT_DataBitmapDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if (aCommand == KCmdGetNearestFontToMaxHeightInTwips)
+ {
+ if( !DoCmdGetNearestFontToMaxHeightInTwipsL(aSection) )
+ {
+ retVal = CT_DataBitmapDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if (aCommand == KCmdCreateContext)
+ {
+ if (!DoCmdCreateContextL(aSection))
+ {
+ retVal = CT_DataBitmapDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if (aCommand == KCmdRectCompare)
+ {
+ DoCmdRectCompareL(aSection);
+ }
+ else if (aCommand == KCmdOrientation)
+ {
+ DoCmdOrientation(aSection);
+ }
+ else if (aCommand == KCmdSetCustomPalette)
+ {
+ DoCmdSetCustomPaletteL(aSection);
+ }
+ else if (aCommand == KCmdGraphicsAccelerator)
+ {
+ DoCmdGraphicsAccelerator();
+ }
+ else if (aCommand == KCmdDisplayMode16M)
+ {
+ DoCmdDisplayMode16M(aSection);
+ }
+ else if (aCommand == KCmdSetScalingFactor)
+ {
+ DoCmdSetScalingFactor(aSection);
+ }
+ else if (aCommand == KCmdGetDrawRect)
+ {
+ DoCmdGetDrawRect(aSection);
+ }
+ else if (aCommand == KCmdRegisterLinkedTypeface)
+ {
+ DoCmdRegisterLinkedTypefaceL(aSection);
+ }
+ else
+ {
+ retVal = CT_DataBitmapDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ return retVal;
+ }
+
+
+void CT_DataFbsDevice::DoCmdSizeInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute SizeInPixels()"));
+ TSize actualsize;
+ TInt expectheight = 0;
+ TInt expectwidth = 0;
+ TSize expectsize;
+
+ if (!GetSizeFromConfig(aSection, KFldExpected, expectsize))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ actualsize = GetFbsDevice()->SizeInPixels();
+ if (actualsize != expectsize)
+ {
+ ERR_PRINTF3(_L("The actual size is width=%d, height=%d"), actualsize.iWidth, actualsize.iHeight);
+ ERR_PRINTF3(_L("The expect size is width=%d, height=%d"), expectsize.iWidth, expectsize.iHeight);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+* DoCmdcheckPixels: to check the color of specified pixels on the screen device, and compare
+* with the expected color specidied in the TEF testdata.
+* pixel<n>: specify the position of the screen device to check
+* expected<n>: specify the expected color to be compared with
+*
+*/
+void CT_DataFbsDevice::DoCmdCheckPixels(const TDesC& aSection)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TBool moreData = ETrue;
+ for (TInt index=1; moreData; ++index)
+ {
+ // get the pixel position on the screen to check/verify
+ tempStore.Format(KFldFormatFieldNumber, &KFldPixel, index);
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, tempStore, point) )
+ {
+ moreData = EFalse;
+ }
+ else
+ {
+ TRgb actual;
+ GetFbsDevice()->GetPixel(actual, point);
+
+ tempStore.Format(KFldFormatFieldNumber, &KFldExpected, index);
+ TRgb expected;
+ if (GetRgbFromConfig(aSection, tempStore, expected))
+ {
+ if (actual != expected)
+ {
+ ERR_PRINTF5(KLogColor, actual.Red(), actual.Green(), actual.Blue(), actual.Alpha());
+ ERR_PRINTF5(KLogColor, expected.Red(), expected.Green(), expected.Blue(), expected.Alpha());
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+ }
+
+/**
+* DoCmdcheckLineColor: to check the color of specified lines on the screen device, and compare
+* with the expected color specidied in the TEF testdata.
+* start<n>: specify the starting position of the line on the screen device to check
+* finish<n>: specify the finish position of the line on the screen device to check
+* expected<n>: specify the expected color to be compared with
+* Note: the straight line (from start to the finish points) is constructed by TLinearDDA
+*
+*/
+void CT_DataFbsDevice::DoCmdCheckLineColor(const TDesC& aSection)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ CPalette* palette = NULL;
+ GetFbsDevice()->GetPalette(palette);
+
+ TBool moreData = ETrue;
+ for (TInt index=1; moreData; ++index)
+ {
+ // get the the start and finish points of the line to check/verify
+ tempStore.Format(KFldFormatFieldNumber, &KFldStart, index);
+ TPoint startPoint;
+ if (!GetPointFromConfig(aSection, tempStore, startPoint))
+ {
+ moreData = EFalse;
+ }
+
+ tempStore.Format(KFldFormatFieldNumber, &KFldFinish, index);
+ TPoint endPoint;
+ if (!GetPointFromConfig(aSection, tempStore, endPoint))
+ {
+ moreData = EFalse;
+ }
+
+ if (moreData)
+ {
+ // get the expected color from testdata
+ tempStore.Format(KFldFormatFieldNumber, &KFldExpected, index);
+ TRgb expected;
+ if (!GetRgbFromConfig(aSection, tempStore, expected))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &tempStore);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if (palette!=NULL)
+ {
+ expected = palette->NearestEntry(expected);
+ }
+
+ TLinearDDA lineDDA;
+ lineDDA.Construct(startPoint, endPoint, TLinearDDA::ECenter);
+
+ // for each pixels on the line (from start to finish points), check if its color matches expected
+ TPoint point;
+ while (!lineDDA.SingleStep(point))
+ {
+ TRgb actual;
+ GetFbsDevice()->GetPixel(actual, point);
+
+ if (actual != expected)
+ {
+ ERR_PRINTF5(KLogColor, actual.Red(), actual.Green(), actual.Blue(), actual.Alpha());
+ ERR_PRINTF5(KLogColor, expected.Red(), expected.Green(), expected.Blue(), expected.Alpha());
+ ERR_PRINTF3(KLogPoint, point.iX, point.iY);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+ }
+ delete palette;
+ }
+
+/**
+* DoCmdcheckRectColor: to check the color of specified rectangle on the screen device, and
+* compare with the expected color specidied in the TEF testdata.
+* rect<n>: specify the rectangle area on the screen device to check
+* expected<n>: specify the expected color to be compared with
+*
+*/
+void CT_DataFbsDevice::DoCmdCheckRectColor(const TDesC& aSection)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ CPalette* palette=NULL;
+ GetFbsDevice()->GetPalette(palette);
+
+ TBool moreData = ETrue;
+ for (TInt index=1; moreData; ++index)
+ {
+ // get the the rectangle to check/verify
+ tempStore.Format(KFldFormatFieldNumber, &KFldRect, index);
+ TRect rect;
+ if (!GetRectFromConfig(aSection, tempStore, rect))
+ {
+ moreData = EFalse;
+ }
+ else
+ {
+ // get the expected color from testdata
+ tempStore.Format(KFldFormatFieldNumber, &KFldExpected, index);
+ TRgb expected;
+ if (!GetRgbFromConfig(aSection, tempStore, expected))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &tempStore);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if (palette!=NULL)
+ {
+ expected = palette->NearestEntry(expected);
+ }
+
+ TPoint point;
+ for (point.iX=rect.iTl.iX; point.iX<rect.iBr.iX; ++point.iX)
+ {
+ for (point.iY=rect.iTl.iY; point.iY<rect.iBr.iY; ++point.iY)
+ {
+ TRgb actual;
+ GetFbsDevice()->GetPixel(actual, point);
+
+ if (actual!=expected)
+ {
+ ERR_PRINTF5(KLogColor, actual.Red(), actual.Green(), actual.Blue(), actual.Alpha());
+ ERR_PRINTF5(KLogColor, expected.Red(), expected.Green(), expected.Blue(), expected.Alpha());
+ ERR_PRINTF3(KLogPoint, point.iX, point.iY);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+ }
+ }
+ delete palette;
+ }
+
+void CT_DataFbsDevice::DoCmdGetFontByIdL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // get font uid
+ TInt fontUid;
+ if( !GetIntFromConfig(aSection, KFldFontUid(), fontUid) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFontUid());
+ SetBlockResult(EFail);
+ }
+
+ // get algorithmic style
+ TAlgStyle* algStyle = NULL;
+ CT_GraphicsUtil::GetAlgStyleL(*this, aSection, KFldAlgStyle(), algStyle);
+ if (NULL == algStyle)
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldAlgStyle());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ if( GetStringFromConfig(aSection, KFldFbsFont, wrapperName) )
+ {
+ // "CFbsFont*&" type
+ if ( dataOk )
+ {
+ CFbsFont* fbsFont = NULL;
+ INFO_PRINTF1(_L("execute GetFontById(CFbsFont *&aFont, TUid aFileId, const TAlgStyle &aAlgStyle)"));
+ TInt err = GetFbsDevice()->GetFontById(fbsFont, TUid::Uid(fontUid), *algStyle);
+
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, fbsFont);
+ }
+ }
+ }
+ else if( GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ // "CFont*&" type
+ if( dataOk )
+ {
+ CFont* font = NULL;
+ INFO_PRINTF1(_L("execute GetFontById(CFont *&aFont, TUid aFileId, const TAlgStyle &aAlgStyle)"));
+ TInt err = GetFbsDevice()->GetFontById(font, TUid::Uid(fontUid), *algStyle);
+
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, font);
+ }
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+ }
+
+TBool CT_DataFbsDevice::DoCmdGetNearestFontInPixelsL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+
+ // get font specification
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ if ( GetStringFromConfig(aSection, KFldFbsFont, wrapperName) )
+ {
+ // "CFbsFont*&" type
+ if(dataOk)
+ {
+ CFbsFont* fbsFont = NULL;
+ INFO_PRINTF1(_L("execute GetNearestFontInPixels(CFbsFont*&, TFontSpec)"));
+ TInt err = GetFbsDevice()->GetNearestFontInPixels(fbsFont, fontSpec);
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, fbsFont);
+ }
+ }
+ }
+ else if( GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ // "CFont*&" type
+ // hand over the ownership to parent class
+ return EFalse;
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ return ETrue;
+ }
+
+TBool CT_DataFbsDevice::DoCmdGetNearestFontInTwipsL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+
+ // get font specification
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ if ( GetStringFromConfig(aSection, KFldFbsFont, wrapperName) )
+ {
+ // "CFbsFont*&" type
+ if(dataOk)
+ {
+ CFbsFont* fbsFont = NULL;
+ INFO_PRINTF1(_L("execute GetNearestFontInTwips(CFbsFont*&, TFontSpec)"));
+ TInt err = GetFbsDevice()->GetNearestFontInTwips(fbsFont, fontSpec);
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, fbsFont);
+ }
+ }
+ }
+ else if( GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ // "CFont*&" type
+ // hand over the ownership to parent class
+ return EFalse;
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ return ETrue;
+ }
+
+TBool CT_DataFbsDevice::DoCmdGetNearestFontToDesignHeightInPixelsL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+
+ // get font specification
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ if ( GetStringFromConfig(aSection, KFldFbsFont, wrapperName) )
+ {
+ // "CFbsFont*&" type
+ if(dataOk)
+ {
+ CFbsFont* fbsFont = NULL;
+ INFO_PRINTF1(_L("execute DoCmdGetNearestFontToDesignHeightInPixels(CFbsFont*&, TFontSpec)"));
+ TInt err = GetFbsDevice()->GetNearestFontToDesignHeightInPixels(fbsFont, fontSpec);
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, fbsFont);
+ }
+ }
+ }
+ else if( GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ // "CFont*&" type
+ // hand over the ownership to parent class
+ return EFalse;
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ return ETrue;
+ }
+
+TBool CT_DataFbsDevice::DoCmdGetNearestFontToDesignHeightInTwipsL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+
+ // get font specification
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ if ( GetStringFromConfig(aSection, KFldFbsFont, wrapperName) )
+ {
+ // "CFbsFont*&" type
+ if(dataOk)
+ {
+ CFbsFont* fbsFont = NULL;
+ INFO_PRINTF1(_L("execute DoCmdGetNearestFontToDesignHeightInTwips(CFbsFont*&, TFontSpec)"));
+ TInt err = GetFbsDevice()->GetNearestFontToDesignHeightInTwips(fbsFont, fontSpec);
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, fbsFont);
+ }
+ }
+ }
+ else if( GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ // "CFont*&" type
+ // hand over the ownership to parent class
+ return EFalse;
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ return ETrue;
+ }
+
+TBool CT_DataFbsDevice::DoCmdGetNearestFontToMaxHeightInPixelsL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+
+ // get font specification
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ // get maximum height in pixels
+ TInt maxHeight;
+ if ( !GetIntFromConfig(aSection, KFldMaxHeight, maxHeight) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldMaxHeight());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ if ( GetStringFromConfig(aSection, KFldFbsFont, wrapperName) )
+ {
+ // "CFbsFont*&" type
+ if(dataOk)
+ {
+ CFbsFont* fbsFont = NULL;
+ INFO_PRINTF1(_L("execute DoCmdGetNearestFontToMaxHeightInPixels(CFbsFont*&, TFontSpec)"));
+ TInt err = GetFbsDevice()->GetNearestFontToMaxHeightInPixels(fbsFont, fontSpec, maxHeight);
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, fbsFont);
+ }
+ }
+ }
+ else if( GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ // "CFont*&" type
+ // hand over the ownership to parent class
+ return EFalse;
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ return ETrue;
+ }
+
+TBool CT_DataFbsDevice::DoCmdGetNearestFontToMaxHeightInTwipsL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+
+ // get font specification
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ // get maximum height in twips
+ TInt maxHeight;
+ if ( !GetIntFromConfig(aSection, KFldMaxHeight, maxHeight) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldMaxHeight());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ if ( GetStringFromConfig(aSection, KFldFbsFont, wrapperName) )
+ {
+ // "CFbsFont*&" type
+ if(dataOk)
+ {
+ CFbsFont* fbsFont = NULL;
+ INFO_PRINTF1(_L("execute DoCmdGetNearestFontToMaxHeightInTwips(CFbsFont*&, TFontSpec)"));
+ TInt err = GetFbsDevice()->GetNearestFontToMaxHeightInTwips(fbsFont, fontSpec, maxHeight);
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, fbsFont);
+ }
+ }
+ }
+ else if( GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ // "CFont*&" type
+ // hand over the ownership to parent class
+ return EFalse;
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ return ETrue;
+ }
+
+TBool CT_DataFbsDevice::DoCmdCreateContextL(const TDesC& aSection)
+ {
+ TPtrC wrapperName;
+
+ if (!GetStringFromConfig(aSection, KFldBitGc, wrapperName))
+ {
+ return EFalse;
+ }
+ else
+ {
+ CDataWrapper* wrapper = GetDataWrapperL(wrapperName);
+ if (wrapper == NULL)
+ {
+ ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CFbsBitGc* context = NULL;
+ INFO_PRINTF1(_L("execute CreateContext(CFbsBitGc*&)"));
+ TInt err = GetFbsDevice()->CreateContext(context);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ wrapper->SetObjectL(context);
+ }
+ }
+ return ETrue;
+ }
+ }
+
+void CT_DataFbsDevice::DoCmdRectCompareL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+
+ // Get test data for command input parameter(s)
+ TRect datRect1;
+ if ( !GetRectFromConfig(aSection, KFldRect1, datRect1) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect1);
+ SetBlockResult(EFail);
+ }
+
+ TRect datRect2;
+ if ( !GetRectFromConfig(aSection, KFldRect2, datRect2) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect2);
+ SetBlockResult(EFail);
+ }
+
+ TBool expected;
+ if ( !GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+
+ if (dataOk)
+ {
+ TBool actual;
+ CFbsDevice* device = NULL;
+ CFbsDevice* self = GetFbsDevice();
+ if (!CT_GraphicsUtil::GetFbsDeviceL(*this, aSection, KFldFbsDevice, device) )
+ {
+ device = self;
+ }
+ actual = self->RectCompare(datRect1, *device, datRect2);
+ INFO_PRINTF2(_L("execute RectCompare(const TRect&, const CFbsDevice&, const TRect&)=%d"), actual);
+
+ if (actual != expected)
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataFbsDevice::DoCmdSetCustomPaletteL(const TDesC& aSection)
+ {
+ CPalette* palette= NULL;
+
+ if ( !CT_GraphicsUtil::GetPaletteL(*this, aSection, KFldPalette(), palette) )
+ {
+ INFO_PRINTF1(_L("execute SetCustomPalette(NULL)"));
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetCustomPalette(const CPalette*)"));
+ }
+
+ TInt err = GetFbsDevice()->SetCustomPalette(palette);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataFbsDevice::DoCmdGraphicsAccelerator()
+ {
+ CGraphicsAccelerator* ga= NULL;
+ INFO_PRINTF1(_L("execute GraphicsAccelerator()"));
+ ga = GetFbsDevice()->GraphicsAccelerator();
+ if (ga != NULL)
+ {
+ INFO_PRINTF1(_L("GraphicsAccelerator Supported"));
+ }
+ else
+ {
+ INFO_PRINTF1(_L("GraphicsAccelerator Not Supported"));
+ }
+ }
+
+void CT_DataFbsDevice::DoCmdOrientation(const TDesC& aSection)
+ {
+ CFbsBitGc::TGraphicsOrientation actual = GetFbsDevice()->Orientation();
+ INFO_PRINTF2(_L("execute Orientation()=%d"), actual);
+
+ CFbsBitGc::TGraphicsOrientation expected;
+ if (!CT_GraphicsUtil::GetGraphicsOrientation(*this, aSection, KFldExpectedOrientation, expected))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpectedOrientation);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if (actual != expected)
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataFbsDevice::DoCmdDisplayMode16M(const TDesC& aSection)
+ {
+ TDisplayMode actual = GetFbsDevice()->DisplayMode16M();
+ INFO_PRINTF2(_L("execute DisplayMode16M()=%d"), actual);
+
+ // get display mode from parameters
+ TDisplayMode expected;
+ if (CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldExpectedDisplayMode(), expected) )
+ {
+ if (actual != expected)
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataFbsDevice::DoCmdSetScalingFactor(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+ TPoint point;
+
+ if ( !GetPointFromConfig(aSection, KFldOrigin, point) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldOrigin);
+ SetBlockResult(EFail);
+ }
+
+ TInt factorX;
+ if ( !GetIntFromConfig(aSection, KFldFactorX, factorX) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFactorX);
+ SetBlockResult(EFail);
+ }
+
+ TInt factorY;
+ if ( !GetIntFromConfig(aSection, KFldFactorY, factorY) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFactorY);
+ SetBlockResult(EFail);
+ }
+
+ TInt divisorX;
+ if ( !GetIntFromConfig(aSection, KFldDivisorX, divisorX) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDivisorX);
+ SetBlockResult(EFail);
+ }
+
+ TInt divisorY;
+ if ( !GetIntFromConfig(aSection, KFldDivisorY, divisorY) )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDivisorY);
+ SetBlockResult(EFail);
+ }
+
+ if (dataOk)
+ {
+ INFO_PRINTF1(_L("execute SetScalingFactor(const TPoint&, TInt, TInt, TInt, TInt)"));
+ TInt err = GetFbsDevice()->SetScalingFactor(point, factorX, factorY, divisorX, divisorY);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataFbsDevice::DoCmdGetDrawRect(const TDesC& aSection)
+ {
+ TRect actual;
+
+ INFO_PRINTF1(_L("execute GetDrawRect(TRect&)"));
+ GetFbsDevice()->GetDrawRect(actual);
+ INFO_PRINTF5(_L("DrawRect = (top.x=%d, top.y=%d, bottom.x=%d, bottom.y=%d)"), actual.iTl.iX, actual.iTl.iY, actual.iBr.iX, actual.iBr.iY);
+
+ TRect expected;
+ if ( GetRectFromConfig(aSection, KFldExpectedDrawRect, expected) )
+ {
+ if (actual != expected)
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataFbsDevice::DoCmdRegisterLinkedTypefaceL(const TDesC& aSection)
+ {
+ CLinkedTypefaceSpecification* spec = NULL;
+ if (!CT_GraphicsUtil::GetLinkedTypefaceSpecificationL(*this, aSection, KFldLinkedTypefaceSpec, spec))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldLinkedTypefaceSpec);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TInt actual;
+ INFO_PRINTF1(_L("execute RegisterLinkedTypeface(const CLinkedTypefaceSpecification&, TInt&)"));
+ TInt err = GetFbsDevice()->RegisterLinkedTypeface(*spec, actual);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ return;
+ }
+
+ TInt expected;
+ if (GetIntFromConfig(aSection, KFldExpectedUid, expected))
+ {
+ if (actual != expected)
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/src/T_DataFbsScreenDevice.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,495 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+// User includes
+#include "T_DataFbsScreenDevice.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdNewL, "NewL");
+_LIT(KCmdDestructor, "~");
+
+_LIT(KCmdChangeScreenDevice, "ChangeScreenDevice");
+_LIT(KCmdDrawSpriteBegin, "DrawSpriteBegin");
+_LIT(KCmdDrawSpriteEnd, "DrawSpriteEnd");
+_LIT(KCmdHardwareBitmap, "HardwareBitmap");
+_LIT(KCmdScreenNo, "ScreenNo");
+_LIT(KCmdSetAutoUpdate, "SetAutoUpdate");
+_LIT(KCmdUpdate, "Update");
+_LIT(KCmdCancelSprite, "CancelSprite");
+_LIT(KCmdHideSprite, "HideSprite");
+_LIT(KCmdShowSprite, "ShowSprite");
+
+_LIT(KCmdDisown, "disown");
+
+//Fields
+_LIT(KFldExpected, "expected");
+_LIT(KLibName, "libname");
+_LIT(KScreenNumber, "screen_number");
+_LIT(KRgbColorRed, "rgb_red");
+_LIT(KRgbColorGreen, "rgb_green");
+_LIT(KRgbColorBlue, "rgb_blue");
+_LIT(KDisplayMode, "displaymode");
+_LIT(KAutoUpdate, "autoupdate");
+_LIT(KRegion, "region");
+_LIT(KFbsScreenDevice, "FbsScrDevName");
+_LIT(KFldRect, "rect");
+_LIT(KFldRegion, "region");
+_LIT(KSpriteBase, "spritebase");
+
+//Logging
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+
+/*@}*/
+/**
+* Two phase constructor
+*/
+CT_DataFbsScreenDevice* CT_DataFbsScreenDevice::NewL()
+ {
+ CT_DataFbsScreenDevice* ret = new (ELeave) CT_DataFbsScreenDevice();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataFbsScreenDevice::CT_DataFbsScreenDevice()
+: CT_DataFbsDevice()
+, iFbsScreenDevice(NULL)
+ {
+ }
+
+/**
+* Protected second phase construction
+*/
+void CT_DataFbsScreenDevice::ConstructL()
+ {
+ }
+
+/**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+void CT_DataFbsScreenDevice::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iFbsScreenDevice = static_cast<CFbsScreenDevice*> (aAny);
+ }
+
+void CT_DataFbsScreenDevice::DisownObjectL()
+ {
+ iFbsScreenDevice = NULL;
+ }
+
+/**
+* Destructor.
+*/
+CT_DataFbsScreenDevice::~CT_DataFbsScreenDevice()
+ {
+ DestroyData();
+ }
+
+void CT_DataFbsScreenDevice::DestroyData()
+ {
+ delete iFbsScreenDevice;
+ iFbsScreenDevice=NULL;
+ }
+
+MGraphicsDeviceMap* CT_DataFbsScreenDevice::GetGraphicsDeviceMap() const
+ {
+ return iFbsScreenDevice;
+ }
+
+CGraphicsDevice* CT_DataFbsScreenDevice::GetGraphicsDevice() const
+ {
+ return iFbsScreenDevice;
+ }
+
+CBitmapDevice* CT_DataFbsScreenDevice::GetBitmapDevice() const
+ {
+ return iFbsScreenDevice;
+ }
+
+CFbsDevice* CT_DataFbsScreenDevice::GetFbsDevice() const
+ {
+ return iFbsScreenDevice;
+ }
+
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataFbsScreenDevice::GetObject()
+ {
+ return iFbsScreenDevice;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsScreenDevice::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ /* Another work package will complete the implement of this */
+ TBool retVal = ETrue;
+
+ if ( aCommand == KCmdNewL )
+ {
+ DoCmdNew(aSection);
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DoCmdDestructor();
+ }
+ else if (aCommand == KCmdChangeScreenDevice)
+ {
+ DoCmdChangeScreenDeviceL(aSection);
+ }
+ else if (aCommand == KCmdDrawSpriteBegin)
+ {
+ DoCmdDrawSpriteBegin();
+ }
+ else if (aCommand == KCmdDrawSpriteEnd)
+ {
+ DoCmdDrawSpriteEnd();
+ }
+ else if (aCommand == KCmdHardwareBitmap)
+ {
+ DoCmdHardwareBitmap();
+ }
+ else if (aCommand == KCmdScreenNo)
+ {
+ DoCmdScreenNo(aSection);
+ }
+ else if (aCommand == KCmdSetAutoUpdate)
+ {
+ DoCmdSetAutoUpdate(aSection);
+ }
+ else if (aCommand == KCmdUpdate)
+ {
+ DoCmdUpdateL(aSection);
+ }
+ else if (aCommand == KCmdCancelSprite)
+ {
+ DoCmdCancelSprite();
+ }
+ else if (aCommand == KCmdHideSprite)
+ {
+ DoCmdHideSpriteL(aSection);
+ }
+ else if (aCommand == KCmdShowSprite)
+ {
+ DoCmdShowSpriteL(aSection);
+ }
+ else if (aCommand == KCmdDisown)
+ {
+ DisownObjectL();
+ }
+ else
+ {
+ retVal = CT_DataFbsDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return retVal;
+ }
+
+void CT_DataFbsScreenDevice::DoCmdNew(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // get display mode from parameters
+ TDisplayMode displayMode=ENone;
+ TBool hasDisplayMode=CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), displayMode);
+
+ // get lib name from parameters
+
+ TPtrC libName;
+ TBool hasLibName=GetStringFromConfig(aSection, KLibName(), libName);
+
+ TBool useRgb = EFalse;
+
+ TInt red = 0;
+ if(GetIntFromConfig(aSection, KRgbColorRed(), red))
+ {
+ useRgb=ETrue;
+ }
+
+ TInt green = 0;
+ if(GetIntFromConfig(aSection, KRgbColorGreen(), green))
+ {
+ useRgb=ETrue;
+ }
+
+ TInt blue = 0;
+ if(GetIntFromConfig(aSection, KRgbColorBlue(), blue))
+ {
+ useRgb = ETrue;
+ }
+
+ // get screen number from parameters
+ TInt screenNumber = 0;
+ GetIntFromConfig(aSection, KScreenNumber(), screenNumber);
+
+ TInt err=KErrNone;
+ if ( !hasDisplayMode )
+ {
+ // Find the best display mode
+ for ( TDisplayMode testMode=TDisplayMode(ENone+1); testMode<EColorLast; testMode=TDisplayMode(testMode+1) )
+ {
+ if ( hasLibName ) // if lib name is given
+ {
+ if ( useRgb )
+ {
+ TRAP(err, iFbsScreenDevice=CFbsScreenDevice::NewL(libName, testMode, TRgb(red, green, blue)));
+ }
+ else
+ {
+ TRAP(err, iFbsScreenDevice=CFbsScreenDevice::NewL(libName, testMode));
+ }
+ }
+ else // if lib name is not given
+ {
+ TRAP(err, iFbsScreenDevice=CFbsScreenDevice::NewL(screenNumber, testMode));
+ }
+
+ // Test if Mode OK
+ if ( err==KErrNone )
+ {
+ displayMode=testMode;
+ hasDisplayMode=ETrue;
+ delete iFbsScreenDevice;
+ iFbsScreenDevice=NULL;
+ INFO_PRINTF2(_L("Mode %d supported"), testMode);
+ }
+ }
+ }
+
+ if ( hasDisplayMode )
+ {
+ if ( hasLibName ) // if lib name is given
+ {
+ if ( useRgb )
+ {
+ TRAP(err, iFbsScreenDevice=CFbsScreenDevice::NewL(libName, displayMode, TRgb(red, green, blue)));
+ }
+ else
+ {
+ TRAP(err, iFbsScreenDevice=CFbsScreenDevice::NewL(libName, displayMode));
+ }
+ }
+ else // if lib name is not given
+ {
+ TRAP(err, iFbsScreenDevice=CFbsScreenDevice::NewL(screenNumber, displayMode));
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("NewL failed with error %d"), err);
+ SetError(err);
+ }
+ }
+ else
+ {
+ ERR_PRINTF1(_L("No Display Mode"));
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataFbsScreenDevice::DoCmdDestructor()
+ {
+ DestroyData();
+ }
+
+void CT_DataFbsScreenDevice::DoCmdChangeScreenDeviceL(const TDesC& aSection)
+ {
+ TPtrC FbsScreenDevNameOld;
+ CFbsScreenDevice* FbsScreenDevOld = NULL;
+
+ if (GetStringFromConfig(aSection, KFbsScreenDevice, FbsScreenDevNameOld))
+ {
+ FbsScreenDevOld = static_cast<CFbsScreenDevice*>(GetDataObjectL(FbsScreenDevNameOld));
+ INFO_PRINTF1(_L("FbsScreenDevice::ChangeScreenDevice(CFbsScreenDevice *aOldDevice) is called!"));
+ iFbsScreenDevice->ChangeScreenDevice(FbsScreenDevOld);
+ }
+ else
+ {
+ INFO_PRINTF2(KLogMissingParameter, &KFbsScreenDevice);
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataFbsScreenDevice::DoCmdDrawSpriteBegin()
+ {
+ INFO_PRINTF1(_L("FbsScreenDevice::DrawSpriteBegin() is called!"));
+ iFbsScreenDevice->DrawSpriteBegin();
+ }
+
+void CT_DataFbsScreenDevice::DoCmdDrawSpriteEnd()
+ {
+ INFO_PRINTF1(_L("FbsScreenDevice::DrawSpriteEnd() is called!"));
+ iFbsScreenDevice->DrawSpriteEnd();
+ }
+
+void CT_DataFbsScreenDevice::DoCmdHardwareBitmap()
+ {
+ INFO_PRINTF1(_L("FbsScreenDevice::HardwareBitmap() is called!"));
+ RHardwareBitmap handle = iFbsScreenDevice->HardwareBitmap();
+ INFO_PRINTF2(_L("The actual handle from HardwareBitmap() is %d"), handle.iHandle);
+ }
+
+void CT_DataFbsScreenDevice::DoCmdScreenNo(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("FbsScreenDevice::ScreenNo() is called!"));
+ TInt actual = iFbsScreenDevice->ScreenNo();
+ INFO_PRINTF2(_L("The actual result of ScreenNo() is %d"), actual);
+
+ // Diaplay command return value, check if it matches the expected value
+ TInt expected;
+ if (!GetIntFromConfig(aSection, KFldExpected, expected))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if (actual!=expected)
+ {
+ ERR_PRINTF3(_L("The expected result %d is not equal to the actual result %d!"), expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataFbsScreenDevice::DoCmdSetAutoUpdate(const TDesC& aSection)
+ {
+ TBool autoupdate;
+ if (!GetBoolFromConfig(aSection, KAutoUpdate, autoupdate))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KAutoUpdate);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iFbsScreenDevice->SetAutoUpdate(autoupdate);
+ INFO_PRINTF2(_L("FbsScreenDevice::SetAutoUpdate(%d) has been called."), autoupdate);
+ }
+ }
+
+void CT_DataFbsScreenDevice::DoCmdUpdateL(const TDesC& aSection)
+ {
+ RRegion region(1);
+ CleanupClosePushL(region);
+
+ if (GetRegionFromConfig(aSection, KRegion(), region))
+ {
+ INFO_PRINTF1(_L("FbsScreenDevice::Update(const TRegion &aRegion) has been called."));
+ iFbsScreenDevice->Update(region);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("FbsScreenDevice::Update() has been called."));
+ iFbsScreenDevice->Update();
+ }
+ CleanupStack::PopAndDestroy(®ion);
+ }
+
+void CT_DataFbsScreenDevice::DoCmdCancelSprite()
+ {
+ INFO_PRINTF1(_L("execute CancelSprite()!"));
+ iFbsScreenDevice->CancelSprite();
+ }
+
+void CT_DataFbsScreenDevice::DoCmdHideSpriteL(const TDesC& aSection)
+ {
+ TSpriteBase* spritebase = NULL;
+ TRect datRect;
+ RRegion datRegion(1);
+ CleanupClosePushL(datRegion);
+
+ if (GetRectFromConfig(aSection, KFldRect, datRect))
+ {
+ if (GetRegionFromConfig(aSection, KFldRegion, datRegion))
+ {
+ INFO_PRINTF1(_L("execute HideSprite(const TRect &aRect, const TRegion *aClippingRegion)!"));
+ spritebase = iFbsScreenDevice->HideSprite(datRect, &datRegion);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRegion);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute HideSprite(void)!"));
+ spritebase = iFbsScreenDevice->HideSprite();
+ }
+
+ CleanupStack::PopAndDestroy(&datRegion);
+ }
+
+
+void CT_DataFbsScreenDevice::DoCmdShowSpriteL(const TDesC& aSection)
+ {
+ TSpriteBase* spritebase = NULL;
+ TPtrC SpriteBase;
+ TRect datRect;
+ RRegion datRegion(1);
+ CleanupClosePushL(datRegion);
+
+ if (GetStringFromConfig(aSection, KSpriteBase, SpriteBase))
+ {
+ spritebase = static_cast<TSpriteBase*>(GetDataObjectL(SpriteBase));
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSpriteBase);
+ SetBlockResult(EFail);
+ }
+
+ if (GetRectFromConfig(aSection, KFldRect, datRect))
+ {
+ if (GetRegionFromConfig(aSection, KFldRegion, datRegion))
+ {
+ INFO_PRINTF1(_L("execute ShowSprite(TSpriteBase*, const TRect&, const TRegion*)!"));
+ iFbsScreenDevice->ShowSprite(spritebase, datRect, &datRegion);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRegion);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute ShowSprite(TSpriteBase*)!"));
+ iFbsScreenDevice->ShowSprite(spritebase);
+ }
+ CleanupStack::PopAndDestroy(&datRegion);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/src/T_DataPolygonFiller.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,316 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "T_DataPolygonFiller.h"
+#include "T_GraphicsUtil.h"
+
+_LIT(KDataClassname, "CPolygonFiller");
+
+/// Fields
+_LIT(KFldScanLine, "scanline");
+_LIT(KFldPointList, "pointlist");
+_LIT(KFldFillRule, "fillrule");
+_LIT(KFldUsage, "usage");
+_LIT(KFldnumPoints, "numpoints");
+_LIT(KFldExpectedScanLine, "expectedscanline");
+_LIT(KFldExpectedStart, "expectedstart");
+_LIT(KFldExpectedEnd, "expectedend");
+_LIT(KFldExpectedExists, "expectedexists");
+/// Commands
+_LIT(KCmdnewL, "new");
+_LIT(KCmdConstructL, "Construct");
+_LIT(KCmdDestructorGeneral, "~");
+_LIT(KCmdDestructor, "~CPolygonFiller");
+_LIT(KCmdReset, "Reset");
+_LIT(KCmdGetNextPixelRun, "GetNextPixelRun");
+_LIT(KCmdGetNextPixelRunOnSpecifiedScanLine, "GetNextPixelRunOnSpecifiedScanLine");
+
+//Log
+_LIT(KLogErrNum, "Error=%d");
+_LIT(KLogInfoCmdnewL, "execute new CPolygonFiller()");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogInfoCmdDestructor1, "execute ~CPolygonFiller()");
+_LIT(KLogInfoCmdConstruct1, "execute Construct(TPoint*, TInt, TFillRule,TUsage)");
+_LIT(KLogInfoCmdConstruct2, "execute Construct(CArrayFix<TPoint>*, TFillRule,TUsage)");
+_LIT(KLogInfoCmdReset, "execute Reset()");
+_LIT(KLogInfoCmdGetNextPixelRun, "execute GetNextPixelRun()");
+_LIT(KLogInfoCmdGetNextPixelRunOnSpecifiedScanLine, "execute GetNextPixelRunOnSpecifiedScanLine()");
+_LIT(KLogInfoNotCheckThePosition, "Won't check the position on the scan line in the test case");
+CT_DataPolygonFiller* CT_DataPolygonFiller::NewL()
+ {
+ CT_DataPolygonFiller* ret = new (ELeave) CT_DataPolygonFiller();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataPolygonFiller::CT_DataPolygonFiller()
+: iPolygonFiller(NULL)
+ {
+ }
+
+void CT_DataPolygonFiller::ConstructL()
+ {
+ iPointsArray=NULL;
+ iPoints=NULL;
+ }
+
+CT_DataPolygonFiller::~CT_DataPolygonFiller()
+ {
+ DestroyData();
+
+ delete iPointsArray;
+ iPointsArray=NULL;
+
+ delete[] iPoints;
+ iPoints=NULL;
+ }
+
+TAny* CT_DataPolygonFiller::GetObject()
+ {
+ return iPolygonFiller;
+ }
+
+void CT_DataPolygonFiller::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iPolygonFiller = static_cast<CPolygonFiller*> (aAny);
+ }
+
+void CT_DataPolygonFiller::DisownObjectL()
+ {
+ iPolygonFiller = NULL;
+ }
+
+void CT_DataPolygonFiller::DestroyData()
+ {
+ DoCmdDestructor();
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @return ETrue if the command is processed
+*/
+TBool CT_DataPolygonFiller::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructorGeneral || aCommand==KCmdDestructor )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdnewL || aCommand==KDataClassname )
+ {
+ DoCmdnewL();
+ }
+ else if(aCommand==KCmdConstructL)
+ {
+ DoCmdConstructL(aSection);
+ }
+ else if ( aCommand==KCmdReset )
+ {
+ DoCmdReset();
+ }
+ else if ( aCommand==KCmdGetNextPixelRun )
+ {
+ DoCmdGetNextPixelRun(aSection);
+ }
+ else if ( aCommand==KCmdGetNextPixelRunOnSpecifiedScanLine )
+ {
+ DoCmdGetNextPixelRunOnSpecifiedScanLine(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ return ret;
+ }
+
+void CT_DataPolygonFiller::DoCmdnewL()
+ {
+ DestroyData();
+ TInt err = KErrNone;
+ INFO_PRINTF1(KLogInfoCmdnewL);
+ TRAP(err, iPolygonFiller = new (ELeave) CPolygonFiller());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogErrNum, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataPolygonFiller::DoCmdConstructL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TInt datNumPoints=0;
+ TInt err=0;
+ CGraphicsContext::TFillRule datFillRule=CGraphicsContext::EAlternate;
+ CPolygonFiller::TUsage datUsage=CPolygonFiller::EGetAllPixelRunsSequentially;
+
+ CT_GraphicsUtil::ReadFillRule(*this, aSection, KFldFillRule, datFillRule);
+ CT_GraphicsUtil::ReadTUsage(*this,aSection,KFldUsage,datUsage);
+
+//Use TPoint parameter to construct if the number of points in the list is assigned.
+ if (GetIntFromConfig(aSection, KFldnumPoints, datNumPoints))
+ {
+ iPoints=new (ELeave) TPoint[datNumPoints];
+ if ( !GetPointListFromConfig(aSection, KFldPointList, datNumPoints, iPoints))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogInfoCmdConstruct1);
+ iPolygonFiller->Construct(iPoints, datNumPoints, datFillRule, datUsage);
+ }
+ }
+ else
+ {
+ iPointsArray=new (ELeave) CArrayFixFlat<TPoint>(1);
+ TBool hasPointList=GetPointListFromConfigL(aSection, KFldPointList, *iPointsArray);
+
+ if ( !hasPointList )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogInfoCmdConstruct2);
+ iPolygonFiller->Construct(iPointsArray,datFillRule,datUsage);
+ }
+ }
+ }
+
+void CT_DataPolygonFiller::DoCmdDestructor()
+ {
+ INFO_PRINTF1(KLogInfoCmdDestructor1);
+ delete iPolygonFiller;
+ iPolygonFiller = NULL;
+ }
+
+void CT_DataPolygonFiller::DoCmdReset()
+ {
+ INFO_PRINTF1(KLogInfoCmdReset);
+ iPolygonFiller->Reset();
+ }
+
+void CT_DataPolygonFiller::DoCmdGetNextPixelRun(const TDesC& aSection)
+ {
+ TBool relExists,expectedExists;
+ TInt relScanLine,relStart,relEnd,expectedScanLine,expectedStart,expectedEnd;
+ INFO_PRINTF1(KLogInfoCmdGetNextPixelRun);
+ iPolygonFiller->GetNextPixelRun(relExists,relScanLine,relStart,relEnd);
+ //Verify the scanline is expected
+ if(!GetBoolFromConfig(aSection,KFldExpectedExists,expectedExists))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpectedExists);
+ SetBlockResult(EFail);
+ }
+ else if(relExists!=expectedExists)
+ {
+ ERR_PRINTF3(_L("The returned Exists value is not as expected, expected: %d, result: %d"), expectedExists , relExists);
+ SetBlockResult(EFail);
+ }
+ if(!GetIntFromConfig(aSection,KFldExpectedScanLine,expectedScanLine))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpectedScanLine);
+ SetBlockResult(EFail);
+ }
+ else if(relScanLine!=expectedScanLine)
+ {
+ ERR_PRINTF3(_L("The returned Scanline value is not as expected, expected: %d, result: %d"), expectedScanLine , relScanLine);
+ SetBlockResult(EFail);
+ }
+ //Verify the start position on the scan line
+ if(!GetIntFromConfig(aSection,KFldExpectedStart,expectedStart))
+ {
+ INFO_PRINTF1(KLogInfoNotCheckThePosition);
+
+ }
+ else if(relStart!=expectedStart)
+ {
+ ERR_PRINTF3(_L("The returned Start Position value is not as expected, expected: %d, result: %d"), expectedStart , relStart);
+ SetBlockResult(EFail);
+ }
+ //Verify the end position on the scan line
+ if(!GetIntFromConfig(aSection,KFldExpectedEnd,expectedEnd))
+ {
+ INFO_PRINTF1(KLogInfoNotCheckThePosition);
+
+ }
+ else if(relEnd!=expectedEnd)
+ {
+ ERR_PRINTF3(_L("The returned End Position value is not as expected, expected: %d, result: %d"), expectedEnd , relEnd);
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataPolygonFiller::DoCmdGetNextPixelRunOnSpecifiedScanLine(const TDesC& aSection)
+ {
+ TInt datScanLine=0;
+ TBool relExists,expectedExists;
+ TInt relStart,relEnd,expectedStart,expectedEnd;
+
+ if (!GetIntFromConfig(aSection, KFldScanLine, datScanLine))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldScanLine);
+ SetBlockResult(EFail);
+ }
+ INFO_PRINTF1(KLogInfoCmdGetNextPixelRunOnSpecifiedScanLine);
+ iPolygonFiller->GetNextPixelRunOnSpecifiedScanLine(relExists,datScanLine,relStart,relEnd);
+ if(!GetBoolFromConfig(aSection,KFldExpectedExists,expectedExists))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpectedExists);
+ SetBlockResult(EFail);
+ }
+ else if(relExists!=expectedExists)
+ {
+ ERR_PRINTF3(_L("The returned Exists value is not as expected, expected: %d, result: %d"), expectedExists , relExists);
+ SetBlockResult(EFail);
+ }
+ //Verify the start position on the scan line
+ if(!GetIntFromConfig(aSection,KFldExpectedStart,expectedStart))
+ {
+ INFO_PRINTF1(KLogInfoNotCheckThePosition);
+
+ }
+ else if(relStart!=expectedStart)
+ {
+ ERR_PRINTF3(_L("The returned Start Position value is not as expected, expected: %d, result: %d"), expectedStart , relStart);
+ SetBlockResult(EFail);
+ }
+ //Verify the end position on the scan line
+ if(!GetIntFromConfig(aSection,KFldExpectedEnd,expectedEnd))
+ {
+ INFO_PRINTF1(KLogInfoNotCheckThePosition);
+
+ }
+ else if(relEnd!=expectedEnd)
+ {
+ ERR_PRINTF3(_L("The returned End Position value is not as expected, expected: %d, result: %d"), expectedEnd , relEnd);
+ SetBlockResult(EFail);
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/src/T_GraphicsBitgdiAPIServer.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,245 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// The main entry point for the TEF Server T_GraphicsBitgdiAPIServer.exe
+
+// User Includes
+#include "T_GraphicsBitgdiAPIServer.h"
+#include "T_DataBitmapUtil.h"
+#include "T_DataFbsBitmap.h"
+#include "T_DataWsBitmap.h"
+#include "T_DataFbsBitmapDevice.h"
+#include "T_DataFbsScreenDevice.h"
+#include "T_DataAlgStyle.h"
+#include "T_DataFbsBitGc.h"
+#include "T_DataFbsSession.h"
+#include "T_DataWsSession.h"
+#include "T_DataPalette.h"
+#include "T_DataPolygonFiller.h"
+#include "T_DataFbsFont.h"
+#include "T_DataFbsTypefaceStore.h"
+#include "T_DataWsScreenDevice.h"
+#include "T_DataFbsBitGcBitmap.h"
+#include "T_DataFbsBitGcFont.h"
+#include "T_DataLinkedTypefaceSpecification.h"
+
+// EPOC Includes
+#include <rsshared.h>
+
+/**
+ * @enum Constant Literals used.
+ */
+/*@{*/
+// Graphics BITGDI API
+_LIT(KDataFbsBitGc, "CFbsBitGc");
+_LIT(KDataPolygonFiller, "CPolygonFiller");
+
+//from T_FBServAPI
+_LIT(KRFbsSessionData, "RFbsSession");
+_LIT(KCFbsFontData, "CFbsFont");
+_LIT(KCFbsBitmapData, "CFbsBitmap");
+_LIT(KCWsBitmapData, "CWsBitmap");
+_LIT(KTBitmapUtilData, "TBitmapUtil");
+_LIT(KCFbsTypefaceStoreData, "CFbsTypefaceStore");
+_LIT(KCFbsColor256BitmapUtil, "CFbsColor256BitmapUtil");
+_LIT(KCPalette, "CPalette");
+_LIT(KCFbsBitmapDevice, "CFbsBitmapDevice");
+_LIT(KCFbsScreenDevice, "CFbsScreenDevice");
+_LIT(KTAlgStyle, "TAlgStyle");
+_LIT(KTMeasureTextInput, "TMeasureTextInput");
+_LIT(KTMeasureTextOutput, "TMeasureTextOutput");
+_LIT(KRWsSession, "RWsSession");
+_LIT(KCWsScreenDevice, "CWsScreenDevice");
+_LIT(KCFbsBitGcBitmap, "CFbsBitGcBitmap");
+_LIT(KCFbsBitGcFont, "CFbsBitGcFont");
+
+//from T_GraphicsFntstoreAPI
+_LIT(KCLinkedTypefaceSpecification, "CLinkedTypefaceSpecification");
+
+/*@}*/
+
+
+inline CDataWrapper* CT_GraphicsBitgdiAPIServer::CT_GraphicsBitgdiAPIBlock::CreateDataL( const TDesC& aData )
+ {
+ CDataWrapper* wrapper = NULL;
+
+ if ( aData==KRFbsSessionData )
+ {
+ wrapper=CT_DataFbsSession::NewL();
+ }
+ else if ( aData==KCFbsScreenDevice )
+ {
+ wrapper=CT_DataFbsScreenDevice::NewL();
+ }
+ else if ( aData==KDataFbsBitGc )
+ {
+ wrapper=CT_DataFbsBitGc::NewL();
+ }
+ else if ( aData==KCPalette )
+ {
+ wrapper=CT_DataPalette::NewL();
+ }
+ else if (aData==KDataPolygonFiller)
+ {
+ wrapper=CT_DataPolygonFiller::NewL();
+ }
+ else if (aData == KCFbsFontData)
+ {
+ wrapper=CT_DataFbsFont::NewL();
+ }
+ else if (aData==KCFbsBitmapData)
+ {
+ wrapper=CT_DataFbsBitmap::NewL();
+ }
+ else if (aData==KCWsBitmapData)
+ {
+ wrapper=CT_DataWsBitmap::NewL();
+ }
+ else if (aData==KRWsSession)
+ {
+ wrapper=CT_DataWsSession::NewL();
+ }
+ else if (aData==KCFbsTypefaceStoreData)
+ {
+ wrapper=CT_DataFbsTypefaceStore::NewL();
+ }
+ else if (aData==KCWsScreenDevice)
+ {
+ wrapper=CT_DataWsScreenDevice::NewL();
+ }
+ else if (aData==KCFbsBitmapDevice)
+ {
+ wrapper=CT_DataFbsBitmapDevice::NewL();
+ }
+ else if (aData==KCFbsBitGcBitmap)
+ {
+ wrapper=CT_DataFbsBitGcBitmap::NewL();
+ }
+ else if (aData==KCFbsBitGcFont)
+ {
+ wrapper=CT_DataFbsBitGcFont::NewL();
+ }
+ // from fontstore
+ else if (aData==KTAlgStyle)
+ {
+ wrapper=CT_DataAlgStyle::NewL();
+ }
+ else if (aData==KCLinkedTypefaceSpecification)
+ {
+ wrapper=CT_DataLinkedTypefaceSpecification::NewL();
+ }
+ return wrapper;
+ }
+
+CT_GraphicsBitgdiAPIServer* CT_GraphicsBitgdiAPIServer::NewL()
+/**
+ * @return - Instance of the test server
+ * Same code for Secure and non-secure variants
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+ {
+ CT_GraphicsBitgdiAPIServer* server = new (ELeave) CT_GraphicsBitgdiAPIServer();
+ CleanupStack::PushL(server);
+ // CServer base class call
+ server->ConstructL(); /*Parsing the server name from the file name*/
+ CleanupStack::Pop(server);
+ return server;
+ }
+
+
+TInt LoadDrivers()
+ {
+#ifdef __WINS__
+ #define KPDDName _L("ECDRV")
+ #define KLDDName _L("ECOMM")
+#else
+ #define KPDDName _L("EUART1")
+ #define KLDDName _L("ECOMM")
+#endif
+ TInt rerr = KErrNone;
+
+ rerr = StartC32();
+ if( rerr!=KErrNone && rerr!=KErrAlreadyExists )
+ {
+ return rerr;
+ }
+
+ rerr = User::LoadPhysicalDevice(KPDDName);
+ if(rerr != KErrNone && rerr != KErrAlreadyExists)
+ {
+ return rerr;
+ }
+ rerr = User::LoadLogicalDevice(KLDDName);
+ if(rerr != KErrNone && rerr != KErrAlreadyExists)
+ {
+ return rerr;
+ }
+ return KErrNone;
+ }
+
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+ {
+#if (defined __DATA_CAGING__)
+ RProcess().DataCaging(RProcess::EDataCagingOn);
+ RProcess().SecureApi(RProcess::ESecureApiOn);
+#endif
+ CActiveScheduler* sched=NULL;
+ sched=new(ELeave) CActiveScheduler;
+ CActiveScheduler::Install(sched);
+ CT_GraphicsBitgdiAPIServer* server = NULL;
+ // Create the CTestServer derived server
+ TRAPD(err,server = CT_GraphicsBitgdiAPIServer::NewL());
+ if(!err)
+ {
+ // Sync with the client and enter the active scheduler
+ RProcess::Rendezvous(KErrNone);
+ sched->Start();
+ }
+ delete server;
+ delete sched;
+ }
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+ {
+ TInt rerr = LoadDrivers();
+ if( rerr != KErrNone )
+ {
+ return rerr;
+ }
+
+ __UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ if(cleanup == NULL)
+ {
+ return KErrNoMemory;
+ }
+#if (defined TRAP_IGNORE)
+ TRAP_IGNORE(MainL());
+#else
+ TRAPD(err,MainL());
+#endif
+ delete cleanup;
+ __UHEAP_MARKEND;
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/bitgdi/src/t_prompt.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32std.h>
+#include <e32property.h>
+
+/*@{*/
+const TInt KDefaultInterval = 20000000;
+const TUid KMyPropertyCat = {0x10012345};
+
+_LIT(KPromptConsole, "Manual Check");
+/*@}*/
+
+LOCAL_C void MainL()
+ {
+ TInt argLen = User::CommandLineLength();
+ HBufC* hBuf = HBufC::NewLC(argLen);
+ TPtr tPtr = hBuf->Des();
+ User::CommandLine(tPtr);
+ CConsoleBase* console = Console::NewL(KPromptConsole, TSize(KConsFullScreen, KConsFullScreen));
+ CleanupStack::PushL(console);
+ console->Printf(KPromptConsole);
+ console->Printf(_L("\n\n\n\n\n"));
+ console->Printf(tPtr);
+
+ RTimer timer;
+ CleanupClosePushL(timer);
+ timer.CreateLocal();
+ TRequestStatus timerStatus;
+ timer.After(timerStatus, TTimeIntervalMicroSeconds32(KDefaultInterval));
+ TRequestStatus readStatus;
+ console->Read(readStatus);
+ User::WaitForRequest(timerStatus, readStatus);
+
+ TKeyCode keycode(EKeyNull);
+ if(timerStatus != KErrNone)
+ {
+ if(readStatus == KErrNone)
+ {
+ keycode = console->KeyCode();
+ }
+ timer.Cancel();
+ }
+
+ if(readStatus == KRequestPending)
+ {
+ console->ReadCancel();
+ }
+
+ RProperty property;
+ CleanupClosePushL(property);
+ User::LeaveIfError( property.Attach(KMyPropertyCat, 1) );
+ User::LeaveIfError( property.Set((TInt)keycode) );
+ //property.Close();
+ CleanupStack::PopAndDestroy(4, hBuf); // &property, &timer, console, hBuf
+ }
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+ {
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ if(cleanup == NULL)
+ {
+ RProcess::Rendezvous(KErrNoMemory);
+ return KErrNoMemory;
+ }
+#if (defined TRAP_IGNORE)
+ TRAP_IGNORE(MainL());
+ RProcess::Rendezvous(KErrNone);
+#else
+ TRAPD(err,MainL());
+ RProcess::Rendezvous(err);
+#endif
+ delete cleanup;
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/inc/DataWrapperActive.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __DATA_WRAPPER_ACTIVE__)
+#define __DATA_WRAPPER_ACTIVE__
+
+// User includes
+#include "DataWrapperBase.h"
+
+class CDataWrapperActive : public CDataWrapperBase
+ {
+protected:
+ CDataWrapperActive();
+ virtual ~CDataWrapperActive();
+
+ virtual CActive* GetActive() = NULL;
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+private:
+ void DoCmdCancel();
+ void DoCmdiStatus(const TDesC& aSection);
+ };
+
+#endif /* __DATA_WRAPPER_ACTIVE__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/inc/DataWrapperBase.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __DATA_WRAPPER_BASE__)
+#define __DATA_WRAPPER_BASE__
+
+// EPOC includes
+#include <datawrapper.h>
+#include <gdi.h>
+#include <w32std.h>
+
+class CDataWrapperBase : public CDataWrapper
+ {
+public:
+ TBool GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult);
+ TBool GetFontSpecFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TFontSpec& aResult);
+ TBool GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
+ TBool GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
+ TBool GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
+ TBool GetPointFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPoint& aResult);
+ TBool GetRectFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRect& aResult);
+ TBool GetRegionFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRegion& aResult);
+ TBool GetRgbFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRgb& aResult);
+ TBool GetSizeFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TSize& aResult);
+ TBool GetRgbListFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt aSize, TRgb*& aResult);
+ TBool GetPointListFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt aSize, TPoint*& aResult);
+ TBool GetPointListFromConfigL(const TDesC& aSectName, const TDesC& aKeyName, CArrayFix<TPoint>& aResult);
+ TBool GetWsGraphicIdFromConfigL(const TDesC& aSectName, const TDesC& aKeyName, TWsGraphicId& aResult);
+
+ TBool GetDateTimeFromConfig(const TDesC& aSectName, TDateTime& aResult);
+ void LogRegion(const TDesC& aMessage, const TRegion& aRegion);
+ void LogRect(const TDesC& aMessage, const TRect& aRect);
+
+ virtual void InitialiseL();
+
+ inline TInt GetHandle() const;
+ inline TInt GetIdentifier() const;
+ inline const TWsGraphicId& GetId();
+
+protected:
+ CDataWrapperBase();
+ virtual ~CDataWrapperBase();
+
+ inline RFs& FileServer();
+ inline void SetHandle(TInt aHandle);
+ inline void SetIdentifier(TInt aIdentifier);
+ inline void SetId(const TWsGraphicId&);
+protected:
+ TBool iGraphicsOrientation[4];
+private:
+ TBool GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
+
+private:
+ // Included ini files
+ RPointerArray<CIniData> iInclude;
+ RPointerArray<HBufC> iBuffer;
+ RFs iFs;
+ TInt iHandle;
+ TInt iIdentifier;
+ TWsGraphicId iId;
+ };
+
+#include "DataWrapperBase.inl"
+
+#endif /* __DATA_WRAPPER_BASE__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/inc/DataWrapperBase.inl Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+inline RFs& CDataWrapperBase::FileServer()
+ {
+ return iFs;
+ }
+
+inline TInt CDataWrapperBase::GetHandle() const
+ {
+ return iHandle;
+ }
+
+inline void CDataWrapperBase::SetHandle(TInt aHandle)
+ {
+ iHandle=aHandle;
+ }
+
+inline TInt CDataWrapperBase::GetIdentifier() const
+ {
+ return iIdentifier;
+ }
+
+inline void CDataWrapperBase::SetIdentifier(TInt aIdentifier)
+ {
+ iIdentifier=aIdentifier;
+ }
+
+const TWsGraphicId& CDataWrapperBase::GetId()
+ {
+ return iId;
+ }
+
+inline void CDataWrapperBase::SetId(const TWsGraphicId& aId)
+ {
+ iId.Set(aId.Uid());
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/inc/T_GraphicsUtil.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_UTIL_H__)
+#define __T_GRAPHICS_UTIL_H__
+
+// User includes
+#include "DataWrapperBase.h"
+
+// EPOC includes
+#include <gdi.h>
+#include <fntstore.h>
+#include <bitmap.h>
+#include <w32std.h>
+#include <icl/imagedata.h>
+#include <w32stdgraphic.h> // for TWsGraphicAnimation
+
+class CT_GraphicsUtil
+ {
+public:
+ static TBool ReadBitmapfileCompressionScheme(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TBitmapfileCompressionScheme& aCompressionScheme);
+ static TBool ReadBrushStyle(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TBrushStyle& aBrushStyle);
+ static TBool ReadCaptureFlags(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aCaptureFlags);
+ static TBool ReadComputeMode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RWsSession::TComputeMode& aComputeMode);
+ static TBool ReadCornerType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TCornerType& aCornerType);
+ static TBool ReadDisplayMode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TDisplayMode& aDisplayMode);
+ static TBool ReadDrawMode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TDrawMode& aDrawMode);
+ static TBool ReadErrorCategory(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsErrorMessage::TErrorCategory& aErrorCategory);
+ static TBool ReadEventCode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TEventCode& aEventCode);
+ static TBool ReadEventControl(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TEventControl& aEventControl);
+ static TBool ReadEventModifier(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TEventModifier& aEventModifier);
+ static TBool ReadEventModifier(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aEventModifier);
+ static TBool ReadFadeControl(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RWindowTreeNode::TFadeControl& aFadeControl);
+ static TBool ReadFillRule(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TFillRule& aFillRule);
+ static TBool ReadFontStrikethrough(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TFontStrikethrough& aFontStrikethrough);
+ static TBool ReadFontUnderline(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TFontUnderline& aFontUnderline);
+ static TBool ReadGlyphBitmapType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TGlyphBitmapType& aGlyphBitmapType);
+ static TBool ReadGraphicsOrientation(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFbsBitGc::TGraphicsOrientation& aGraphicsOrientation);
+ static TBool ReadHotKey(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, THotKey& aHotKey);
+ static TBool ReadKeyCode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TKeyCode& aKeyCode);
+ static TBool ReadLoggingCommand(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RWsSession::TLoggingCommand& aLoggingCommand);
+ static TBool ReadModifierState(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TModifierState& aModifierState);
+ static TBool ReadPasswordMode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TPasswordMode& aPasswordMode);
+ static TBool ReadPenStyle(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TPenStyle& aPenStyle);
+ static TBool ReadPointerCursorMode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TPointerCursorMode& aPointerCursorMode);
+ static TBool ReadPointerFilter(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TPointerFilter& aPointerFilter);
+ static TBool ReadPointerFilter(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aPointerFilter);
+ //For MAnim
+ static TBool ReadAnimCommand(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TInt& aCommand);
+ static TBool ReadAnimType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TInt& aType);
+ static TBool ReadTUsage(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CPolygonFiller::TUsage& aUsage);
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+ static TBool ReadPriorities(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TInt& aPriorities);
+#endif
+ static TBool ReadPriority(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CActive::TPriority& aPriority);
+ static TBool ReadScreenModeEnforcement(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TScreenModeEnforcement& aScreenModeEnforcement);
+ static TBool ReadSpriteInCompare(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aSpriteInCompare);
+ static TBool ReadStdScanCode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TStdScanCode& aStdScanCode);
+ static TBool ReadTextAlign(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TTextAlign& aTextAlign);
+ static TBool ReadTextDirection(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFont::TTextDirection& aTextDirection);
+ static TBool ReadType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TPointerEvent::TType& aType);
+ static TBool ReadType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TRawEvent::TType& aType);
+ static TBool ReadWindowBackupType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aWindowBackupType);
+ static TBool ReadWsTransparencyPolicy(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsTransparencyPolicy& aWsTransparencyPolicy);
+ static TBool ReadWsVisibilityChangedEvent(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsVisibilityChangedEvent& aWsVisibilityChangedEvent);
+ static TBool ReadLongCaptureFlags(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TLongCaptureFlags& aLongCaptureFlags);
+ static TBool ReadSpriteFlags(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TSpriteFlags& aSpriteFlags);
+ static TBool ReadSpriteFlags(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aSpriteFlags);
+ static TBool ReadCustomTextCursorAlignment(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RWsSession::TCustomTextCursorAlignment& aAlignment);
+ static TBool ReadTypefaceSupport(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TTypefaceSupport& aTypefaceSupport);
+ static TBool GetAlgStyleL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TAlgStyle*& aData);
+ static TBool GetDrawableWindowL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RDrawableWindow*& aData);
+ static TBool GetDrawTextExtendedParamL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TDrawTextExtendedParam*& aData);
+ static TBool GetFbsBitmapL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFbsBitmap*& aData);
+ static TBool GetFbsDeviceL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFbsDevice*& aData);
+ static TBool GetFontL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFont*& aData);
+ static TBool GetPaletteL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CPalette*& aData);
+ static TBool GetWsBitmapL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CWsBitmap*& aData);
+ static TBool GetWsEventL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsEvent*& aData);
+ static TBool GetWsGraphicMsgBufL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RWsGraphicMsgBuf*& aData);
+ static TBool GetWsScreenDeviceL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CWsScreenDevice*& aData);
+ static TBool GetWsGraphicMsgFixedBaseL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsGraphicMsgFixedBase*& aData);
+ static TBool GetWsPriorityKeyEventL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsPriorityKeyEvent*& aData);
+ static TBool GetWsRedrawEventL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsRedrawEvent*& aData);
+ static TBool GetTextCursor(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TTextCursor& aTextCursor);
+ static TBool GetSpriteMemberL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TSpriteMember& aSpriteMember);
+ static TBool GetSpriteMemberListL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CArrayFix<TSpriteMember>& aResult);
+ static TBool BringAppForegroundL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aSessionKeyName , const TDesC& aAppKeyName);
+ static TBool ReadTerminateReason(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RDirectScreenAccess::TTerminationReasons& aReason);
+ static void EatupMemory(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName);
+ static void FreeEatenMemory(CDataWrapperBase& aDataWrapper);
+ static TBool GetFrameInfo(CDataWrapperBase& aDataWrapper,const TDesC& aSectName, TFrameInfo& frameinfo);
+ static TBool ReadFrameInfoFlags(CDataWrapperBase& aDataWrapper,const TDesC& aSectName, const TDesC& aKeyName,TUint32& aFlags);
+ static TBool GetFrameInfoState(CDataWrapperBase& aDataWrapper,const TDesC& aSectName, const TDesC& aKeyName,TFrameInfo::TFrameInfoState& aState);
+ static TBool GetWsGraphicAnimationL(CDataWrapperBase& aDataWrapper,const TDesC& aSectName, const TDesC& aKeyName, TWsGraphicAnimation*& aData);
+ static TBool StartAnimTesterClientL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName);
+ static TBool CloseAnimTesterClientL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName);
+ static TBool GetFbsBitGcL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFbsBitGc*& aData);
+ static TBool GetGraphicsOrientation(CDataWrapperBase& aDataWrapper,const TDesC& aSectName, const TDesC& aKeyName,CFbsBitGc::TGraphicsOrientation& aParam);
+ static TBool GetLinkedTypefaceSpecificationL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CLinkedTypefaceSpecification*& aData);
+ static TBool GetRasterizerL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, COpenFontRasterizer*& aData);
+ static TBool GetShaperFactoryL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CShaperFactory*& aData);
+ static TBool GetOpenFontGlyphDataL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TOpenFontGlyphData*& aData);
+
+private:
+ static TBool ConvertToCaptureFlags(const TDesC& aStr, RWindowBase::TCaptureFlags& aCaptureFlags);
+ static TBool ConvertToCaptureFlags(const TDesC& aStr, TUint& aCaptureFlags);
+
+ static TBool ConvertToEventModifier(const TDesC& aStr, TEventModifier& aEventModifier);
+ static TBool ConvertToEventModifier(const TDesC& aStr, TUint& aEventModifier);
+
+ static TBool ConvertToPointerFilter(const TDesC& aStr, TPointerFilter& aPointerFilter);
+ static TBool ConvertToPointerFilter(const TDesC& aStr, TUint& aPointerFilter);
+
+ static TBool ConvertToSpriteInCompare(const TDesC& aStr, TUint& aSpriteInCompare);
+
+ static TBool ConvertToWindowBackupType(const TDesC& aStr, TWindowBackupType& aWindowBackupType);
+ static TBool ConvertToWindowBackupType(const TDesC& aStr, TUint& aWindowBackupType);
+
+ static TBool ConvertToWsVisibilityChangedEvent(const TDesC& aStr, TUint& aWsVisibilityChangedEvent);
+
+ static TBool ConvertToSpriteFlags(const TDesC& aStr, TSpriteFlags& aSpriteFlags);
+ static TBool ConvertToSpriteFlags(const TDesC& aStr, TUint& aSpriteFlags);
+
+ static TBool ConvertToFrameInfoFlags(const TDesC& aStr,TUint32& aFrameInfoFlags);
+private:
+
+ static TInt iAvaiableSpace;
+ static TInt iBiggestBlock;
+ static RPointerArray < TAny > iMemArray;
+ };
+
+#endif /* __T_GRAPHICS_UTIL_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/inc/TestServerBase.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __TEST_SERVER_BASE__)
+#define __TEST_SERVER_BASE__
+
+// EPOC includes
+#include <testserver2.h>
+
+class CTestServerBase : public CTestServer2
+ {
+public:
+ // CTestServer implementation
+ virtual CTestStep* CreateTestStep(const TDesC& aStepName);
+ };
+
+#endif /* __TEST_SERVER_BASE__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/inc/UtilityClearPanicDlg.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __UTILITY_CLEAR_PANIC_DLG_H__)
+#define __UTILITY_CLEAR_PANIC_DLG_H__
+
+// EPOC includes
+#include <testexecutestepbase.h>
+
+class CUtilityClearPanicDlg : public CTestStep
+ {
+public:
+ CUtilityClearPanicDlg();
+
+ // CTestStep implementation
+ virtual enum TVerdict doTestStepL();
+ };
+
+#endif /* __UTILITY_CLEAR_PANIC_DLG_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/src/DataWrapperActive.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "DataWrapperActive.h"
+
+/*@{*/
+/// Constant Literals used.
+_LIT(KCmdCancel, "Cancel");
+_LIT(KCmdiStatus, "iStatus");
+
+_LIT(KFldExpected, "expected");
+/*@}*/
+
+CDataWrapperActive::CDataWrapperActive()
+: CDataWrapperBase()
+/**
+ * Protected constructor
+ */
+ {
+ }
+
+CDataWrapperActive::~CDataWrapperActive()
+/**
+ * Protected destructor
+ */
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CDataWrapperActive::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret=ETrue;
+
+ if ( aCommand==KCmdCancel )
+ {
+ DoCmdCancel();
+ }
+ else if ( aCommand==KCmdiStatus )
+ {
+ DoCmdiStatus(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+void CDataWrapperActive::DoCmdCancel()
+ {
+ INFO_PRINTF1(_L("++CActive::Cancel()"));
+ GetActive()->Cancel();
+ DecOutstanding();
+ INFO_PRINTF1(_L("--CActive::Cancel()"));
+ }
+
+void CDataWrapperActive::DoCmdiStatus(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("++CActive::iStatus"));
+ TRequestStatus actual=GetActive()->iStatus;
+ INFO_PRINTF2(_L("iStatus=%d"), actual.Int());
+
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ if ( expected!=actual.Int() )
+ {
+ ERR_PRINTF1(_L("Expected value does not match actual"));
+ SetBlockResult(EFail);
+ }
+ }
+ INFO_PRINTF1(_L("--CActive::iStatus"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/src/DataWrapperBase.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,635 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "DataWrapperBase.h"
+
+/*@{*/
+/// Constant Literals used.
+_LIT(KIncludeSection, "include");
+_LIT(KFile, "file%d");
+_LIT(KMatch, "*{*,*}*");
+_LIT(KStart, "{");
+_LIT(KSeparator, ",");
+_LIT(KEnd, "}");
+_LIT(KDataRead, "INI READ : %S %S %S");
+
+_LIT(KFormatEntryField, "%S_%S");
+
+_LIT(KTagFontSpecName, "name");
+_LIT(KTagFontSpecHeight, "height");
+
+_LIT(KTagPointX, "x");
+_LIT(KTagPointY, "y");
+
+_LIT(KTagRectTop, "top");
+_LIT(KTagRectLeft, "left");
+_LIT(KTagRectBottom, "bottom");
+_LIT(KTagRectRight, "right");
+
+_LIT(KTagRgbRed, "red");
+_LIT(KTagRgbGreen, "green");
+_LIT(KTagRgbBlue, "blue");
+_LIT(KTagRgbAlpha, "alpha");
+
+_LIT(KTagSizeWidth, "width");
+_LIT(KTagSizeHeight, "height");
+
+_LIT(KTagWsGraphicIdUid, "uid");
+_LIT(KTagWsGraphicIdId, "id");
+_LIT(KTagWsGraphicIdName, "name");
+
+_LIT(KFormatFieldNumber, "%S%d");
+
+/// Logging
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogRegion, "Region '%S'");
+_LIT(KLogEmpty, "Empty");
+_LIT(KLogRegionsRect, "Rect[%d] tl=(%d,%d) br=(%d,%d)");
+_LIT(KLogRect, "%S tl=(%d,%d) br=(%d,%d)");
+/*@}*/
+
+CDataWrapperBase::CDataWrapperBase()
+: CDataWrapper()
+, iHandle(0)
+, iId(TWsGraphicId::EUninitialized)
+ {
+ }
+
+CDataWrapperBase::~CDataWrapperBase()
+/**
+ * Public destructor
+ */
+ {
+ iInclude.ResetAndDestroy();
+ iBuffer.ResetAndDestroy();
+ iFs.Close();
+ }
+
+void CDataWrapperBase::InitialiseL()
+ {
+ CDataWrapper::InitialiseL();
+
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ TPtrC fileName;
+ TBool moreData=ETrue;
+ TBool index=0;
+ while ( moreData )
+ {
+ tempStore.Format(KFile(), ++index);
+ moreData=GetStringFromConfig(KIncludeSection, tempStore, fileName);
+
+ if (moreData)
+ {
+ CIniData* iniData=CIniData::NewL(fileName);
+ CleanupStack::PushL(iniData);
+ iInclude.Append(iniData);
+ CleanupStack::Pop(iniData);
+ }
+ }
+ User::LeaveIfError(iFs.Connect());
+ }
+
+TBool CDataWrapperBase::GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult)
+ {
+ TBool ret=EFalse;
+ TPtrC result;
+ TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result));
+ if ( err != KErrNone )
+ {
+ ret=EFalse;
+ }
+ if ( ret )
+ {
+ _LIT(KTrue,"true");
+ aResult=(result.FindF(KTrue) != KErrNotFound);
+ }
+
+ return ret;
+ }
+
+TBool CDataWrapperBase::GetFontSpecFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TFontSpec& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+
+ TPtrC name;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagFontSpecName);
+ TBool ret=GetStringFromConfig(aSectName, tempStore, name);
+
+ TInt height;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagFontSpecHeight);
+ if ( !GetIntFromConfig(aSectName, tempStore, height) )
+ {
+ ret=EFalse;
+ }
+
+ if ( ret )
+ {
+ aResult=TFontSpec(name, height);
+ }
+
+ return ret;
+ }
+
+TBool CDataWrapperBase::GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult)
+ {
+ TPtrC result;
+ TBool ret=EFalse;
+ TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result));
+ if ( err != KErrNone )
+ {
+ ret=EFalse;
+ }
+ if ( ret )
+ {
+ TLex lex(result);
+ ret=(lex.Val(aResult)==KErrNone);
+ }
+
+ return ret;
+ }
+
+TBool CDataWrapperBase::GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult)
+ {
+ TBool ret=EFalse;
+ TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, aResult));
+ if ( err != KErrNone )
+ {
+ ret=EFalse;
+ }
+ return ret;
+ }
+
+TBool CDataWrapperBase::GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult)
+ {
+ TPtrC result;
+ TBool ret=EFalse;
+ TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result));
+ if ( err != KErrNone )
+ {
+ ret=EFalse;
+ }
+ if ( ret )
+ {
+ TLex lex(result);
+ ret=(lex.Val((TUint &)aResult, EHex)==KErrNone);
+ }
+
+ return ret;
+ }
+
+TBool CDataWrapperBase::GetPointFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPoint& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TInt x;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagPointX);
+ TBool ret=GetIntFromConfig(aSectName, tempStore, x);
+
+ TInt y;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagPointY);
+ if ( !GetIntFromConfig(aSectName, tempStore, y) )
+ {
+ ret=EFalse;
+ }
+
+ if ( ret )
+ {
+ aResult.SetXY(x, y);
+ }
+
+ return ret;
+ }
+
+TBool CDataWrapperBase::GetRectFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRect& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TInt top;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectTop);
+ TBool ret=GetIntFromConfig(aSectName, tempStore, top);
+
+ TInt left;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectLeft);
+ if ( !GetIntFromConfig(aSectName, tempStore, left) )
+ {
+ ret=EFalse;
+ }
+
+ TInt bottom;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectBottom);
+ if ( !GetIntFromConfig(aSectName, tempStore, bottom) )
+ {
+ ret=EFalse;
+ }
+
+ TInt right;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectRight);
+ if ( !GetIntFromConfig(aSectName, tempStore, right) )
+ {
+ ret=EFalse;
+ }
+
+ if ( ret )
+ {
+ aResult.SetRect(left, top, right, bottom);
+ }
+
+ return ret;
+ }
+
+TBool CDataWrapperBase::GetRegionFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRegion& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ TRect rect;
+
+ aResult.Clear();
+ TBool moreData=ETrue;
+ for ( TInt index=0; moreData; )
+ {
+ tempStore.Format(KFormatFieldNumber, &aKeyName, ++index);
+ moreData=GetRectFromConfig(aSectName, tempStore, rect);
+ if ( moreData )
+ {
+ aResult.AddRect(rect);
+ }
+ }
+
+ return aResult.Count()>0;
+ }
+
+TBool CDataWrapperBase::GetRgbFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRgb& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TInt red;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbRed);
+ TBool ret=GetIntFromConfig(aSectName, tempStore, red);
+
+ TInt green;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbGreen);
+ if ( !GetIntFromConfig(aSectName, tempStore, green) )
+ {
+ ret=EFalse;
+ }
+
+ TInt blue;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbBlue);
+ if ( !GetIntFromConfig(aSectName, tempStore, blue) )
+ {
+ ret=EFalse;
+ }
+
+ if ( ret )
+ {
+ aResult.SetRed(red);
+ aResult.SetGreen(green);
+ aResult.SetBlue(blue);
+
+ TInt alpha;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbAlpha);
+ if ( GetIntFromConfig(aSectName, tempStore, alpha) )
+ {
+ aResult.SetAlpha(alpha);
+ }
+ }
+
+ return ret;
+ }
+
+TBool CDataWrapperBase::GetSizeFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TSize& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TInt width;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagSizeWidth);
+ TBool ret=GetIntFromConfig(aSectName, tempStore, width);
+
+ TInt height;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagSizeHeight);
+ if ( !GetIntFromConfig(aSectName, tempStore, height) )
+ {
+ ret=EFalse;
+ }
+
+ if ( ret )
+ {
+ aResult.SetSize(width, height);
+ }
+
+ return ret;
+ }
+
+TBool CDataWrapperBase::GetRgbListFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt aSize, TRgb*& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TBool ok=ETrue;
+ for ( TInt index=0; (index<aSize) && (ok); )
+ {
+ tempStore.Format(KFormatFieldNumber, &aKeyName, ++index);
+ ok=GetRgbFromConfig(aSectName, tempStore, aResult[index-1]);
+ if ( !ok )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &tempStore);
+ SetBlockResult(EFail);
+ }
+ }
+
+ return ok;
+ }
+
+TBool CDataWrapperBase::GetPointListFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt aSize, TPoint*& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TBool ok=ETrue;
+ for ( TInt index=0; (index<aSize) && (ok); )
+ {
+ tempStore.Format(KFormatFieldNumber, &aKeyName, ++index);
+ ok=GetPointFromConfig(aSectName, tempStore, aResult[index-1]);
+ if ( !ok )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &tempStore);
+ SetBlockResult(EFail);
+ }
+ }
+
+ return ok;
+ }
+
+TBool CDataWrapperBase::GetPointListFromConfigL(const TDesC& aSectName, const TDesC& aKeyName, CArrayFix<TPoint>& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ TPoint point;
+
+ aResult.Reset();
+ TBool ok=ETrue;
+ for ( TInt index=0; ok; )
+ {
+ tempStore.Format(KFormatFieldNumber, &aKeyName, ++index);
+ ok=GetPointFromConfig(aSectName, tempStore, point);
+ if ( ok )
+ {
+ aResult.AppendL(point);
+ }
+ }
+
+ return aResult.Count()>0;
+ }
+
+TBool CDataWrapperBase::GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult)
+ {
+ TBool ret=EFalse;
+
+ if ( aSectName.Length()!=0 )
+ {
+ ret=CDataWrapper::GetStringFromConfig(aSectName, aKeyName, aResult);
+
+ for ( TInt index=iInclude.Count(); (index>0) && (!ret); )
+ {
+ ret=iInclude[--index]->FindVar(aSectName, aKeyName, aResult);
+ }
+ }
+
+ if ( ret )
+ {
+ if ( aResult.Match(KMatch)!=KErrNotFound )
+ {
+ // We have an entry of the format
+ // entry =*{section,entry}*
+ // where * is one or more characters
+ // We need to construct this from other data in the ini file replacing {*,*}
+ // with the data from
+ // [section]
+ // entry =some_value
+ HBufC* buffer=HBufC::NewLC(aResult.Length());
+ buffer->Des().Copy(aResult);
+
+ TInt startLength=KStart().Length();
+ TInt sparatorLength=KSeparator().Length();
+ TInt endLength=KEnd().Length();
+ TInt bufferLength;
+ TInt start;
+ TInt sparator;
+ TInt end;
+ TPtrC remaining;
+ TLex lex;
+ do
+ {
+ bufferLength=buffer->Length();
+ start=buffer->Find(KStart);
+
+ remaining.Set(buffer->Des().Right(bufferLength-start-startLength));
+ sparator=remaining.Find(KSeparator);
+ remaining.Set(remaining.Right(remaining.Length()-sparator-sparatorLength));
+ sparator += (start + startLength);
+
+ end=remaining.Find(KEnd) + sparator + sparatorLength;
+
+ TPtrC sectionName(buffer->Ptr()+start+startLength, sparator-start-startLength);
+ TPtrC keyName(buffer->Ptr()+sparator+sparatorLength, end-sparator-sparatorLength);
+ sectionName.Set(TLex(sectionName).NextToken());
+ keyName.Set(TLex(keyName).NextToken());
+
+ TInt entrySize=0;
+ TPtrC entryData;
+ TBool found=CDataWrapper::GetStringFromConfig(sectionName, keyName, entryData);
+ for ( TInt index=iInclude.Count(); (index>0) && (!found); )
+ {
+ found=iInclude[--index]->FindVar(sectionName, keyName, entryData);
+ }
+ if ( found )
+ {
+ entrySize=entryData.Length();
+ }
+
+ TInt newLength=start + bufferLength - end - endLength + entrySize;
+ HBufC* bufferNew=HBufC::NewLC(newLength);
+ bufferNew->Des().Copy(buffer->Ptr(), start);
+ if ( entrySize>0 )
+ {
+ bufferNew->Des().Append(entryData);
+ }
+ bufferNew->Des().Append(buffer->Ptr() + end + endLength, bufferLength - end - endLength);
+ CleanupStack::Pop(bufferNew);
+ CleanupStack::PopAndDestroy(buffer);
+ buffer=bufferNew;
+ CleanupStack::PushL(buffer);
+ }
+ while ( buffer->Match(KMatch)!=KErrNotFound );
+ iBuffer.Append(buffer);
+ CleanupStack::Pop(buffer);
+ aResult.Set(*buffer);
+ INFO_PRINTF4(KDataRead, &aSectName, &aKeyName , &aResult);
+ }
+ }
+
+ return ret;
+ }
+
+TBool CDataWrapperBase::GetWsGraphicIdFromConfigL(const TDesC& aSectName, const TDesC& aKeyName, TWsGraphicId& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TInt id;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagWsGraphicIdUid);
+ TBool ret=GetIntFromConfig(aSectName, tempStore, id);
+
+ if ( ret )
+ {
+ TUid uid=TUid::Uid(id);
+ aResult.Set(uid);
+ }
+ else
+ {
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagWsGraphicIdId);
+ ret=GetIntFromConfig(aSectName, tempStore, id);
+ if ( ret )
+ {
+ aResult.Set(id);
+ }
+ else
+ {
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagWsGraphicIdName);
+ TPtrC name;
+ ret=GetStringFromConfig(aSectName, tempStore, name);
+ if ( ret )
+ {
+ CDataWrapperBase* wrapper=static_cast<CDataWrapperBase*>(GetDataWrapperL(name));
+ aResult=wrapper->GetId();
+ }
+ }
+ }
+
+ return ret;
+ }
+
+ TBool CDataWrapperBase::GetDateTimeFromConfig(const TDesC& aSectName, TDateTime& aResult)
+ {
+ TInt year , month , day , hour , minute, second, microsecond ;
+
+ // Fields
+ _LIT(KYear, "year");
+ _LIT(KMonth, "month");
+ _LIT(KDay, "day");
+ _LIT(KHour, "hour");
+ _LIT(KMinute, "minute");
+ _LIT(KSecond, "second");
+ _LIT(KMicrosecond, "microsecond");
+
+ TBool ret = ETrue ;
+ if ( !GetIntFromConfig( aSectName, KYear , year))
+ {
+ ret=EFalse;
+ }
+ if ( !GetIntFromConfig( aSectName, KMonth , month))
+ {
+ ret=EFalse;
+ }
+ if ( !GetIntFromConfig( aSectName, KDay, day))
+ {
+ ret=EFalse;
+ }
+ if ( !GetIntFromConfig( aSectName, KHour, hour))
+ {
+ ret=EFalse;
+ }
+ if ( !GetIntFromConfig( aSectName, KMinute , minute))
+ {
+ ret=EFalse;
+ }
+ if ( !GetIntFromConfig( aSectName, KSecond , second))
+ {
+ ret=EFalse;
+ }
+ if ( !GetIntFromConfig( aSectName, KMicrosecond , microsecond))
+ {
+ ret=EFalse;
+ }
+ if ( ret )
+ {
+ TMonth amonth ;
+ switch (month)
+ {
+ case 1:
+ amonth = EJanuary ;
+ break ;
+ case 2:
+ amonth = EFebruary ;
+ break ;
+ case 3 :
+ amonth = EMarch ;
+ break ;
+ case 4:
+ amonth = EApril ;
+ break ;
+ case 5:
+ amonth = EMay ;
+ break ;
+ case 6 :
+ amonth = EJune ;
+ break ;
+ case 7 :
+ amonth = EJuly ;
+ break ;
+ case 8 :
+ amonth = EAugust ;
+ break ;
+ case 9 :
+ amonth = ESeptember ;
+ break ;
+ case 10 :
+ amonth = EOctober ;
+ break ;
+ case 11 :
+ amonth = ENovember ;
+ break ;
+ case 12:
+ amonth = EDecember ;
+ break ;
+ default :
+ return ret ;
+ }
+
+ aResult.Set(year,amonth ,day,hour,minute,second,microsecond);
+ }
+
+ return ret ;
+ }
+void CDataWrapperBase::LogRegion(const TDesC& aMessage, const TRegion& aRegion)
+ {
+ INFO_PRINTF2(KLogRegion, &aMessage);
+ TInt indCount = aRegion.Count();
+ if ( indCount==0 )
+ {
+ INFO_PRINTF1(KLogEmpty);
+ }
+ else
+ {
+ const TRect* rect=aRegion.RectangleList();
+ for ( TInt index=0; index<indCount; ++index )
+ {
+ INFO_PRINTF6(KLogRegionsRect, index, rect[index].iTl.iX, rect[index].iTl.iY, rect[index].iBr.iX, rect[index].iBr.iY);
+ }
+ }
+ }
+
+void CDataWrapperBase::LogRect(const TDesC& aMessage, const TRect& aRect)
+ {
+ INFO_PRINTF6(KLogRect, &aMessage, aRect.iTl.iX, aRect.iTl.iY, aRect.iBr.iX, aRect.iBr.iY);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/src/T_GraphicsUtil.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,5569 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_GraphicsUtil.h"
+#include "../../wserv/AnimPlugin/inc/T_AnimDef.h"
+// EPOC includes
+#include <apgtask.h> // used for apatask
+
+#define INFO_PRINTF1_UTIL(p1) aDataWrapper.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1))
+#define INFO_PRINTF2_UTIL(p1, p2) aDataWrapper.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2))
+/*@{*/
+_LIT(KFormatEntryField, "%S_%S");
+_LIT(KFormatFieldNumber, "%S%d");
+
+_LIT(KTagTextCursorType, "type");
+_LIT(KTagTextCursorHeight, "height");
+_LIT(KTagTextCursorAscent, "ascent");
+_LIT(KTagTextCursorWidth, "width");
+_LIT(KTagTextCursorFlags, "flags");
+_LIT(KTagTextCursorColor, "color");
+
+_LIT(KTagSpriteMemberBitmap, "bitmap");
+_LIT(KTagSpriteMemberMaskBitmap, "maskbitmap");
+_LIT(KTagSpriteMemberInvertMask, "invertmask");
+_LIT(KTagSpriteMemberDrawMode, "drawmode");
+_LIT(KTagSpriteMemberOffset, "offset");
+_LIT(KTagSpriteMemberInterval, "interval");
+_LIT(KTagParamStart, "start");
+_LIT(KTagParamEnd, "end");
+_LIT(KTagParamFlags, "flags");
+_LIT(KTagParamEnabled, "enabled");
+
+/// Enumerations type parameter names and their possible values
+_LIT(KRLECompression, "ERLECompression");
+_LIT(KPaletteCompression, "EPaletteCompression");
+_LIT(KPaletteCompressionWithRLEFallback, "EPaletteCompressionWithRLEFallback");
+
+_LIT(KBrushStyleNull, "ENullBrush");
+_LIT(KBrushStyleSolid, "ESolidBrush");
+_LIT(KBrushStylePatterned, "EPatternedBrush");
+_LIT(KBrushStyleVerticalHatch, "EVerticalHatchBrush");
+_LIT(KBrushStyleForwardDiagonalHatch, "EForwardDiagonalHatchBrush");
+_LIT(KBrushStyleHorizontalHatch, "EHorizontalHatchBrush");
+_LIT(KBrushStyleRearwardDiagonalHatch, "ERearwardDiagonalHatchBrush");
+_LIT(KBrushStyleSquareCrossHatch, "ESquareCrossHatchBrush");
+_LIT(KBrushStyleDiamondCrossHatch, "EDiamondCrossHatchBrush");
+
+_LIT(KCaptureFlagEnabled, "TCaptureFlagEnabled");
+_LIT(KCaptureFlagDragDrop, "TCaptureFlagDragDrop");
+_LIT(KCaptureFlagAllGroups, "TCaptureFlagAllGroups");
+_LIT(KCaptureDisabled, "TCaptureDisabled");
+_LIT(KCaptureEnabled, "TCaptureEnabled");
+_LIT(KCaptureDragDrop, "TCaptureDragDrop");
+
+_LIT(KComputeModePriorityControlDisabled, "EPriorityControlDisabled");
+_LIT(KComputeModePriorityControlComputeOn, "EPriorityControlComputeOn");
+_LIT(KComputeModePriorityControlComputeOff, "EPriorityControlComputeOff");
+
+_LIT(KCornerTypeWindowSquare, "EWindowCornerSquare");
+_LIT(KCornerTypeWindow1, "EWindowCorner1");
+_LIT(KCornerTypeWindow2, "EWindowCorner2");
+_LIT(KCornerTypeWindow3, "EWindowCorner3");
+_LIT(KCornerTypeWindow5, "EWindowCorner5");
+_LIT(KCornerTypeWindowRegion, "EWindowCornerRegion");
+_LIT(KCornerTypeMask, "ECornerTypeMask");
+
+_LIT(KDisplayModeNone, "ENone");
+_LIT(KDisplayModeGray2, "EGray2");
+_LIT(KDisplayModeGray4, "EGray4");
+_LIT(KDisplayModeGray16, "EGray16");
+_LIT(KDisplayModeGray256, "EGray256");
+_LIT(KDisplayModeColor16, "EColor16");
+_LIT(KDisplayModeColor256, "EColor256");
+_LIT(KDisplayModeColor64K, "EColor64K");
+_LIT(KDisplayModeColor16M, "EColor16M");
+_LIT(KDisplayModeRgb, "ERgb");
+_LIT(KDisplayModeColor4K, "EColor4K");
+_LIT(KDisplayModeColor16MU, "EColor16MU");
+_LIT(KDisplayModeColor16MA, "EColor16MA");
+_LIT(KDisplayModeColor16MAP, "EColor16MAP");
+_LIT(KDisplayModeColorLast, "EColorLast");
+
+_LIT(KDrawModeAND, "EDrawModeAND");
+_LIT(KDrawModeNOTAND, "EDrawModeNOTAND");
+_LIT(KDrawModePEN, "EDrawModePEN");
+_LIT(KDrawModeANDNOT, "EDrawModeANDNOT");
+_LIT(KDrawModeXOR, "EDrawModeXOR");
+_LIT(KDrawModeOR, "EDrawModeOR");
+_LIT(KDrawModeNOTANDNOT, "EDrawModeNOTANDNOT");
+_LIT(KDrawModeNOTXOR, "EDrawModeNOTXOR");
+_LIT(KDrawModeNOTSCREEN, "EDrawModeNOTSCREEN");
+_LIT(KDrawModeNOTOR, "EDrawModeNOTOR");
+_LIT(KDrawModeNOTPEN, "EDrawModeNOTPEN");
+_LIT(KDrawModeORNOT, "EDrawModeORNOT");
+_LIT(KDrawModeNOTORNOT, "EDrawModeNOTORNOT");
+_LIT(KDrawModeWriteAlpha, "EDrawModeWriteAlpha");
+
+_LIT(KErrorCategoryDrawingRegion, "EDrawingRegion");
+_LIT(KErrorCategoryBackLight, "EBackLight");
+_LIT(KErrorCategoryLogging, "ELogging");
+_LIT(KErrorCategoryContrast, "EContrast");
+
+_LIT(KEventCodeNull, "EEventNull");
+_LIT(KEventCodeKey, "EEventKey");
+_LIT(KEventCodeKeyUp, "EEventKeyUp");
+_LIT(KEventCodeKeyDown, "EEventKeyDown");
+_LIT(KEventCodeModifiersChanged, "EEventModifiersChanged");
+_LIT(KEventCodePointer, "EEventPointer");
+_LIT(KEventCodePointerEnter, "EEventPointerEnter");
+_LIT(KEventCodePointerExit, "EEventPointerExit");
+_LIT(KEventCodePointerBufferReady, "EEventPointerBufferReady");
+_LIT(KEventCodeDragDrop, "EEventDragDrop");
+_LIT(KEventCodeFocusLost, "EEventFocusLost");
+_LIT(KEventCodeFocusGained, "EEventFocusGained");
+_LIT(KEventCodeSwitchOn, "EEventSwitchOn");
+_LIT(KEventCodePassword, "EEventPassword");
+_LIT(KEventCodeWindowGroupsChanged, "EEventWindowGroupsChanged");
+_LIT(KEventCodeErrorMessage, "EEventErrorMessage");
+_LIT(KEventCodeMessageReady, "EEventMessageReady");
+_LIT(KEventCodeMarkInvalid, "EEventMarkInvalid");
+_LIT(KEventCodeSwitchOff, "EEventSwitchOff");
+_LIT(KEventCodeKeySwitchOff, "EEventKeySwitchOff");
+_LIT(KEventCodeScreenDeviceChanged, "EEventScreenDeviceChanged");
+_LIT(KEventCodeFocusGroupChanged, "EEventFocusGroupChanged");
+_LIT(KEventCodeCaseOpened, "EEventCaseOpened");
+_LIT(KEventCodeCaseClosed, "EEventCaseClosed");
+_LIT(KEventCodeWindowGroupListChanged, "EEventWindowGroupListChanged");
+_LIT(KEventCodeWindowVisibilityChanged, "EEventWindowVisibilityChanged");
+#if (defined SYMBIAN_PROCESS_MONITORING_AND_STARTUP)
+_LIT(KEventCodeRestartSystem, "EEventRestartSystem");
+#endif
+_LIT(KEventCodeKeyRepeat, "EEventKeyRepeat");
+_LIT(KEventCodeDirectScreenAccessBegin, "EEventDirectScreenAccessBegin");
+_LIT(KEventCodeDirectScreenAccessEnd, "EEventDirectScreenAccessEnd");
+_LIT(KEventCodeHeartbeatTimerStateChange, "EEventHeartbeatTimerStateChange");
+_LIT(KEventCodePowerMgmt, "EEventPowerMgmt");
+_LIT(KEventCodeReserved, "EEventReserved");
+_LIT(KEventCodeUser, "EEventUser");
+
+_LIT(KEventControlAlways, "EEventControlAlways");
+_LIT(KEventControlOnlyWithKeyboardFocus, "EEventControlOnlyWithKeyboardFocus");
+_LIT(KEventControlOnlyWhenVisible, "EEventControlOnlyWhenVisible");
+
+_LIT(KEventModifierAutorepeatable, "EModifierAutorepeatable");
+_LIT(KEventModifierKeypad, "EModifierKeypad");
+_LIT(KEventModifierLeftAlt, "EModifierLeftAlt");
+_LIT(KEventModifierRightAlt, "EModifierRightAlt");
+_LIT(KEventModifierAlt, "EModifierAlt");
+_LIT(KEventModifierLeftCtrl, "EModifierLeftCtrl");
+_LIT(KEventModifierRightCtrl, "EModifierRightCtrl");
+_LIT(KEventModifierCtrl, "EModifierCtrl");
+_LIT(KEventModifierLeftShift, "EModifierLeftShift");
+_LIT(KEventModifierRightShift, "EModifierRightShift");
+_LIT(KEventModifierShift, "EModifierShift");
+_LIT(KEventModifierLeftFunc, "EModifierLeftFunc");
+_LIT(KEventModifierRightFunc, "EModifierRightFunc");
+_LIT(KEventModifierFunc, "EModifierFunc");
+_LIT(KEventModifierCapsLock, "EModifierCapsLock");
+_LIT(KEventModifierNumLock, "EModifierNumLock");
+_LIT(KEventModifierScrollLock, "EModifierScrollLock");
+_LIT(KEventModifierKeyUp, "EModifierKeyUp");
+_LIT(KEventModifierSpecial, "EModifierSpecial");
+_LIT(KEventModifierDoubleClick, "EModifierDoubleClick");
+_LIT(KEventModifierPureKeycode, "EModifierPureKeycode");
+_LIT(KEventModifierKeyboardExtend, "EModifierKeyboardExtend");
+_LIT(KEventModifierCancelRotation, "EModifierCancelRotation");
+_LIT(KEventModifierRotateBy90, "EModifierRotateBy90");
+_LIT(KEventModifierRotateBy180, "EModifierRotateBy180");
+_LIT(KEventModifierRotateBy270, "EModifierRotateBy270");
+_LIT(KEventModifierPointer3DButton1, "EModifierPointer3DButton1");
+_LIT(KEventModifierPointer3DButton2, "EModifierPointer3DButton2");
+_LIT(KEventModifierPointer3DButton3, "EModifierPointer3DButton3");
+_LIT(KEventModifierAll, "EAllModifiers");
+
+_LIT(KFadeControlIncludeChildren, "EFadeIncludeChildren");
+_LIT(KFadeControlWindowOnly, "EFadeWindowOnly");
+
+_LIT(KFillRuleAlternate, "EAlternate");
+_LIT(KFillRuleEWinding, "EWinding");
+
+_LIT(KFontStrikethroughOff, "EStrikethroughOff");
+_LIT(KFontStrikethroughOn, "EStrikethroughOn");
+
+_LIT(KFontUnderlineOff, "EUnderlineOff");
+_LIT(KFontUnderlineOn, "EUnderlineOn");
+
+_LIT(KGlyphBitmapTypeDefault, "EDefaultGlyphBitmap");
+_LIT(KGlyphBitmapTypeMonochrome, "EMonochromeGlyphBitmap");
+_LIT(KGlyphBitmapTypeAntiAliased, "EAntiAliasedGlyphBitmap");
+_LIT(KGlyphBitmapTypeSubPixel, "ESubPixelGlyphBitmap");
+_LIT(KGlyphBitmapTypeFourColourBlend, "EFourColourBlendGlyphBitmap");
+
+_LIT(KGraphicsOrientationNormal, "EGraphicsOrientationNormal");
+_LIT(KGraphicsOrientationRotated90, "EGraphicsOrientationRotated90");
+_LIT(KGraphicsOrientationRotated180, "EGraphicsOrientationRotated180");
+_LIT(KGraphicsOrientationRotated270, "EGraphicsOrientationRotated270");
+
+_LIT(KHotKeyEnableLogging, "EHotKeyEnableLogging");
+_LIT(KHotKeyDisableLogging, "EHotKeyDisableLogging");
+_LIT(KHotKeyStateDump, "EHotKeyStateDump");
+_LIT(KHotKeyOfDeath, "EHotKeyOfDeath");
+_LIT(KHotKeyShutDown, "EHotKeyShutDown");
+_LIT(KHotKeyHeapDump, "EHotKeyHeapDump");
+_LIT(KHotKeyIncContrast, "EHotKeyIncContrast");
+_LIT(KHotKeyDecContrast, "EHotKeyDecContrast");
+_LIT(KHotKeyOff, "EHotKeyOff");
+_LIT(KHotKeyBacklightOn, "EHotKeyBacklightOn");
+_LIT(KHotKeyBacklightOff, "EHotKeyBacklightOff");
+_LIT(KHotKeyBacklightToggle, "EHotKeyBacklightToggle");
+_LIT(KHotKeyScreenDimension0, "EHotKeyScreenDimension0");
+_LIT(KHotKeyScreenDimension1, "EHotKeyScreenDimension1");
+_LIT(KHotKeyScreenDimension2, "EHotKeyScreenDimension2");
+_LIT(KHotKeyScreenDimension3, "EHotKeyScreenDimension3");
+_LIT(KHotKeyCycleDisplaySize, "EHotKeyCycleDisplaySize");
+_LIT(KHotKeyCycleOrientation, "EHotKeyCycleOrientation");
+_LIT(KHotKeyIncBrightness, "EHotKeyIncBrightness");
+_LIT(KHotKeyDecBrightness, "EHotKeyDecBrightness");
+_LIT(KHotKeyCycleFocusScreen, "EHotKeyCycleFocusScreen");
+_LIT(KHotKeyFirstKeyType, "EHotKeyFirstKeyType");
+_LIT(KHotKeyLastKeyType, "EHotKeyLastKeyType");
+
+_LIT(KKeyNull, "EKeyNull");
+_LIT(KKeyBell, "EKeyBell");
+_LIT(KKeyBackspace, "EKeyBackspace");
+_LIT(KKeyTab, "EKeyTab");
+_LIT(KKeyLineFeed, "EKeyLineFeed");
+_LIT(KKeyVerticalTab, "EKeyVerticalTab");
+_LIT(KKeyFormFeed, "EKeyFormFeed");
+_LIT(KKeyEnter, "EKeyEnter");
+_LIT(KKeyEscape, "EKeyEscape");
+_LIT(KKeySpace, "EKeySpace");
+_LIT(KKeyDelete, "EKeyDelete");
+_LIT(KKeyPrintScreen, "EKeyPrintScreen");
+_LIT(KKeyPause, "EKeyPause");
+_LIT(KKeyHome, "EKeyHome");
+_LIT(KKeyEnd, "EKeyEnd");
+_LIT(KKeyPageUp, "EKeyPageUp");
+_LIT(KKeyPageDown, "EKeyPageDown");
+_LIT(KKeyInsert, "EKeyInsert");
+_LIT(KKeyLeftArrow, "EKeyLeftArrow");
+_LIT(KKeyRightArrow, "EKeyRightArrow");
+_LIT(KKeyUpArrow, "EKeyUpArrow");
+_LIT(KKeyDownArrow, "EKeyDownArrow");
+_LIT(KKeyLeftShift, "EKeyLeftShift");
+_LIT(KKeyRightShift, "EKeyRightShift");
+_LIT(KKeyLeftAlt, "EKeyLeftAlt");
+_LIT(KKeyRightAlt, "EKeyRightAlt");
+_LIT(KKeyLeftCtrl, "EKeyLeftCtrl");
+_LIT(KKeyRightCtrl, "EKeyRightCtrl");
+_LIT(KKeyLeftFunc, "EKeyLeftFunc");
+_LIT(KKeyRightFunc, "EKeyRightFunc");
+_LIT(KKeyCapsLock, "EKeyCapsLock");
+_LIT(KKeyNumLock, "EKeyNumLock");
+_LIT(KKeyScrollLock, "EKeyScrollLock");
+_LIT(KKeyF1, "EKeyF1");
+_LIT(KKeyF2, "EKeyF2");
+_LIT(KKeyF3, "EKeyF3");
+_LIT(KKeyF4, "EKeyF4");
+_LIT(KKeyF5, "EKeyF5");
+_LIT(KKeyF6, "EKeyF6");
+_LIT(KKeyF7, "EKeyF7");
+_LIT(KKeyF8, "EKeyF8");
+_LIT(KKeyF9, "EKeyF9");
+_LIT(KKeyF10, "EKeyF10");
+_LIT(KKeyF11, "EKeyF11");
+_LIT(KKeyF12, "EKeyF12");
+_LIT(KKeyF13, "EKeyF13");
+_LIT(KKeyF14, "EKeyF14");
+_LIT(KKeyF15, "EKeyF15");
+_LIT(KKeyF16, "EKeyF16");
+_LIT(KKeyF17, "EKeyF17");
+_LIT(KKeyF18, "EKeyF18");
+_LIT(KKeyF19, "EKeyF19");
+_LIT(KKeyF20, "EKeyF20");
+_LIT(KKeyF21, "EKeyF21");
+_LIT(KKeyF22, "EKeyF22");
+_LIT(KKeyF23, "EKeyF23");
+_LIT(KKeyF24, "EKeyF24");
+_LIT(KKeyOff, "EKeyOff");
+_LIT(KKeyIncContrast, "EKeyIncContrast");
+_LIT(KKeyDecContrast, "EKeyDecContrast");
+_LIT(KKeyBacklightOn, "EKeyBacklightOn");
+_LIT(KKeyBacklightOff, "EKeyBacklightOff");
+_LIT(KKeyBacklightToggle, "EKeyBacklightToggle");
+_LIT(KKeySliderDown, "EKeySliderDown");
+_LIT(KKeySliderUp, "EKeySliderUp");
+_LIT(KKeyMenu, "EKeyMenu");
+_LIT(KKeyDictaphonePlay, "EKeyDictaphonePlay");
+_LIT(KKeyDictaphoneStop, "EKeyDictaphoneStop");
+_LIT(KKeyDictaphoneRecord, "EKeyDictaphoneRecord");
+_LIT(KKeyHelp, "EKeyHelp");
+_LIT(KKeyDial, "EKeyDial");
+_LIT(KKeyScreenDimension0, "EKeyScreenDimension0");
+_LIT(KKeyScreenDimension1, "EKeyScreenDimension1");
+_LIT(KKeyScreenDimension2, "EKeyScreenDimension2");
+_LIT(KKeyScreenDimension3, "EKeyScreenDimension3");
+_LIT(KKeyIncVolume, "EKeyIncVolume");
+_LIT(KKeyDecVolume, "EKeyDecVolume");
+_LIT(KKeyDevice0, "EKeyDevice0");
+_LIT(KKeyDevice1, "EKeyDevice1");
+_LIT(KKeyDevice2, "EKeyDevice2");
+_LIT(KKeyDevice3, "EKeyDevice3");
+_LIT(KKeyDevice4, "EKeyDevice4");
+_LIT(KKeyDevice5, "EKeyDevice5");
+_LIT(KKeyDevice6, "EKeyDevice6");
+_LIT(KKeyDevice7, "EKeyDevice7");
+_LIT(KKeyDevice8, "EKeyDevice8");
+_LIT(KKeyDevice9, "EKeyDevice9");
+_LIT(KKeyDeviceA, "EKeyDeviceA");
+_LIT(KKeyDeviceB, "EKeyDeviceB");
+_LIT(KKeyDeviceC, "EKeyDeviceC");
+_LIT(KKeyDeviceD, "EKeyDeviceD");
+_LIT(KKeyDeviceE, "EKeyDeviceE");
+_LIT(KKeyDeviceF, "EKeyDeviceF");
+_LIT(KKeyApplication0, "EKeyApplication0");
+_LIT(KKeyApplication1, "EKeyApplication1");
+_LIT(KKeyApplication2, "EKeyApplication2");
+_LIT(KKeyApplication3, "EKeyApplication3");
+_LIT(KKeyApplication4, "EKeyApplication4");
+_LIT(KKeyApplication5, "EKeyApplication5");
+_LIT(KKeyApplication6, "EKeyApplication6");
+_LIT(KKeyApplication7, "EKeyApplication7");
+_LIT(KKeyApplication8, "EKeyApplication8");
+_LIT(KKeyApplication9, "EKeyApplication9");
+_LIT(KKeyApplicationA, "EKeyApplicationA");
+_LIT(KKeyApplicationB, "EKeyApplicationB");
+_LIT(KKeyApplicationC, "EKeyApplicationC");
+_LIT(KKeyApplicationD, "EKeyApplicationD");
+_LIT(KKeyApplicationE, "EKeyApplicationE");
+_LIT(KKeyApplicationF, "EKeyApplicationF");
+_LIT(KKeyYes, "EKeyYes");
+_LIT(KKeyNo, "EKeyNo");
+_LIT(KKeyIncBrightness, "EKeyIncBrightness");
+_LIT(KKeyDecBrightness, "EKeyDecBrightness");
+_LIT(KKeyKeyboardExtend, "EKeyKeyboardExtend");
+_LIT(KKeyDevice10, "EKeyDevice10");
+_LIT(KKeyDevice11, "EKeyDevice11");
+_LIT(KKeyDevice12, "EKeyDevice12");
+_LIT(KKeyDevice13, "EKeyDevice13");
+_LIT(KKeyDevice14, "EKeyDevice14");
+_LIT(KKeyDevice15, "EKeyDevice15");
+_LIT(KKeyDevice16, "EKeyDevice16");
+_LIT(KKeyDevice17, "EKeyDevice17");
+_LIT(KKeyDevice18, "EKeyDevice18");
+_LIT(KKeyDevice19, "EKeyDevice19");
+_LIT(KKeyDevice1A, "EKeyDevice1A");
+_LIT(KKeyDevice1B, "EKeyDevice1B");
+_LIT(KKeyDevice1C, "EKeyDevice1C");
+_LIT(KKeyDevice1D, "EKeyDevice1D");
+_LIT(KKeyDevice1E, "EKeyDevice1E");
+_LIT(KKeyDevice1F, "EKeyDevice1F");
+_LIT(KKeyApplication10, "EKeyApplication10");
+_LIT(KKeyApplication11, "EKeyApplication11");
+_LIT(KKeyApplication12, "EKeyApplication12");
+_LIT(KKeyApplication13, "EKeyApplication13");
+_LIT(KKeyApplication14, "EKeyApplication14");
+_LIT(KKeyApplication15, "EKeyApplication15");
+_LIT(KKeyApplication16, "EKeyApplication16");
+_LIT(KKeyApplication17, "EKeyApplication17");
+_LIT(KKeyApplication18, "EKeyApplication18");
+_LIT(KKeyApplication19, "EKeyApplication19");
+_LIT(KKeyApplication1A, "EKeyApplication1A");
+_LIT(KKeyApplication1B, "EKeyApplication1B");
+_LIT(KKeyApplication1C, "EKeyApplication1C");
+_LIT(KKeyApplication1D, "EKeyApplication1D");
+_LIT(KKeyApplication1E, "EKeyApplication1E");
+_LIT(KKeyApplication1F, "EKeyApplication1F");
+
+_LIT(KLoggingEnable, "ELoggingEnable");
+_LIT(KLoggingDisable, "ELoggingDisable");
+_LIT(KLoggingStatusDump, "ELoggingStatusDump");
+_LIT(KLoggingHeapDump, "ELoggingHeapDump");
+
+_LIT(KModifierStateTurnOnModifier, "ETurnOnModifier");
+_LIT(KModifierStateTurnOffModifier, "ETurnOffModifier");
+_LIT(KModifierStateToggleModifier, "EToggleModifier");
+
+_LIT(KPasswordModeCancel, "EPasswordCancel");
+_LIT(KPasswordModeNone, "EPasswordNone");
+_LIT(KPasswordModeOnceADay, "EPasswordOnceADay");
+_LIT(KPasswordModeAlways, "EPasswordAlways");
+_LIT(KPasswordModeAlwaysTriggerNow, "EPasswordAlwaysTriggerNow");
+_LIT(KPasswordModeOnceADayTriggerNow, "EPasswordOnceADayTriggerNow");
+
+_LIT(KPenStyleNull, "ENullPen");
+_LIT(KPenStyleSolid, "ESolidPen");
+_LIT(KPenStyleDotted, "EDottedPen");
+_LIT(KPenStyleDashed, "EDashedPen");
+_LIT(KPenStyleDotDash, "EDotDashPen");
+_LIT(KPenStyleDotDotDash, "EDotDotDashPen");
+
+_LIT(KPointerCursorNone, "EPointerCursorNone");
+_LIT(KPointerCursorFixed, "EPointerCursorFixed");
+_LIT(KPointerCursorNormal, "EPointerCursorNormal");
+_LIT(KPointerCursorWindow, "EPointerCursorWindow");
+_LIT(KPointerCursorFirstMode, "EPointerCursorFirstMode");
+_LIT(KPointerCursorLastMode, "EPointerCursorLastMode");
+
+_LIT(KPointerFilterEnterExit, "EPointerFilterEnterExit");
+_LIT(KPointerFilterMove, "EPointerFilterMove");
+_LIT(KPointerFilterDrag, "EPointerFilterDrag");
+_LIT(KPointerFilterGenerateSimulatedMove, "EPointerGenerateSimulatedMove");
+_LIT(KPointerFilterMoveEvents, "EPointerMoveEvents");
+
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+_LIT(KPrioritiesAll, "EAllPriorities");
+#endif
+
+_LIT(KPriorityIdle, "EPriorityIdle");
+_LIT(KPriorityLow, "EPriorityLow");
+_LIT(KPriorityStandard, "EPriorityStandard");
+_LIT(KPriorityUserInput, "EPriorityUserInput");
+_LIT(KPriorityHigh, "EPriorityHigh");
+
+_LIT(KSizeEnforcementNone, "ESizeEnforcementNone");
+_LIT(KSizeEnforcementPixelsAndRotation, "ESizeEnforcementPixelsAndRotation");
+_LIT(KSizeEnforcementPixelsTwipsAndRotation, "ESizeEnforcementPixelsTwipsAndRotation");
+
+_LIT(KSpriteInCompareRemoveSprite, "ERemoveSprite");
+_LIT(KSpriteInCompareIncludeSprite, "EIncludeSprite");
+_LIT(KSpriteInCompareIncludeTextCursor, "EIncludeTextCursor");
+
+_LIT(KStdKeyNull, "EStdKeyNull");
+_LIT(KStdKeyBackspace, "EStdKeyBackspace");
+_LIT(KStdKeyTab, "EStdKeyTab");
+_LIT(KStdKeyEnter, "EStdKeyEnter");
+_LIT(KStdKeyEscape, "EStdKeyEscape");
+_LIT(KStdKeySpace, "EStdKeySpace");
+_LIT(KStdKeyPrintScreen, "EStdKeyPrintScreen");
+_LIT(KStdKeyPause, "EStdKeyPause");
+_LIT(KStdKeyHome, "EStdKeyHome");
+_LIT(KStdKeyEnd, "EStdKeyEnd");
+_LIT(KStdKeyPageUp, "EStdKeyPageUp");
+_LIT(KStdKeyPageDown, "EStdKeyPageDown");
+_LIT(KStdKeyInsert, "EStdKeyInsert");
+_LIT(KStdKeyDelete, "EStdKeyDelete");
+_LIT(KStdKeyLeftArrow, "EStdKeyLeftArrow");
+_LIT(KStdKeyRightArrow, "EStdKeyRightArrow");
+_LIT(KStdKeyUpArrow, "EStdKeyUpArrow");
+_LIT(KStdKeyDownArrow, "EStdKeyDownArrow");
+_LIT(KStdKeyLeftShift, "EStdKeyLeftShift");
+_LIT(KStdKeyRightShift, "EStdKeyRightShift");
+_LIT(KStdKeyLeftAlt, "EStdKeyLeftAlt");
+_LIT(KStdKeyRightAlt, "EStdKeyRightAlt");
+_LIT(KStdKeyLeftCtrl, "EStdKeyLeftCtrl");
+_LIT(KStdKeyRightCtrl, "EStdKeyRightCtrl");
+_LIT(KStdKeyLeftFunc, "EStdKeyLeftFunc");
+_LIT(KStdKeyRightFunc, "EStdKeyRightFunc");
+_LIT(KStdKeyCapsLock, "EStdKeyCapsLock");
+_LIT(KStdKeyNumLock, "EStdKeyNumLock");
+_LIT(KStdKeyScrollLock, "EStdKeyScrollLock");
+_LIT(KStdKeyF1, "EStdKeyF1");
+_LIT(KStdKeyF2, "EStdKeyF2");
+_LIT(KStdKeyF3, "EStdKeyF3");
+_LIT(KStdKeyF4, "EStdKeyF4");
+_LIT(KStdKeyF5, "EStdKeyF5");
+_LIT(KStdKeyF6, "EStdKeyF6");
+_LIT(KStdKeyF7, "EStdKeyF7");
+_LIT(KStdKeyF8, "EStdKeyF8");
+_LIT(KStdKeyF9, "EStdKeyF9");
+_LIT(KStdKeyF10, "EStdKeyF10");
+_LIT(KStdKeyF11, "EStdKeyF11");
+_LIT(KStdKeyF12, "EStdKeyF12");
+_LIT(KStdKeyF13, "EStdKeyF13");
+_LIT(KStdKeyF14, "EStdKeyF14");
+_LIT(KStdKeyF15, "EStdKeyF15");
+_LIT(KStdKeyF16, "EStdKeyF16");
+_LIT(KStdKeyF17, "EStdKeyF17");
+_LIT(KStdKeyF18, "EStdKeyF18");
+_LIT(KStdKeyF19, "EStdKeyF19");
+_LIT(KStdKeyF20, "EStdKeyF20");
+_LIT(KStdKeyF21, "EStdKeyF21");
+_LIT(KStdKeyF22, "EStdKeyF22");
+_LIT(KStdKeyF23, "EStdKeyF23");
+_LIT(KStdKeyF24, "EStdKeyF24");
+_LIT(KStdKeyXXX, "EStdKeyXXX");
+_LIT(KStdKeyComma, "EStdKeyComma");
+_LIT(KStdKeyFullStop, "EStdKeyFullStop");
+_LIT(KStdKeyForwardSlash, "EStdKeyForwardSlash");
+_LIT(KStdKeyBackSlash, "EStdKeyBackSlash");
+_LIT(KStdKeySemiColon, "EStdKeySemiColon");
+_LIT(KStdKeySingleQuote, "EStdKeySingleQuote");
+_LIT(KStdKeyHash, "EStdKeyHash");
+_LIT(KStdKeySquareBracketLeft, "EStdKeySquareBracketLeft");
+_LIT(KStdKeySquareBracketRight, "EStdKeySquareBracketRight");
+_LIT(KStdKeyMinus, "EStdKeyMinus");
+_LIT(KStdKeyEquals, "EStdKeyEquals");
+_LIT(KStdKeyNkpForwardSlash, "EStdKeyNkpForwardSlash");
+_LIT(KStdKeyNkpAsterisk, "EStdKeyNkpAsterisk");
+_LIT(KStdKeyNkpMinus, "EStdKeyNkpMinus");
+_LIT(KStdKeyNkpPlus, "EStdKeyNkpPlus");
+_LIT(KStdKeyNkpEnter, "EStdKeyNkpEnter");
+_LIT(KStdKeyNkp1, "EStdKeyNkp1");
+_LIT(KStdKeyNkp2, "EStdKeyNkp2");
+_LIT(KStdKeyNkp3, "EStdKeyNkp3");
+_LIT(KStdKeyNkp4, "EStdKeyNkp4");
+_LIT(KStdKeyNkp5, "EStdKeyNkp5");
+_LIT(KStdKeyNkp6, "EStdKeyNkp6");
+_LIT(KStdKeyNkp7, "EStdKeyNkp7");
+_LIT(KStdKeyNkp8, "EStdKeyNkp8");
+_LIT(KStdKeyNkp9, "EStdKeyNkp9");
+_LIT(KStdKeyNkp0, "EStdKeyNkp0");
+_LIT(KStdKeyNkpFullStop, "EStdKeyNkpFullStop");
+_LIT(KStdKeyMenu, "EStdKeyMenu");
+_LIT(KStdKeyBacklightOn, "EStdKeyBacklightOn");
+_LIT(KStdKeyBacklightOff, "EStdKeyBacklightOff");
+_LIT(KStdKeyBacklightToggle, "EStdKeyBacklightToggle");
+_LIT(KStdKeyIncContrast, "EStdKeyIncContrast");
+_LIT(KStdKeyDecContrast, "EStdKeyDecContrast");
+_LIT(KStdKeySliderDown, "EStdKeySliderDown");
+_LIT(KStdKeySliderUp, "EStdKeySliderUp");
+_LIT(KStdKeyDictaphonePlay, "EStdKeyDictaphonePlay");
+_LIT(KStdKeyDictaphoneStop, "EStdKeyDictaphoneStop");
+_LIT(KStdKeyDictaphoneRecord, "EStdKeyDictaphoneRecord");
+_LIT(KStdKeyHelp, "EStdKeyHelp");
+_LIT(KStdKeyOff, "EStdKeyOff");
+_LIT(KStdKeyDial, "EStdKeyDial");
+_LIT(KStdKeyIncVolume, "EStdKeyIncVolume");
+_LIT(KStdKeyDecVolume, "EStdKeyDecVolume");
+_LIT(KStdKeyDevice0, "EStdKeyDevice0");
+_LIT(KStdKeyDevice1, "EStdKeyDevice1");
+_LIT(KStdKeyDevice2, "EStdKeyDevice2");
+_LIT(KStdKeyDevice3, "EStdKeyDevice3");
+_LIT(KStdKeyDevice4, "EStdKeyDevice4");
+_LIT(KStdKeyDevice5, "EStdKeyDevice5");
+_LIT(KStdKeyDevice6, "EStdKeyDevice6");
+_LIT(KStdKeyDevice7, "EStdKeyDevice7");
+_LIT(KStdKeyDevice8, "EStdKeyDevice8");
+_LIT(KStdKeyDevice9, "EStdKeyDevice9");
+_LIT(KStdKeyDeviceA, "EStdKeyDeviceA");
+_LIT(KStdKeyDeviceB, "EStdKeyDeviceB");
+_LIT(KStdKeyDeviceC, "EStdKeyDeviceC");
+_LIT(KStdKeyDeviceD, "EStdKeyDeviceD");
+_LIT(KStdKeyDeviceE, "EStdKeyDeviceE");
+_LIT(KStdKeyDeviceF, "EStdKeyDeviceF");
+_LIT(KStdKeyApplication0, "EStdKeyApplication0");
+_LIT(KStdKeyApplication1, "EStdKeyApplication1");
+_LIT(KStdKeyApplication2, "EStdKeyApplication2");
+_LIT(KStdKeyApplication3, "EStdKeyApplication3");
+_LIT(KStdKeyApplication4, "EStdKeyApplication4");
+_LIT(KStdKeyApplication5, "EStdKeyApplication5");
+_LIT(KStdKeyApplication6, "EStdKeyApplication6");
+_LIT(KStdKeyApplication7, "EStdKeyApplication7");
+_LIT(KStdKeyApplication8, "EStdKeyApplication8");
+_LIT(KStdKeyApplication9, "EStdKeyApplication9");
+_LIT(KStdKeyApplicationA, "EStdKeyApplicationA");
+_LIT(KStdKeyApplicationB, "EStdKeyApplicationB");
+_LIT(KStdKeyApplicationC, "EStdKeyApplicationC");
+_LIT(KStdKeyApplicationD, "EStdKeyApplicationD");
+_LIT(KStdKeyApplicationE, "EStdKeyApplicationE");
+_LIT(KStdKeyApplicationF, "EStdKeyApplicationF");
+_LIT(KStdKeyYes, "EStdKeyYes");
+_LIT(KStdKeyNo, "EStdKeyNo");
+_LIT(KStdKeyIncBrightness, "EStdKeyIncBrightness");
+_LIT(KStdKeyDecBrightness, "EStdKeyDecBrightness");
+_LIT(KStdKeyKeyboardExtend, "EStdKeyKeyboardExtend");
+_LIT(KStdKeyDevice10, "EStdKeyDevice10");
+_LIT(KStdKeyDevice11, "EStdKeyDevice11");
+_LIT(KStdKeyDevice12, "EStdKeyDevice12");
+_LIT(KStdKeyDevice13, "EStdKeyDevice13");
+_LIT(KStdKeyDevice14, "EStdKeyDevice14");
+_LIT(KStdKeyDevice15, "EStdKeyDevice15");
+_LIT(KStdKeyDevice16, "EStdKeyDevice16");
+_LIT(KStdKeyDevice17, "EStdKeyDevice17");
+_LIT(KStdKeyDevice18, "EStdKeyDevice18");
+_LIT(KStdKeyDevice19, "EStdKeyDevice19");
+_LIT(KStdKeyDevice1A, "EStdKeyDevice1A");
+_LIT(KStdKeyDevice1B, "EStdKeyDevice1B");
+_LIT(KStdKeyDevice1C, "EStdKeyDevice1C");
+_LIT(KStdKeyDevice1D, "EStdKeyDevice1D");
+_LIT(KStdKeyDevice1E, "EStdKeyDevice1E");
+_LIT(KStdKeyDevice1F, "EStdKeyDevice1F");
+_LIT(KStdKeyApplication10, "EStdKeyApplication10");
+_LIT(KStdKeyApplication11, "EStdKeyApplication11");
+_LIT(KStdKeyApplication12, "EStdKeyApplication12");
+_LIT(KStdKeyApplication13, "EStdKeyApplication13");
+_LIT(KStdKeyApplication14, "EStdKeyApplication14");
+_LIT(KStdKeyApplication15, "EStdKeyApplication15");
+_LIT(KStdKeyApplication16, "EStdKeyApplication16");
+_LIT(KStdKeyApplication17, "EStdKeyApplication17");
+_LIT(KStdKeyApplication18, "EStdKeyApplication18");
+_LIT(KStdKeyApplication19, "EStdKeyApplication19");
+_LIT(KStdKeyApplication1A, "EStdKeyApplication1A");
+_LIT(KStdKeyApplication1B, "EStdKeyApplication1B");
+_LIT(KStdKeyApplication1C, "EStdKeyApplication1C");
+_LIT(KStdKeyApplication1D, "EStdKeyApplication1D");
+_LIT(KStdKeyApplication1E, "EStdKeyApplication1E");
+_LIT(KStdKeyApplication1F, "EStdKeyApplication1F");
+
+_LIT(KTextAlignLeft, "ELeft");
+_LIT(KTextAlignCenter, "ECenter");
+_LIT(KTextAlignRight, "ERight");
+
+_LIT(KTextDirectionHorizontal, "EHorizontal");
+_LIT(KTextDirectionVertical, "EVertical");
+
+_LIT(KTypeNone, "ENone");
+_LIT(KTypePointerMove, "EPointerMove");
+_LIT(KTypePointerSwitchOn, "EPointerSwitchOn");
+_LIT(KTypeKeyDown, "EKeyDown");
+_LIT(KTypeKeyUp, "EKeyUp");
+_LIT(KTypeRedraw, "ERedraw");
+_LIT(KTypeSwitchOn, "ESwitchOn");
+_LIT(KTypeActive, "EActive");
+_LIT(KTypeInactive, "EInactive");
+_LIT(KTypeUpdateModifiers, "EUpdateModifiers");
+_LIT(KTypeButton1Down, "EButton1Down");
+_LIT(KTypeButton1Up, "EButton1Up");
+_LIT(KTypeButton2Down, "EButton2Down");
+_LIT(KTypeButton2Up, "EButton2Up");
+_LIT(KTypeButton3Down, "EButton3Down");
+_LIT(KTypeButton3Up, "EButton3Up");
+_LIT(KTypeSwitchOff, "ESwitchOff");
+_LIT(KTypeKeyRepeat, "EKeyRepeat");
+_LIT(KTypeCaseOpen, "ECaseOpen");
+_LIT(KTypeCaseClose, "ECaseClose");
+_LIT(KTypePointer3DInRange, "EPointer3DInRange");
+_LIT(KTypePointer3DOutOfRange, "EPointer3DOutOfRange");
+_LIT(KTypePointer3DTilt, "EPointer3DTilt");
+_LIT(KTypePointer3DRotation, "EPointer3DRotation");
+_LIT(KTypePointer3DTiltAndMove, "EPointer3DTiltAndMove");
+_LIT(KTypeButton4Down, "EButton4Down");
+_LIT(KTypeButton4Up, "EButton4Up");
+_LIT(KTypeButton5Down, "EButton5Down");
+_LIT(KTypeButton5Up, "EButton5Up");
+_LIT(KTypeButton6Down, "EButton6Down");
+_LIT(KTypeButton6Up, "EButton6Up");
+_LIT(KTypeRestartSystem, "ERestartSystem");
+
+_LIT(KTypeDrag, "EDrag");
+_LIT(KTypeMove, "EMove");
+_LIT(KTypeButtonRepeat, "EButtonRepeat");
+
+_LIT(KWindowBackupTypeAreaBehind, "EWindowBackupAreaBehind");
+_LIT(KWindowBackupTypeFullScreen, "EWindowBackupFullScreen");
+
+_LIT(KWsTransparencyPolicyDefault, "ETransparencyDefault");
+_LIT(KWsTransparencyPolicyFreezeUnder, "ETransparencyFreezeUnder");
+
+_LIT(KWsVisibilityChangedCanBeSeen, "ECanBeSeen");
+_LIT(KWsVisibilityChangedCantBeSeen, "ECantBeSeen");
+_LIT(KWsVisibilityChangedPartiallyVisible, "EPartiallyVisible");
+_LIT(KWsVisibilityChangedNotVisible, "ENotVisible");
+_LIT(KWsVisibilityChangedFullyVisible, "EFullyVisible");
+
+_LIT(KELongCaptureShortEventImmediately, "ELongCaptureShortEventImmediately");
+_LIT(KELongCaptureRepeatEvents, "ELongCaptureRepeatEvents");
+_LIT(KELongCaptureNormal, "ELongCaptureNormal");
+_LIT(KELongCaptureWaitShort, "ELongCaptureWaitShort");
+
+_LIT(KESpriteFlash, "ESpriteFlash");
+_LIT(KESpriteNoChildClip, "ESpriteNoChildClip");
+_LIT(KESpriteNoShadows, "ESpriteNoShadows");
+
+_LIT(KECustomTextCursorAlignTop, "ECustomTextCursorAlignTop");
+_LIT(KECustomTextCursorAlignBaseline, "ECustomTextCursorAlignBaseline");
+_LIT(KECustomTextCursorAlignBottom, "ECustomTextCursorAlignBottom");
+
+_LIT(KETypeRectangle, "ETypeRectangle");
+_LIT(KETypeHollowRectangle, "ETypeHollowRectangle");
+_LIT(KETypeFirst, "ETypeFirst");
+_LIT(KETypeLast, "ETypeLast");
+_LIT(KETypeLastBasic, "ETypeHollowRectangle");
+
+_LIT(KEFlagNoFlash, "EFlagNoFlash");
+_LIT(KEFlagClipHorizontal, "EFlagClipHorizontal");
+_LIT(KEFlagClipVertical, "EFlagClipVertical");
+
+_LIT(KTypefaceFontName, "typeface_name");
+_LIT(KIsScalable, "is_scalable");
+_LIT(KNumHeights, "num_heights");
+_LIT(KMinHeightInTwips, "min_height_in_twips");
+_LIT(KMaxHeightInTwips, "max_height_in_twips");
+
+_LIT(KProportional, "typeface_attribute_proportional");
+_LIT(KSerif, "typeface_attribute_serif");
+_LIT(KSymbol, "typeface_attribute_symbol");
+
+_LIT(KETerminateCancel, "ETerminateCancel");
+_LIT(KETerminateRegion, "ETerminateRegion");
+_LIT(KETerminateRotation, "ETerminateRotation");
+_LIT(KETerminateScreenMode, "EETerminateScreenMode");
+
+_LIT(KEColor, "EColor");
+_LIT(KETransparencyPossible, "ETransparencyPossible");
+_LIT(KEFullyScaleable, "EFullyScaleable");
+_LIT(KEConstantAspectRatio, "EConstantAspectRatio");
+_LIT(KECanDither, "ECanDither");
+_LIT(KEAlphaChannel, "EAlphaChannel");
+_LIT(KELeaveInPlace, "ELeaveInPlace");
+_LIT(KERestoreToBackground, "ERestoreToBackground");
+_LIT(KERestoreToPrevious, "ERestoreToPrevious");
+_LIT(KEPartialDecodeInvalid, "EPartialDecodeInvalid");
+_LIT(KEMngMoreFramesToDecode, "EMngMoreFramesToDecode");
+_LIT(KEUsesFrameSizeInPixels, "EUsesFrameSizeInPixels");
+
+_LIT(KEFrameInfoUninitialised, "EFrameInfoUninitialised");
+_LIT(KEFrameInfoProcessingFrameHeader, "EFrameInfoProcessingFrameHeader");
+_LIT(KEFrameInfoProcessingFrame, "EFrameInfoProcessingFrame");
+_LIT(KEFrameInfoProcessingComplete, "EFrameInfoProcessingComplete");
+
+_LIT(KFldFrameInfoState, "frameinfostate");
+_LIT(KFldCurrentDataOffset, "currentdataoffset");
+_LIT(KFldFrameDataOffset, "framedataoffset");
+_LIT(KFldFrameCoordsInPixels, "framecoordsinpixels");
+_LIT(KFldFrameSizeInTwips, "framesizeintwips");
+_LIT(KFldBitsPerPixel, "bitsPerPixel");
+_LIT(KFldDelay, "delay");
+_LIT(KFldFlags, "flags");
+_LIT(KFldOverallSizeInPixels, "overallsizeinpixels");
+_LIT(KFldFrameDisplayMode, "framedisplaymode");
+_LIT(KFldBackgroundColor, "backgroundcolor");
+_LIT(KFldFrameSizeInPixels, "framesizeinpixels");
+
+_LIT(KFldProcessName, "processname");
+_LIT(KFldId, "id");
+_LIT(KFldRect, "rect");
+_LIT(KFldWsga, "wsga");
+
+//For MAnim
+//Opcodes for Util
+_LIT(KEMAnimECmdRetrieveResult, "ECmdRetrieveResult");
+_LIT(KEMAnimECmdUtilEatupMemory, "ECmdUtilEatupMemory");
+_LIT(KEMAnimECmdUtilFreeEatenMemory, "ECmdUtilFreeEatenMemory");
+//Opcodes for MAnimGeneralFunctions
+_LIT(KEMAnimECmdGeneralAnimate, "ECmdGeneralAnimate");
+_LIT(KEMAnimECmdGeneralClient, "ECmdGeneralClient");
+_LIT(KEMAnimECmdGeneralFlashStateOn, "ECmdGeneralFlashStateOn");
+_LIT(KEMAnimECmdGeneralPanic, "ECmdGeneralPanic");
+_LIT(KEMAnimECmdGeneralScreenDevice, "ECmdGeneralScreenDevice");
+_LIT(KEMAnimECmdGeneralExtendedInterface, "ECmdGeneralExtendedInterface");
+_LIT(KEMAnimECmdGeneralWindowExtension, "ECmdGeneralWindowExtension");
+_LIT(KEMAnimECmdGeneralNumOfExtInterfaces, "ECmdGeneralNumOfExtInterfaces");
+_LIT(KEMAnimECmdGeneralEventExtension , "ECmdGeneralEventExtension");
+_LIT(KEMAnimECmdGeneralGetRawEvents , "ECmdGeneralGetRawEvents");
+_LIT(KEMAnimECmdGeneralPostRawEvent , "ECmdGeneralPostRawEvent");
+_LIT(KEMAnimECmdGeneralPostKeyEvent , "ECmdGeneralPostKeyEvent");
+_LIT(KEMAnimECmdGeneralSetSync , "ECmdGeneralSetSync");
+_LIT(KEMAnimECmdGeneralSync , "ECmdGeneralSync");
+_LIT(KEMAnimECmdGeneralSetInterval , "ECmdGeneralSetInterval");
+_LIT(KEMAnimECmdGeneralSetNextInterval , "ECmdGeneralSetNextInterval");
+_LIT(KEMAnimECmdGeneralSystemTime, "ECmdGeneralSystemTime");
+_LIT(KEMAnimECmdGeneralRegisterForNotis, "ECmdGeneralRegisterForNotis");
+_LIT(KEMAnimECmdGeneralMessage, "ECmdGeneralMessage");
+_LIT(KEMAnimECmdGeneralDuplicateBitmapL, "ECmdGeneralDuplicateBitmapL");
+_LIT(KEMAnimECmdGeneralDuplicateFontL, "ECmdGeneralDuplicateFontL");
+_LIT(KEMAnimECmdGeneralCloseFont, "ECmdGeneralCloseFont");
+_LIT(KEMAnimECmdGeneralReplyBuf8, "ECmdGeneralReplyBuf8");
+_LIT(KEMAnimECmdGeneralReplyBuf16, "ECmdGeneralReplyBuf16");
+
+//Opcodes for MAnimSpriteFunctions
+_LIT(KEMAnimECmdSpriteGetSpriteMember, "ECmdSpriteGetSpriteMember");
+_LIT(KEMAnimECmdSpriteUpdateMember, "ECmdSpriteUpdateMember");
+_LIT(KEMAnimECmdSpriteActivate, "ECmdSpriteActivate");
+_LIT(KEMAnimECmdSpriteSpriteCanBeSeen, "ECmdSpriteSpriteCanBeSeen");
+_LIT(KEMAnimECmdSpriteSizeChangedL, "ECmdSpriteSizeChangedL");
+_LIT(KEMAnimECmdSpriteSetPosition, "ECmdSpriteSetPosition");
+
+
+
+//Opcodes for MAnimWindowFunctions
+_LIT(KEMAnimECmdWindowActivateGc, "ECmdWindowActivateGc");//Verify the return value is expected
+_LIT(KEMAnimECmdWindowSetRect, "ECmdWindowSetRect");
+_LIT(KEMAnimECmdWindowWindowSize, "ECmdWindowWindowSize");
+_LIT(KEMAnimECmdWindowIsHidden, "ECmdWindowIsHidden");
+_LIT(KEMAnimECmdWindowSetVisible, "ECmdWindowSetVisible");
+_LIT(KEMAnimECmdWindowInvalidate, "ECmdWindowInvalidate");
+_LIT(KEMAnimECmdWindowParameters, "ECmdWindowParameters");
+_LIT(KEMAnimECmdWindowVisibleRegion, "ECmdWindowVisibleRegion");
+_LIT(KEMAnimECmdWindowIsStarted, "ECmdWindowIsStarted");
+
+//Opcodes for MAnimFreeTimerWindowFunctions
+_LIT(KEMAnimECmdFreeTimerWinDeactivateGc, "ECmdFreeTimerWinDeactivateGc");
+_LIT(KEMAnimECmdFreeTimerWinUpdate, "ECmdFreeTimerWinUpdate");
+
+//Opcodes for MAnimGeneralFunctionsWindowExtension
+_LIT(KEMAnimECmdGfweScreens, "ECmdGfweScreens");
+_LIT(KEMAnimECmdGfweFocusScreens, "ECmdGfweFocusScreens");
+_LIT(KEMAnimECmdGfweSetFocusScreen, "ECmdGfweSetFocusScreen");
+_LIT(KEMAnimECmdGfweWindowGroups, "ECmdGfweWindowGroups");
+_LIT(KEMAnimECmdGfweWindowGroupInfo, "ECmdGfweWindowGroupInfo");
+_LIT(KEMAnimECmdGfweWindowGroupName, "ECmdGfweWindowGroupName");//use handle to verify it in server side
+_LIT(KEMAnimECmdGfweSetOrdinalPosition, "ECmdGfweSetOrdinalPosition");
+_LIT(KEMAnimECmdGfweIsFocusable, "ECmdGfweIsFocusable");
+
+
+_LIT(KEAnimWindows, "EKWindowAnim");
+_LIT(KEAnimSprite, "EKSpriteAnim");
+_LIT(KEAnimFreeTimer, "EKFreeTimerWindowAnim");
+
+
+_LIT(KEAnimCmdSync, "ECmdSync");
+_LIT(KEAnimCmdTestWithoutPara, "ECmdTestWithoutPara");
+_LIT(KEAnimCmdTestWithPara, "ECmdTestWithPara");
+_LIT(KEAnimCmdGetLast, "ECmdGetLast");
+_LIT(KEAnimCmdGetAnimInterval, "ECmdGetAnimInterval");
+
+_LIT(KEGraphicsOrientationNormal, "EGraphicsOrientationNormal");
+_LIT(KEGraphicsOrientationRotated90, "EGraphicsOrientationRotated90");
+_LIT(KEGraphicsOrientationRotated180, "EGraphicsOrientationRotated180");
+_LIT(KEGraphicsOrientationRotated270, "EGraphicsOrientationRotated270");
+//For CPolygonFiller
+_LIT(KUsageEGetAllPixelRunsSequentially, "EGetAllPixelRunsSequentially");
+_LIT(KUsageEGetPixelRunsSequentiallyForSpecifiedScanLines,"EGetPixelRunsSequentiallyForSpecifiedScanLines");
+
+/*@}*/
+
+RPointerArray < TAny > CT_GraphicsUtil::iMemArray;
+TInt CT_GraphicsUtil::iAvaiableSpace=0;
+TInt CT_GraphicsUtil::iBiggestBlock=0;
+
+TBool CT_GraphicsUtil::ReadBitmapfileCompressionScheme(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TBitmapfileCompressionScheme& aCompressionScheme)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KRLECompression )
+ {
+ aCompressionScheme=ERLECompression;
+ }
+ else if ( str==KPaletteCompression )
+ {
+ aCompressionScheme=EPaletteCompression;
+ }
+ else if ( str==KPaletteCompressionWithRLEFallback )
+ {
+ aCompressionScheme=EPaletteCompressionWithRLEFallback;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aCompressionScheme=(TBitmapfileCompressionScheme)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadBrushStyle(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TBrushStyle& aBrushStyle)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KBrushStyleNull )
+ {
+ aBrushStyle=CGraphicsContext::ENullBrush;
+ }
+ else if ( str==KBrushStyleSolid )
+ {
+ aBrushStyle=CGraphicsContext::ESolidBrush;
+ }
+ else if ( str==KBrushStylePatterned )
+ {
+ aBrushStyle=CGraphicsContext::EPatternedBrush;
+ }
+ else if ( str==KBrushStyleVerticalHatch )
+ {
+ aBrushStyle=CGraphicsContext::EVerticalHatchBrush;
+ }
+ else if ( str==KBrushStyleForwardDiagonalHatch )
+ {
+ aBrushStyle=CGraphicsContext::EForwardDiagonalHatchBrush;
+ }
+ else if ( str==KBrushStyleHorizontalHatch )
+ {
+ aBrushStyle=CGraphicsContext::EHorizontalHatchBrush;
+ }
+ else if ( str==KBrushStyleRearwardDiagonalHatch )
+ {
+ aBrushStyle=CGraphicsContext::ERearwardDiagonalHatchBrush;
+ }
+ else if ( str==KBrushStyleSquareCrossHatch )
+ {
+ aBrushStyle=CGraphicsContext::ESquareCrossHatchBrush;
+ }
+ else if ( str==KBrushStyleDiamondCrossHatch )
+ {
+ aBrushStyle=CGraphicsContext::EDiamondCrossHatchBrush;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aBrushStyle=(CGraphicsContext::TBrushStyle)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadCaptureFlags(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aCaptureFlags)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ TUint temp=0;
+ ret=ConvertToCaptureFlags(str, temp);
+ if ( ret )
+ {
+ aCaptureFlags=temp;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToCaptureFlags(const TDesC& aStr, RWindowBase::TCaptureFlags& aCaptureFlags)
+ {
+ TBool ret=ETrue;
+ if ( aStr==KCaptureFlagEnabled )
+ {
+ aCaptureFlags=RWindowBase::TCaptureFlagEnabled;
+ }
+ else if ( aStr==KCaptureFlagDragDrop )
+ {
+ aCaptureFlags=RWindowBase::TCaptureFlagDragDrop;
+ }
+ else if ( aStr==KCaptureFlagAllGroups )
+ {
+ aCaptureFlags=RWindowBase::TCaptureFlagAllGroups;
+ }
+ else if ( aStr==KCaptureDisabled )
+ {
+ aCaptureFlags=RWindowBase::TCaptureDisabled;
+ }
+ else if ( aStr==KCaptureEnabled )
+ {
+ aCaptureFlags=RWindowBase::TCaptureEnabled;
+ }
+ else if ( aStr==KCaptureDragDrop )
+ {
+ aCaptureFlags=RWindowBase::TCaptureDragDrop;
+ }
+ else
+ {
+ TUint captureFlags;
+ TLex lex(aStr);
+ ret=(lex.Val(captureFlags, EHex)==KErrNone);
+ if ( ret )
+ {
+ aCaptureFlags=(RWindowBase::TCaptureFlags)captureFlags;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToCaptureFlags(const TDesC& aStr, TUint& aCaptureFlags)
+ {
+ TBool ret=ETrue;
+ TInt location=aStr.Match(_L("*|*"));
+ if( location!=KErrNotFound )
+ {
+ // Converting Left part of the data
+ TPtrC tempStr=aStr.Left(location);
+ ret=ConvertToCaptureFlags(tempStr, aCaptureFlags);
+
+ // Converting right data can be with another "|"
+ tempStr.Set(aStr.Mid(location+1));
+
+ TUint temp;
+ if ( ConvertToCaptureFlags(tempStr, temp) )
+ {
+ aCaptureFlags|=temp;
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ }
+ else
+ {
+ RWindowBase::TCaptureFlags captureFlags;
+ ret=ConvertToCaptureFlags(aStr, captureFlags);
+ if ( ret )
+ {
+ aCaptureFlags=(TUint)captureFlags;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadComputeMode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RWsSession::TComputeMode& aComputeMode)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KComputeModePriorityControlDisabled )
+ {
+ aComputeMode=RWsSession::EPriorityControlDisabled;
+ }
+ else if ( str==KComputeModePriorityControlComputeOn )
+ {
+ aComputeMode=RWsSession::EPriorityControlComputeOn;
+ }
+ else if ( str==KComputeModePriorityControlComputeOff )
+ {
+ aComputeMode=RWsSession::EPriorityControlComputeOff;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aComputeMode=(RWsSession::TComputeMode)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadCornerType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TCornerType& aCornerType)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KCornerTypeWindowSquare )
+ {
+ aCornerType=EWindowCornerSquare;
+ }
+ else if ( str==KCornerTypeWindow1 )
+ {
+ aCornerType=EWindowCorner1;
+ }
+ else if ( str==KCornerTypeWindow2 )
+ {
+ aCornerType=EWindowCorner2;
+ }
+ else if ( str==KCornerTypeWindow3 )
+ {
+ aCornerType=EWindowCorner3;
+ }
+ else if ( str==KCornerTypeWindow5 )
+ {
+ aCornerType=EWindowCorner5;
+ }
+ else if ( str==KCornerTypeWindowRegion )
+ {
+ aCornerType=EWindowCornerRegion;
+ }
+ else if ( str==KCornerTypeMask )
+ {
+ aCornerType=ECornerTypeMask;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aCornerType=(TCornerType)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadDisplayMode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TDisplayMode& aDisplayMode)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KDisplayModeNone )
+ {
+ aDisplayMode=ENone;
+ }
+ else if ( str==KDisplayModeGray2 )
+ {
+ aDisplayMode=EGray2;
+ }
+ else if ( str==KDisplayModeGray4 )
+ {
+ aDisplayMode=EGray4;
+ }
+ else if ( str==KDisplayModeGray16 )
+ {
+ aDisplayMode=EGray16;
+ }
+ else if ( str==KDisplayModeGray256 )
+ {
+ aDisplayMode=EGray256;
+ }
+ else if ( str==KDisplayModeColor16 )
+ {
+ aDisplayMode=EColor16;
+ }
+ else if ( str==KDisplayModeColor256 )
+ {
+ aDisplayMode=EColor256;
+ }
+ else if ( str==KDisplayModeColor64K )
+ {
+ aDisplayMode=EColor64K;
+ }
+ else if ( str==KDisplayModeColor16M )
+ {
+ aDisplayMode=EColor16M;
+ }
+ else if ( str==KDisplayModeRgb )
+ {
+ aDisplayMode=ERgb;
+ }
+ else if ( str==KDisplayModeColor4K )
+ {
+ aDisplayMode=EColor4K;
+ }
+ else if ( str==KDisplayModeColor16MU )
+ {
+ aDisplayMode=EColor16MU;
+ }
+ else if ( str==KDisplayModeColor16MA )
+ {
+ aDisplayMode=EColor16MA;
+ }
+ else if ( str==KDisplayModeColor16MAP )
+ {
+ aDisplayMode=EColor16MAP;
+ }
+ else if ( str==KDisplayModeColorLast )
+ {
+ aDisplayMode=EColorLast;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aDisplayMode=(TDisplayMode)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadDrawMode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TDrawMode& aDrawMode)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KDrawModeAND )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeAND;
+ }
+ else if ( str==KDrawModeNOTAND )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeNOTAND;
+ }
+ else if ( str==KDrawModePEN )
+ {
+ aDrawMode=CGraphicsContext::EDrawModePEN;
+ }
+ else if ( str==KDrawModeANDNOT )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeANDNOT;
+ }
+ else if ( str==KDrawModeXOR )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeXOR;
+ }
+ else if ( str==KDrawModeOR )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeOR;
+ }
+ else if ( str==KDrawModeNOTANDNOT )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeNOTANDNOT;
+ }
+ else if ( str==KDrawModeNOTXOR )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeNOTXOR;
+ }
+ else if ( str==KDrawModeNOTSCREEN )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeNOTSCREEN;
+ }
+ else if ( str==KDrawModeNOTOR )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeNOTOR;
+ }
+ else if ( str==KDrawModeNOTPEN )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeNOTPEN;
+ }
+ else if ( str==KDrawModeORNOT )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeORNOT;
+ }
+ else if ( str==KDrawModeNOTORNOT )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeNOTORNOT;
+ }
+ else if ( str==KDrawModeWriteAlpha )
+ {
+ aDrawMode=CGraphicsContext::EDrawModeWriteAlpha;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aDrawMode=(CGraphicsContext::TDrawMode)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadErrorCategory(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsErrorMessage::TErrorCategory& aErrorCategory)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KErrorCategoryDrawingRegion )
+ {
+ aErrorCategory=TWsErrorMessage::EDrawingRegion;
+ }
+ else if ( str==KErrorCategoryBackLight )
+ {
+ aErrorCategory=TWsErrorMessage::EBackLight;
+ }
+ else if ( str==KErrorCategoryLogging )
+ {
+ aErrorCategory=TWsErrorMessage::ELogging;
+ }
+ else if ( str==KErrorCategoryContrast )
+ {
+ aErrorCategory=TWsErrorMessage::EContrast;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aErrorCategory=(TWsErrorMessage::TErrorCategory)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadEventCode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TEventCode& aEventCode)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KEventCodeNull )
+ {
+ aEventCode=EEventNull;
+ }
+ else if ( str==KEventCodeKey )
+ {
+ aEventCode=EEventKey;
+ }
+ else if ( str==KEventCodeKeyUp )
+ {
+ aEventCode=EEventKeyUp;
+ }
+ else if ( str==KEventCodeKeyDown )
+ {
+ aEventCode=EEventKeyDown;
+ }
+ else if ( str==KEventCodeModifiersChanged )
+ {
+ aEventCode=EEventModifiersChanged;
+ }
+ else if ( str==KEventCodePointer )
+ {
+ aEventCode=EEventPointer;
+ }
+ else if ( str==KEventCodePointerEnter )
+ {
+ aEventCode=EEventPointerEnter;
+ }
+ else if ( str==KEventCodePointerExit )
+ {
+ aEventCode=EEventPointerExit;
+ }
+ else if ( str==KEventCodePointerBufferReady )
+ {
+ aEventCode=EEventPointerBufferReady;
+ }
+ else if ( str==KEventCodeDragDrop )
+ {
+ aEventCode=EEventDragDrop;
+ }
+ else if ( str==KEventCodeFocusLost )
+ {
+ aEventCode=EEventFocusLost;
+ }
+ else if ( str==KEventCodeFocusGained )
+ {
+ aEventCode=EEventFocusGained;
+ }
+ else if ( str==KEventCodeSwitchOn )
+ {
+ aEventCode=EEventSwitchOn;
+ }
+ else if ( str==KEventCodePassword )
+ {
+ aEventCode=EEventPassword;
+ }
+ else if ( str==KEventCodeWindowGroupsChanged )
+ {
+ aEventCode=EEventWindowGroupsChanged;
+ }
+ else if ( str==KEventCodeErrorMessage )
+ {
+ aEventCode=EEventErrorMessage;
+ }
+ else if ( str==KEventCodeMessageReady )
+ {
+ aEventCode=EEventMessageReady;
+ }
+ else if ( str==KEventCodeMarkInvalid )
+ {
+ aEventCode=EEventMarkInvalid;
+ }
+ else if ( str==KEventCodeSwitchOff )
+ {
+ aEventCode=EEventSwitchOff;
+ }
+ else if ( str==KEventCodeKeySwitchOff )
+ {
+ aEventCode=EEventKeySwitchOff;
+ }
+ else if ( str==KEventCodeScreenDeviceChanged )
+ {
+ aEventCode=EEventScreenDeviceChanged;
+ }
+ else if ( str==KEventCodeFocusGroupChanged )
+ {
+ aEventCode=EEventFocusGroupChanged;
+ }
+ else if ( str==KEventCodeCaseOpened )
+ {
+ aEventCode=EEventCaseOpened;
+ }
+ else if ( str==KEventCodeCaseClosed )
+ {
+ aEventCode=EEventCaseClosed;
+ }
+ else if ( str==KEventCodeWindowGroupListChanged )
+ {
+ aEventCode=EEventWindowGroupListChanged;
+ }
+ else if ( str==KEventCodeWindowVisibilityChanged )
+ {
+ aEventCode=EEventWindowVisibilityChanged;
+ }
+#if (defined SYMBIAN_PROCESS_MONITORING_AND_STARTUP)
+ else if ( str==KEventCodeRestartSystem )
+ {
+ aEventCode=EEventRestartSystem;
+ }
+#endif
+ else if ( str==KEventCodeKeyRepeat )
+ {
+ aEventCode=EEventKeyRepeat;
+ }
+ else if ( str==KEventCodeDirectScreenAccessBegin )
+ {
+ aEventCode=EEventDirectScreenAccessBegin;
+ }
+ else if ( str==KEventCodeDirectScreenAccessEnd )
+ {
+ aEventCode=EEventDirectScreenAccessEnd;
+ }
+ else if ( str==KEventCodeHeartbeatTimerStateChange )
+ {
+ aEventCode=EEventHeartbeatTimerStateChange;
+ }
+ else if ( str==KEventCodePowerMgmt )
+ {
+ aEventCode=EEventPowerMgmt;
+ }
+ else if ( str==KEventCodeReserved )
+ {
+ aEventCode=EEventReserved;
+ }
+ else if ( str==KEventCodeUser )
+ {
+ aEventCode=EEventUser;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aEventCode=(TEventCode)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadEventControl(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TEventControl& aEventControl)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KEventControlAlways )
+ {
+ aEventControl=EEventControlAlways;
+ }
+ else if ( str==KEventControlOnlyWithKeyboardFocus )
+ {
+ aEventControl=EEventControlOnlyWithKeyboardFocus;
+ }
+ else if ( str==KEventControlOnlyWhenVisible )
+ {
+ aEventControl=EEventControlOnlyWhenVisible;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aEventControl=(TEventControl)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadEventModifier(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TEventModifier& aEventModifier)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ ret=ConvertToEventModifier(str, aEventModifier);
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadEventModifier(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aEventModifier)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ TUint temp=0;
+ ret=ConvertToEventModifier(str, temp);
+ if ( ret )
+ {
+ aEventModifier=temp;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToEventModifier(const TDesC& aStr, TEventModifier& aEventModifier)
+ {
+ TBool ret=ETrue;
+ if ( aStr==KEventModifierAutorepeatable )
+ {
+ aEventModifier=EModifierAutorepeatable;
+ }
+ else if ( aStr==KEventModifierKeypad )
+ {
+ aEventModifier=EModifierKeypad;
+ }
+ else if ( aStr==KEventModifierLeftAlt )
+ {
+ aEventModifier=EModifierLeftAlt;
+ }
+ else if ( aStr==KEventModifierRightAlt )
+ {
+ aEventModifier=EModifierRightAlt;
+ }
+ else if ( aStr==KEventModifierAlt )
+ {
+ aEventModifier=EModifierAlt;
+ }
+ else if ( aStr==KEventModifierLeftCtrl )
+ {
+ aEventModifier=EModifierLeftCtrl;
+ }
+ else if ( aStr==KEventModifierRightCtrl )
+ {
+ aEventModifier=EModifierRightCtrl;
+ }
+ else if ( aStr==KEventModifierCtrl )
+ {
+ aEventModifier=EModifierCtrl;
+ }
+ else if ( aStr==KEventModifierLeftShift )
+ {
+ aEventModifier=EModifierLeftShift;
+ }
+ else if ( aStr==KEventModifierRightShift )
+ {
+ aEventModifier=EModifierRightShift;
+ }
+ else if ( aStr==KEventModifierShift )
+ {
+ aEventModifier=EModifierShift;
+ }
+ else if ( aStr==KEventModifierLeftFunc )
+ {
+ aEventModifier=EModifierLeftFunc;
+ }
+ else if ( aStr==KEventModifierRightFunc )
+ {
+ aEventModifier=EModifierRightFunc;
+ }
+ else if ( aStr==KEventModifierFunc )
+ {
+ aEventModifier=EModifierFunc;
+ }
+ else if ( aStr==KEventModifierCapsLock )
+ {
+ aEventModifier=EModifierCapsLock;
+ }
+ else if ( aStr==KEventModifierNumLock )
+ {
+ aEventModifier=EModifierNumLock;
+ }
+ else if ( aStr==KEventModifierScrollLock )
+ {
+ aEventModifier=EModifierScrollLock;
+ }
+ else if ( aStr==KEventModifierKeyUp )
+ {
+ aEventModifier=EModifierKeyUp;
+ }
+ else if ( aStr==KEventModifierSpecial )
+ {
+ aEventModifier=EModifierSpecial;
+ }
+ else if ( aStr==KEventModifierDoubleClick )
+ {
+ aEventModifier=EModifierDoubleClick;
+ }
+ else if ( aStr==KEventModifierPureKeycode )
+ {
+ aEventModifier=EModifierPureKeycode;
+ }
+ else if ( aStr==KEventModifierKeyboardExtend )
+ {
+ aEventModifier=EModifierKeyboardExtend;
+ }
+ else if ( aStr==KEventModifierCancelRotation )
+ {
+ aEventModifier=EModifierCancelRotation;
+ }
+ else if ( aStr==KEventModifierRotateBy90 )
+ {
+ aEventModifier=EModifierRotateBy90;
+ }
+ else if ( aStr==KEventModifierRotateBy180 )
+ {
+ aEventModifier=EModifierRotateBy180;
+ }
+ else if ( aStr==KEventModifierRotateBy270 )
+ {
+ aEventModifier=EModifierRotateBy270;
+ }
+ else if ( aStr==KEventModifierPointer3DButton1 )
+ {
+ aEventModifier=EModifierPointer3DButton1;
+ }
+ else if ( aStr==KEventModifierPointer3DButton2 )
+ {
+ aEventModifier=EModifierPointer3DButton2;
+ }
+ else if ( aStr==KEventModifierPointer3DButton3 )
+ {
+ aEventModifier=EModifierPointer3DButton3;
+ }
+ else if ( aStr==KEventModifierAll )
+ {
+ aEventModifier=EAllModifiers;
+ }
+ else
+ {
+ TUint eventModifier;
+ TLex lex(aStr);
+ ret=(lex.Val(eventModifier, EHex)==KErrNone);
+ if ( ret )
+ {
+ aEventModifier=(TEventModifier)eventModifier;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToEventModifier(const TDesC& aStr, TUint& aEventModifier)
+ {
+ TBool ret=ETrue;
+ TInt location=aStr.Match(_L("*|*"));
+ if( location!=KErrNotFound )
+ {
+ // Converting Left part of the data
+ TPtrC tempStr=aStr.Left(location);
+ ret=ConvertToEventModifier(tempStr, aEventModifier);
+
+ // Converting right data can be with another "|"
+ tempStr.Set(aStr.Mid(location+1));
+
+ TUint temp;
+ if ( ConvertToEventModifier(tempStr, temp) )
+ {
+ aEventModifier|=temp;
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ }
+ else
+ {
+ TEventModifier eventModifier;
+ ret=ConvertToEventModifier(aStr, eventModifier);
+ if ( ret )
+ {
+ aEventModifier=(TUint)eventModifier;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadFadeControl(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RWindowTreeNode::TFadeControl& aFadeControl)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KFadeControlIncludeChildren )
+ {
+ aFadeControl=RWindowTreeNode::EFadeIncludeChildren;
+ }
+ else if ( str==KFadeControlWindowOnly )
+ {
+ aFadeControl=RWindowTreeNode::EFadeWindowOnly;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aFadeControl=(RWindowTreeNode::TFadeControl)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadFillRule(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TFillRule& aFillRule)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KFillRuleAlternate )
+ {
+ aFillRule=CGraphicsContext::EAlternate;
+ }
+ else if ( str==KFillRuleEWinding )
+ {
+ aFillRule=CGraphicsContext::EWinding;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aFillRule=(CGraphicsContext::TFillRule)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadTUsage(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CPolygonFiller::TUsage& aUsage)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if (ret)
+ {
+ if (str==KUsageEGetAllPixelRunsSequentially)
+ {
+ aUsage=CPolygonFiller::EGetAllPixelRunsSequentially;
+ }
+ else if (str==KUsageEGetPixelRunsSequentiallyForSpecifiedScanLines)
+ {
+ aUsage=CPolygonFiller::EGetPixelRunsSequentiallyForSpecifiedScanLines;
+ }
+ }
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadFontStrikethrough(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TFontStrikethrough& aFontStrikethrough)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KFontStrikethroughOff )
+ {
+ aFontStrikethrough=EStrikethroughOff;
+ }
+ else if ( str==KFontStrikethroughOn )
+ {
+ aFontStrikethrough=EStrikethroughOn;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aFontStrikethrough=(TFontStrikethrough)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadFontUnderline(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TFontUnderline& aFontUnderline)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KFontUnderlineOff )
+ {
+ aFontUnderline=EUnderlineOff;
+ }
+ else if ( str==KFontUnderlineOn )
+ {
+ aFontUnderline=EUnderlineOn;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aFontUnderline=(TFontUnderline)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadHotKey(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, THotKey& aHotKey)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KHotKeyEnableLogging )
+ {
+ aHotKey=EHotKeyEnableLogging;
+ }
+ else if ( str==KHotKeyDisableLogging )
+ {
+ aHotKey=EHotKeyDisableLogging;
+ }
+ else if ( str==KHotKeyStateDump )
+ {
+ aHotKey=EHotKeyStateDump;
+ }
+ else if ( str==KHotKeyOfDeath )
+ {
+ aHotKey=EHotKeyOfDeath;
+ }
+ else if ( str==KHotKeyShutDown )
+ {
+ aHotKey=EHotKeyShutDown;
+ }
+ else if ( str==KHotKeyHeapDump )
+ {
+ aHotKey=EHotKeyHeapDump;
+ }
+ else if ( str==KHotKeyIncContrast )
+ {
+ aHotKey=EHotKeyIncContrast;
+ }
+ else if ( str==KHotKeyDecContrast )
+ {
+ aHotKey=EHotKeyDecContrast;
+ }
+ else if ( str==KHotKeyOff )
+ {
+ aHotKey=EHotKeyOff;
+ }
+ else if ( str==KHotKeyBacklightOn )
+ {
+ aHotKey=EHotKeyBacklightOn;
+ }
+ else if ( str==KHotKeyBacklightOff )
+ {
+ aHotKey=EHotKeyBacklightOff;
+ }
+ else if ( str==KHotKeyBacklightToggle )
+ {
+ aHotKey=EHotKeyBacklightToggle;
+ }
+ else if ( str==KHotKeyScreenDimension0 )
+ {
+ aHotKey=EHotKeyScreenDimension0;
+ }
+ else if ( str==KHotKeyScreenDimension1 )
+ {
+ aHotKey=EHotKeyScreenDimension1;
+ }
+ else if ( str==KHotKeyScreenDimension2 )
+ {
+ aHotKey=EHotKeyScreenDimension2;
+ }
+ else if ( str==KHotKeyScreenDimension3 )
+ {
+ aHotKey=EHotKeyScreenDimension3;
+ }
+ else if ( str==KHotKeyCycleDisplaySize )
+ {
+ aHotKey=EHotKeyCycleDisplaySize;
+ }
+ else if ( str==KHotKeyCycleOrientation )
+ {
+ aHotKey=EHotKeyCycleOrientation;
+ }
+ else if ( str==KHotKeyIncBrightness )
+ {
+ aHotKey=EHotKeyIncBrightness;
+ }
+ else if ( str==KHotKeyDecBrightness )
+ {
+ aHotKey=EHotKeyDecBrightness;
+ }
+ else if ( str==KHotKeyCycleFocusScreen )
+ {
+ aHotKey=EHotKeyCycleFocusScreen;
+ }
+ else if ( str==KHotKeyFirstKeyType )
+ {
+ aHotKey=EHotKeyFirstKeyType;
+ }
+ else if ( str==KHotKeyLastKeyType )
+ {
+ aHotKey=EHotKeyLastKeyType;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aHotKey=(THotKey)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadKeyCode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TKeyCode& aKeyCode)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KKeyNull )
+ {
+ aKeyCode=EKeyNull;
+ }
+ else if ( str==KKeyBell )
+ {
+ aKeyCode=EKeyBell;
+ }
+ else if ( str==KKeyBackspace )
+ {
+ aKeyCode=EKeyBackspace;
+ }
+ else if ( str==KKeyTab )
+ {
+ aKeyCode=EKeyTab;
+ }
+ else if ( str==KKeyLineFeed )
+ {
+ aKeyCode=EKeyLineFeed;
+ }
+ else if ( str==KKeyVerticalTab )
+ {
+ aKeyCode=EKeyVerticalTab;
+ }
+ else if ( str==KKeyFormFeed )
+ {
+ aKeyCode=EKeyFormFeed;
+ }
+ else if ( str==KKeyEnter )
+ {
+ aKeyCode=EKeyEnter;
+ }
+ else if ( str==KKeyEscape )
+ {
+ aKeyCode=EKeyEscape;
+ }
+ else if ( str==KKeySpace )
+ {
+ aKeyCode=EKeySpace;
+ }
+ else if ( str==KKeyDelete )
+ {
+ aKeyCode=EKeyDelete;
+ }
+ else if ( str==KKeyPrintScreen )
+ {
+ aKeyCode=EKeyPrintScreen;
+ }
+ else if ( str==KKeyPause )
+ {
+ aKeyCode=EKeyPause;
+ }
+ else if ( str==KKeyHome )
+ {
+ aKeyCode=EKeyHome;
+ }
+ else if ( str==KKeyEnd )
+ {
+ aKeyCode=EKeyEnd;
+ }
+ else if ( str==KKeyPageUp )
+ {
+ aKeyCode=EKeyPageUp;
+ }
+ else if ( str==KKeyPageDown )
+ {
+ aKeyCode=EKeyPageDown;
+ }
+ else if ( str==KKeyInsert )
+ {
+ aKeyCode=EKeyInsert;
+ }
+ else if ( str==KKeyLeftArrow )
+ {
+ aKeyCode=EKeyLeftArrow;
+ }
+ else if ( str==KKeyRightArrow )
+ {
+ aKeyCode=EKeyRightArrow;
+ }
+ else if ( str==KKeyUpArrow )
+ {
+ aKeyCode=EKeyUpArrow;
+ }
+ else if ( str==KKeyDownArrow )
+ {
+ aKeyCode=EKeyDownArrow;
+ }
+ else if ( str==KKeyLeftShift )
+ {
+ aKeyCode=EKeyLeftShift;
+ }
+ else if ( str==KKeyRightShift )
+ {
+ aKeyCode=EKeyRightShift;
+ }
+ else if ( str==KKeyLeftAlt )
+ {
+ aKeyCode=EKeyLeftAlt;
+ }
+ else if ( str==KKeyRightAlt )
+ {
+ aKeyCode=EKeyRightAlt;
+ }
+ else if ( str==KKeyLeftCtrl )
+ {
+ aKeyCode=EKeyLeftCtrl;
+ }
+ else if ( str==KKeyRightCtrl )
+ {
+ aKeyCode=EKeyRightCtrl;
+ }
+ else if ( str==KKeyLeftFunc )
+ {
+ aKeyCode=EKeyLeftFunc;
+ }
+ else if ( str==KKeyRightFunc )
+ {
+ aKeyCode=EKeyRightFunc;
+ }
+ else if ( str==KKeyCapsLock )
+ {
+ aKeyCode=EKeyCapsLock;
+ }
+ else if ( str==KKeyNumLock )
+ {
+ aKeyCode=EKeyNumLock;
+ }
+ else if ( str==KKeyScrollLock )
+ {
+ aKeyCode=EKeyScrollLock;
+ }
+ else if ( str==KKeyF1 )
+ {
+ aKeyCode=EKeyF1;
+ }
+ else if ( str==KKeyF2 )
+ {
+ aKeyCode=EKeyF2;
+ }
+ else if ( str==KKeyF3 )
+ {
+ aKeyCode=EKeyF3;
+ }
+ else if ( str==KKeyF4 )
+ {
+ aKeyCode=EKeyF4;
+ }
+ else if ( str==KKeyF5 )
+ {
+ aKeyCode=EKeyF5;
+ }
+ else if ( str==KKeyF6 )
+ {
+ aKeyCode=EKeyF6;
+ }
+ else if ( str==KKeyF7 )
+ {
+ aKeyCode=EKeyF7;
+ }
+ else if ( str==KKeyF8 )
+ {
+ aKeyCode=EKeyF8;
+ }
+ else if ( str==KKeyF9 )
+ {
+ aKeyCode=EKeyF9;
+ }
+ else if ( str==KKeyF10 )
+ {
+ aKeyCode=EKeyF10;
+ }
+ else if ( str==KKeyF11 )
+ {
+ aKeyCode=EKeyF11;
+ }
+ else if ( str==KKeyF12 )
+ {
+ aKeyCode=EKeyF12;
+ }
+ else if ( str==KKeyF13 )
+ {
+ aKeyCode=EKeyF13;
+ }
+ else if ( str==KKeyF14 )
+ {
+ aKeyCode=EKeyF14;
+ }
+ else if ( str==KKeyF15 )
+ {
+ aKeyCode=EKeyF15;
+ }
+ else if ( str==KKeyF16 )
+ {
+ aKeyCode=EKeyF16;
+ }
+ else if ( str==KKeyF17 )
+ {
+ aKeyCode=EKeyF17;
+ }
+ else if ( str==KKeyF18 )
+ {
+ aKeyCode=EKeyF18;
+ }
+ else if ( str==KKeyF19 )
+ {
+ aKeyCode=EKeyF19;
+ }
+ else if ( str==KKeyF20 )
+ {
+ aKeyCode=EKeyF20;
+ }
+ else if ( str==KKeyF21 )
+ {
+ aKeyCode=EKeyF21;
+ }
+ else if ( str==KKeyF22 )
+ {
+ aKeyCode=EKeyF22;
+ }
+ else if ( str==KKeyF23 )
+ {
+ aKeyCode=EKeyF23;
+ }
+ else if ( str==KKeyF24 )
+ {
+ aKeyCode=EKeyF24;
+ }
+ else if ( str==KKeyOff )
+ {
+ aKeyCode=EKeyOff;
+ }
+ else if ( str==KKeyIncContrast )
+ {
+ aKeyCode=EKeyIncContrast;
+ }
+ else if ( str==KKeyDecContrast )
+ {
+ aKeyCode=EKeyDecContrast;
+ }
+ else if ( str==KKeyBacklightOn )
+ {
+ aKeyCode=EKeyBacklightOn;
+ }
+ else if ( str==KKeyBacklightOff )
+ {
+ aKeyCode=EKeyBacklightOff;
+ }
+ else if ( str==KKeyBacklightToggle )
+ {
+ aKeyCode=EKeyBacklightToggle;
+ }
+ else if ( str==KKeySliderDown )
+ {
+ aKeyCode=EKeySliderDown;
+ }
+ else if ( str==KKeySliderUp )
+ {
+ aKeyCode=EKeySliderUp;
+ }
+ else if ( str==KKeyMenu )
+ {
+ aKeyCode=EKeyMenu;
+ }
+ else if ( str==KKeyDictaphonePlay )
+ {
+ aKeyCode=EKeyDictaphonePlay;
+ }
+ else if ( str==KKeyDictaphoneStop )
+ {
+ aKeyCode=EKeyDictaphoneStop;
+ }
+ else if ( str==KKeyDictaphoneRecord )
+ {
+ aKeyCode=EKeyDictaphoneRecord;
+ }
+ else if ( str==KKeyHelp )
+ {
+ aKeyCode=EKeyHelp;
+ }
+ else if ( str==KKeyDial )
+ {
+ aKeyCode=EKeyDial;
+ }
+ else if ( str==KKeyScreenDimension0 )
+ {
+ aKeyCode=EKeyScreenDimension0;
+ }
+ else if ( str==KKeyScreenDimension1 )
+ {
+ aKeyCode=EKeyScreenDimension1;
+ }
+ else if ( str==KKeyScreenDimension2 )
+ {
+ aKeyCode=EKeyScreenDimension2;
+ }
+ else if ( str==KKeyScreenDimension3 )
+ {
+ aKeyCode=EKeyScreenDimension3;
+ }
+ else if ( str==KKeyIncVolume )
+ {
+ aKeyCode=EKeyIncVolume;
+ }
+ else if ( str==KKeyDecVolume )
+ {
+ aKeyCode=EKeyDecVolume;
+ }
+ else if ( str==KKeyDevice0 )
+ {
+ aKeyCode=EKeyDevice0;
+ }
+ else if ( str==KKeyDevice1 )
+ {
+ aKeyCode=EKeyDevice1;
+ }
+ else if ( str==KKeyDevice2 )
+ {
+ aKeyCode=EKeyDevice2;
+ }
+ else if ( str==KKeyDevice3 )
+ {
+ aKeyCode=EKeyDevice3;
+ }
+ else if ( str==KKeyDevice4 )
+ {
+ aKeyCode=EKeyDevice4;
+ }
+ else if ( str==KKeyDevice5 )
+ {
+ aKeyCode=EKeyDevice5;
+ }
+ else if ( str==KKeyDevice6 )
+ {
+ aKeyCode=EKeyDevice6;
+ }
+ else if ( str==KKeyDevice7 )
+ {
+ aKeyCode=EKeyDevice7;
+ }
+ else if ( str==KKeyDevice8 )
+ {
+ aKeyCode=EKeyDevice8;
+ }
+ else if ( str==KKeyDevice9 )
+ {
+ aKeyCode=EKeyDevice9;
+ }
+ else if ( str==KKeyDeviceA )
+ {
+ aKeyCode=EKeyDeviceA;
+ }
+ else if ( str==KKeyDeviceB )
+ {
+ aKeyCode=EKeyDeviceB;
+ }
+ else if ( str==KKeyDeviceC )
+ {
+ aKeyCode=EKeyDeviceC;
+ }
+ else if ( str==KKeyDeviceD )
+ {
+ aKeyCode=EKeyDeviceD;
+ }
+ else if ( str==KKeyDeviceE )
+ {
+ aKeyCode=EKeyDeviceE;
+ }
+ else if ( str==KKeyDeviceF )
+ {
+ aKeyCode=EKeyDeviceF;
+ }
+ else if ( str==KKeyApplication0 )
+ {
+ aKeyCode=EKeyApplication0;
+ }
+ else if ( str==KKeyApplication1 )
+ {
+ aKeyCode=EKeyApplication1;
+ }
+ else if ( str==KKeyApplication2 )
+ {
+ aKeyCode=EKeyApplication2;
+ }
+ else if ( str==KKeyApplication3 )
+ {
+ aKeyCode=EKeyApplication3;
+ }
+ else if ( str==KKeyApplication4 )
+ {
+ aKeyCode=EKeyApplication4;
+ }
+ else if ( str==KKeyApplication5 )
+ {
+ aKeyCode=EKeyApplication5;
+ }
+ else if ( str==KKeyApplication6 )
+ {
+ aKeyCode=EKeyApplication6;
+ }
+ else if ( str==KKeyApplication7 )
+ {
+ aKeyCode=EKeyApplication7;
+ }
+ else if ( str==KKeyApplication8 )
+ {
+ aKeyCode=EKeyApplication8;
+ }
+ else if ( str==KKeyApplication9 )
+ {
+ aKeyCode=EKeyApplication9;
+ }
+ else if ( str==KKeyApplicationA )
+ {
+ aKeyCode=EKeyApplicationA;
+ }
+ else if ( str==KKeyApplicationB )
+ {
+ aKeyCode=EKeyApplicationB;
+ }
+ else if ( str==KKeyApplicationC )
+ {
+ aKeyCode=EKeyApplicationC;
+ }
+ else if ( str==KKeyApplicationD )
+ {
+ aKeyCode=EKeyApplicationD;
+ }
+ else if ( str==KKeyApplicationE )
+ {
+ aKeyCode=EKeyApplicationE;
+ }
+ else if ( str==KKeyApplicationF )
+ {
+ aKeyCode=EKeyApplicationF;
+ }
+ else if ( str==KKeyYes )
+ {
+ aKeyCode=EKeyYes;
+ }
+ else if ( str==KKeyNo )
+ {
+ aKeyCode=EKeyNo;
+ }
+ else if ( str==KKeyIncBrightness )
+ {
+ aKeyCode=EKeyIncBrightness;
+ }
+ else if ( str==KKeyDecBrightness )
+ {
+ aKeyCode=EKeyDecBrightness;
+ }
+ else if ( str==KKeyKeyboardExtend )
+ {
+ aKeyCode=EKeyKeyboardExtend;
+ }
+ else if ( str==KKeyDevice10 )
+ {
+ aKeyCode=EKeyDevice10;
+ }
+ else if ( str==KKeyDevice11 )
+ {
+ aKeyCode=EKeyDevice11;
+ }
+ else if ( str==KKeyDevice12 )
+ {
+ aKeyCode=EKeyDevice12;
+ }
+ else if ( str==KKeyDevice13 )
+ {
+ aKeyCode=EKeyDevice13;
+ }
+ else if ( str==KKeyDevice14 )
+ {
+ aKeyCode=EKeyDevice14;
+ }
+ else if ( str==KKeyDevice15 )
+ {
+ aKeyCode=EKeyDevice15;
+ }
+ else if ( str==KKeyDevice16 )
+ {
+ aKeyCode=EKeyDevice16;
+ }
+ else if ( str==KKeyDevice17 )
+ {
+ aKeyCode=EKeyDevice17;
+ }
+ else if ( str==KKeyDevice18 )
+ {
+ aKeyCode=EKeyDevice18;
+ }
+ else if ( str==KKeyDevice19 )
+ {
+ aKeyCode=EKeyDevice19;
+ }
+ else if ( str==KKeyDevice1A )
+ {
+ aKeyCode=EKeyDevice1A;
+ }
+ else if ( str==KKeyDevice1B )
+ {
+ aKeyCode=EKeyDevice1B;
+ }
+ else if ( str==KKeyDevice1C )
+ {
+ aKeyCode=EKeyDevice1C;
+ }
+ else if ( str==KKeyDevice1D )
+ {
+ aKeyCode=EKeyDevice1D;
+ }
+ else if ( str==KKeyDevice1E )
+ {
+ aKeyCode=EKeyDevice1E;
+ }
+ else if ( str==KKeyDevice1F )
+ {
+ aKeyCode=EKeyDevice1F;
+ }
+ else if ( str==KKeyApplication10 )
+ {
+ aKeyCode=EKeyApplication10;
+ }
+ else if ( str==KKeyApplication11 )
+ {
+ aKeyCode=EKeyApplication11;
+ }
+ else if ( str==KKeyApplication12 )
+ {
+ aKeyCode=EKeyApplication12;
+ }
+ else if ( str==KKeyApplication13 )
+ {
+ aKeyCode=EKeyApplication13;
+ }
+ else if ( str==KKeyApplication14 )
+ {
+ aKeyCode=EKeyApplication14;
+ }
+ else if ( str==KKeyApplication15 )
+ {
+ aKeyCode=EKeyApplication15;
+ }
+ else if ( str==KKeyApplication16 )
+ {
+ aKeyCode=EKeyApplication16;
+ }
+ else if ( str==KKeyApplication17 )
+ {
+ aKeyCode=EKeyApplication17;
+ }
+ else if ( str==KKeyApplication18 )
+ {
+ aKeyCode=EKeyApplication18;
+ }
+ else if ( str==KKeyApplication19 )
+ {
+ aKeyCode=EKeyApplication19;
+ }
+ else if ( str==KKeyApplication1A )
+ {
+ aKeyCode=EKeyApplication1A;
+ }
+ else if ( str==KKeyApplication1B )
+ {
+ aKeyCode=EKeyApplication1B;
+ }
+ else if ( str==KKeyApplication1C )
+ {
+ aKeyCode=EKeyApplication1C;
+ }
+ else if ( str==KKeyApplication1D )
+ {
+ aKeyCode=EKeyApplication1D;
+ }
+ else if ( str==KKeyApplication1E )
+ {
+ aKeyCode=EKeyApplication1E;
+ }
+ else if ( str==KKeyApplication1F )
+ {
+ aKeyCode=EKeyApplication1F;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aKeyCode=(TKeyCode)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadGlyphBitmapType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TGlyphBitmapType& aGlyphBitmapType)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KGlyphBitmapTypeDefault )
+ {
+ aGlyphBitmapType=EDefaultGlyphBitmap;
+ }
+ else if ( str==KGlyphBitmapTypeMonochrome )
+ {
+ aGlyphBitmapType=EMonochromeGlyphBitmap;
+ }
+ else if ( str==KGlyphBitmapTypeAntiAliased )
+ {
+ aGlyphBitmapType=EAntiAliasedGlyphBitmap;
+ }
+ else if ( str==KGlyphBitmapTypeSubPixel )
+ {
+ aGlyphBitmapType=ESubPixelGlyphBitmap;
+ }
+ else if ( str==KGlyphBitmapTypeFourColourBlend )
+ {
+ aGlyphBitmapType=EFourColourBlendGlyphBitmap;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aGlyphBitmapType=(TGlyphBitmapType)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadGraphicsOrientation(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFbsBitGc::TGraphicsOrientation& aGraphicsOrientation)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KGraphicsOrientationNormal )
+ {
+ aGraphicsOrientation=CFbsBitGc::EGraphicsOrientationNormal;
+ }
+ else if ( str==KGraphicsOrientationRotated90 )
+ {
+ aGraphicsOrientation=CFbsBitGc::EGraphicsOrientationRotated90;
+ }
+ else if ( str==KGraphicsOrientationRotated180 )
+ {
+ aGraphicsOrientation=CFbsBitGc::EGraphicsOrientationRotated180;
+ }
+ else if ( str==KGraphicsOrientationRotated270 )
+ {
+ aGraphicsOrientation=CFbsBitGc::EGraphicsOrientationRotated270;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aGraphicsOrientation=(CFbsBitGc::TGraphicsOrientation)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadLoggingCommand(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RWsSession::TLoggingCommand& aLoggingCommand)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KLoggingEnable )
+ {
+ aLoggingCommand=RWsSession::ELoggingEnable;
+ }
+ else if ( str==KLoggingDisable )
+ {
+ aLoggingCommand=RWsSession::ELoggingDisable;
+ }
+ else if ( str==KLoggingStatusDump )
+ {
+ aLoggingCommand=RWsSession::ELoggingStatusDump;
+ }
+ else if ( str==KLoggingHeapDump )
+ {
+ aLoggingCommand=RWsSession::ELoggingHeapDump;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aLoggingCommand=(RWsSession::TLoggingCommand)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadModifierState(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TModifierState& aModifierState)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KModifierStateTurnOnModifier )
+ {
+ aModifierState=ETurnOnModifier;
+ }
+ else if ( str==KModifierStateTurnOffModifier )
+ {
+ aModifierState=ETurnOffModifier;
+ }
+ else if ( str==KModifierStateToggleModifier )
+ {
+ aModifierState=EToggleModifier;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aModifierState=(TModifierState)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadPasswordMode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TPasswordMode& aPasswordMode)
+ {
+ // Read dither from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KPasswordModeCancel )
+ {
+ aPasswordMode=EPasswordCancel;
+ }
+ else if ( str==KPasswordModeNone )
+ {
+ aPasswordMode=EPasswordNone;
+ }
+ else if ( str==KPasswordModeOnceADay )
+ {
+ aPasswordMode=EPasswordOnceADay;
+ }
+ else if ( str==KPasswordModeAlways )
+ {
+ aPasswordMode=EPasswordAlways;
+ }
+ else if ( str==KPasswordModeAlwaysTriggerNow )
+ {
+ aPasswordMode=EPasswordAlwaysTriggerNow;
+ }
+ else if ( str==KPasswordModeOnceADayTriggerNow )
+ {
+ aPasswordMode=EPasswordOnceADayTriggerNow;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aPasswordMode=(TPasswordMode)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadPenStyle(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TPenStyle& aPenStyle)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KPenStyleNull )
+ {
+ aPenStyle=CGraphicsContext::ENullPen;
+ }
+ else if ( str==KPenStyleSolid )
+ {
+ aPenStyle=CGraphicsContext::ESolidPen;
+ }
+ else if ( str==KPenStyleDotted )
+ {
+ aPenStyle=CGraphicsContext::EDottedPen;
+ }
+ else if ( str==KPenStyleDashed )
+ {
+ aPenStyle=CGraphicsContext::EDashedPen;
+ }
+ else if ( str==KPenStyleDotDash )
+ {
+ aPenStyle=CGraphicsContext::EDotDashPen;
+ }
+ else if ( str==KPenStyleDotDotDash )
+ {
+ aPenStyle=CGraphicsContext::EDotDotDashPen;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aPenStyle=(CGraphicsContext::TPenStyle)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadPointerCursorMode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TPointerCursorMode& aPointerCursorMode)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KPointerCursorNone )
+ {
+ aPointerCursorMode=EPointerCursorNone;
+ }
+ else if ( str==KPointerCursorFixed )
+ {
+ aPointerCursorMode=EPointerCursorFixed;
+ }
+ else if ( str==KPointerCursorNormal )
+ {
+ aPointerCursorMode=EPointerCursorNormal;
+ }
+ else if ( str==KPointerCursorWindow )
+ {
+ aPointerCursorMode=EPointerCursorWindow;
+ }
+ else if ( str==KPointerCursorFirstMode )
+ {
+ aPointerCursorMode=EPointerCursorFirstMode;
+ }
+ else if ( str==KPointerCursorLastMode )
+ {
+ aPointerCursorMode=EPointerCursorLastMode;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aPointerCursorMode=(TPointerCursorMode)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadPointerFilter(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TPointerFilter& aPointerFilter)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ ret=ConvertToPointerFilter(str, aPointerFilter);
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadPointerFilter(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aPointerFilter)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ TUint temp=0;
+ ret=ConvertToPointerFilter(str, temp);
+ if ( ret )
+ {
+ aPointerFilter=temp;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToPointerFilter(const TDesC& aStr, TPointerFilter& aPointerFilter)
+ {
+ TBool ret=ETrue;
+
+ if ( aStr==KPointerFilterEnterExit )
+ {
+ aPointerFilter=EPointerFilterEnterExit;
+ }
+ else if ( aStr==KPointerFilterMove )
+ {
+ aPointerFilter=EPointerFilterMove;
+ }
+ else if ( aStr==KPointerFilterDrag )
+ {
+ aPointerFilter=EPointerFilterDrag;
+ }
+ else if ( aStr==KPointerFilterGenerateSimulatedMove )
+ {
+ aPointerFilter=EPointerGenerateSimulatedMove;
+ }
+ else if ( aStr==KPointerFilterMoveEvents )
+ {
+ aPointerFilter=EPointerMoveEvents;
+ }
+ else
+ {
+ TUint pointerFilter;
+ TLex lex(aStr);
+ ret=(lex.Val(pointerFilter, EHex)==KErrNone);
+ if ( ret )
+ {
+ aPointerFilter=(TPointerFilter)pointerFilter;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToPointerFilter(const TDesC& aStr, TUint& aPointerFilter)
+ {
+ TBool ret=ETrue;
+ TInt location=aStr.Match(_L("*|*"));
+ if( location!=KErrNotFound )
+ {
+ // Converting Left part of the data
+ TPtrC tempStr=aStr.Left(location);
+ ret=ConvertToPointerFilter(tempStr, aPointerFilter);
+
+ // Converting right data can be with another "|"
+ tempStr.Set(aStr.Mid(location+1));
+
+ TUint temp;
+ if ( ConvertToPointerFilter(tempStr, temp) )
+ {
+ aPointerFilter|=temp;
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ }
+ else
+ {
+ TPointerFilter pointerFilter;
+ ret=ConvertToPointerFilter(aStr, pointerFilter);
+ if ( ret )
+ {
+ aPointerFilter=(TUint)pointerFilter;
+ }
+ }
+
+ return ret;
+ }
+
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+TBool CT_GraphicsUtil::ReadPriorities(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TInt& aPriorities)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KPrioritiesAll )
+ {
+ aPriorities=EAllPriorities;
+ }
+ else
+ {
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, aPriorities);
+ }
+ }
+
+ return ret;
+ }
+#endif
+
+TBool CT_GraphicsUtil::ReadPriority(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CActive::TPriority& aPriority)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KPriorityIdle )
+ {
+ aPriority=CActive::EPriorityIdle;
+ }
+ else if ( str==KPriorityLow )
+ {
+ aPriority=CActive::EPriorityLow;
+ }
+ else if ( str==KPriorityStandard )
+ {
+ aPriority=CActive::EPriorityStandard;
+ }
+ else if ( str==KPriorityUserInput )
+ {
+ aPriority=CActive::EPriorityUserInput;
+ }
+ else if ( str==KPriorityHigh )
+ {
+ aPriority=CActive::EPriorityHigh;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aPriority=(CActive::TPriority)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadScreenModeEnforcement(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TScreenModeEnforcement& aScreenModeEnforcement)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KSizeEnforcementNone )
+ {
+ aScreenModeEnforcement=ESizeEnforcementNone;
+ }
+ else if ( str==KSizeEnforcementPixelsAndRotation )
+ {
+ aScreenModeEnforcement=ESizeEnforcementPixelsAndRotation;
+ }
+ else if ( str==KSizeEnforcementPixelsTwipsAndRotation )
+ {
+ aScreenModeEnforcement=ESizeEnforcementPixelsTwipsAndRotation;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aScreenModeEnforcement=(TScreenModeEnforcement)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadSpriteInCompare(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aSpriteInCompare)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ TUint temp=0;
+ ret=ConvertToSpriteInCompare(str, temp);
+ if ( ret )
+ {
+ aSpriteInCompare=temp;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToSpriteInCompare(const TDesC& aStr, TUint& aSpriteInCompare)
+ {
+ TBool ret=ETrue;
+ TInt location=aStr.Match(_L("*|*"));
+ if( location!=KErrNotFound )
+ {
+ // Converting Left part of the data
+ TPtrC tempStr=aStr.Left(location);
+ ret=ConvertToSpriteInCompare(tempStr, aSpriteInCompare);
+
+ // Converting right data can be with another "|"
+ tempStr.Set(aStr.Mid(location+1));
+
+ TUint temp;
+ if ( ConvertToPointerFilter(tempStr, temp) )
+ {
+ aSpriteInCompare|=temp;
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ }
+ else
+ {
+ if ( aStr==KSpriteInCompareRemoveSprite )
+ {
+ aSpriteInCompare=CWsScreenDevice::ERemoveSprite;
+ }
+ else if ( aStr==KSpriteInCompareIncludeSprite )
+ {
+ aSpriteInCompare=CWsScreenDevice::EIncludeSprite;
+ }
+ else if ( aStr==KSpriteInCompareIncludeTextCursor )
+ {
+ aSpriteInCompare=CWsScreenDevice::EIncludeTextCursor;
+ }
+ else
+ {
+ TLex lex(aStr);
+ ret=(lex.Val(aSpriteInCompare, EHex)==KErrNone);
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadStdScanCode(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TStdScanCode& aStdScanCode)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KStdKeyNull )
+ {
+ aStdScanCode=EStdKeyNull;
+ }
+ else if ( str==KStdKeyBackspace )
+ {
+ aStdScanCode=EStdKeyBackspace;
+ }
+ else if ( str==KStdKeyTab )
+ {
+ aStdScanCode=EStdKeyTab;
+ }
+ else if ( str==KStdKeyEnter )
+ {
+ aStdScanCode=EStdKeyEnter;
+ }
+ else if ( str==KStdKeyEscape )
+ {
+ aStdScanCode=EStdKeyEscape;
+ }
+ else if ( str==KStdKeySpace )
+ {
+ aStdScanCode=EStdKeySpace;
+ }
+ else if ( str==KStdKeyPrintScreen )
+ {
+ aStdScanCode=EStdKeyPrintScreen;
+ }
+ else if ( str==KStdKeyPause )
+ {
+ aStdScanCode=EStdKeyPause;
+ }
+ else if ( str==KStdKeyHome )
+ {
+ aStdScanCode=EStdKeyHome;
+ }
+ else if ( str==KStdKeyEnd )
+ {
+ aStdScanCode=EStdKeyEnd;
+ }
+ else if ( str==KStdKeyPageUp )
+ {
+ aStdScanCode=EStdKeyPageUp;
+ }
+ else if ( str==KStdKeyPageDown )
+ {
+ aStdScanCode=EStdKeyPageDown;
+ }
+ else if ( str==KStdKeyInsert )
+ {
+ aStdScanCode=EStdKeyInsert;
+ }
+ else if ( str==KStdKeyDelete )
+ {
+ aStdScanCode=EStdKeyDelete;
+ }
+ else if ( str==KStdKeyLeftArrow )
+ {
+ aStdScanCode=EStdKeyLeftArrow;
+ }
+ else if ( str==KStdKeyRightArrow )
+ {
+ aStdScanCode=EStdKeyRightArrow;
+ }
+ else if ( str==KStdKeyUpArrow )
+ {
+ aStdScanCode=EStdKeyUpArrow;
+ }
+ else if ( str==KStdKeyDownArrow )
+ {
+ aStdScanCode=EStdKeyDownArrow;
+ }
+ else if ( str==KStdKeyLeftShift )
+ {
+ aStdScanCode=EStdKeyLeftShift;
+ }
+ else if ( str==KStdKeyRightShift )
+ {
+ aStdScanCode=EStdKeyRightShift;
+ }
+ else if ( str==KStdKeyLeftAlt )
+ {
+ aStdScanCode=EStdKeyLeftAlt;
+ }
+ else if ( str==KStdKeyRightAlt )
+ {
+ aStdScanCode=EStdKeyRightAlt;
+ }
+ else if ( str==KStdKeyLeftCtrl )
+ {
+ aStdScanCode=EStdKeyLeftCtrl;
+ }
+ else if ( str==KStdKeyRightCtrl )
+ {
+ aStdScanCode=EStdKeyRightCtrl;
+ }
+ else if ( str==KStdKeyLeftFunc )
+ {
+ aStdScanCode=EStdKeyLeftFunc;
+ }
+ else if ( str==KStdKeyRightFunc )
+ {
+ aStdScanCode=EStdKeyRightFunc;
+ }
+ else if ( str==KStdKeyCapsLock )
+ {
+ aStdScanCode=EStdKeyCapsLock;
+ }
+ else if ( str==KStdKeyNumLock )
+ {
+ aStdScanCode=EStdKeyNumLock;
+ }
+ else if ( str==KStdKeyScrollLock )
+ {
+ aStdScanCode=EStdKeyScrollLock;
+ }
+ else if ( str==KStdKeyF1 )
+ {
+ aStdScanCode=EStdKeyF1;
+ }
+ else if ( str==KStdKeyF2 )
+ {
+ aStdScanCode=EStdKeyF2;
+ }
+ else if ( str==KStdKeyF3 )
+ {
+ aStdScanCode=EStdKeyF3;
+ }
+ else if ( str==KStdKeyF4 )
+ {
+ aStdScanCode=EStdKeyF4;
+ }
+ else if ( str==KStdKeyF5 )
+ {
+ aStdScanCode=EStdKeyF5;
+ }
+ else if ( str==KStdKeyF6 )
+ {
+ aStdScanCode=EStdKeyF6;
+ }
+ else if ( str==KStdKeyF7 )
+ {
+ aStdScanCode=EStdKeyF7;
+ }
+ else if ( str==KStdKeyF8 )
+ {
+ aStdScanCode=EStdKeyF8;
+ }
+ else if ( str==KStdKeyF9 )
+ {
+ aStdScanCode=EStdKeyF9;
+ }
+ else if ( str==KStdKeyF10 )
+ {
+ aStdScanCode=EStdKeyF10;
+ }
+ else if ( str==KStdKeyF11 )
+ {
+ aStdScanCode=EStdKeyF11;
+ }
+ else if ( str==KStdKeyF12 )
+ {
+ aStdScanCode=EStdKeyF12;
+ }
+ else if ( str==KStdKeyF13 )
+ {
+ aStdScanCode=EStdKeyF13;
+ }
+ else if ( str==KStdKeyF14 )
+ {
+ aStdScanCode=EStdKeyF14;
+ }
+ else if ( str==KStdKeyF15 )
+ {
+ aStdScanCode=EStdKeyF15;
+ }
+ else if ( str==KStdKeyF16 )
+ {
+ aStdScanCode=EStdKeyF16;
+ }
+ else if ( str==KStdKeyF17 )
+ {
+ aStdScanCode=EStdKeyF17;
+ }
+ else if ( str==KStdKeyF18 )
+ {
+ aStdScanCode=EStdKeyF18;
+ }
+ else if ( str==KStdKeyF19 )
+ {
+ aStdScanCode=EStdKeyF19;
+ }
+ else if ( str==KStdKeyF20 )
+ {
+ aStdScanCode=EStdKeyF20;
+ }
+ else if ( str==KStdKeyF21 )
+ {
+ aStdScanCode=EStdKeyF21;
+ }
+ else if ( str==KStdKeyF22 )
+ {
+ aStdScanCode=EStdKeyF22;
+ }
+ else if ( str==KStdKeyF23 )
+ {
+ aStdScanCode=EStdKeyF23;
+ }
+ else if ( str==KStdKeyF24 )
+ {
+ aStdScanCode=EStdKeyF24;
+ }
+ else if ( str==KStdKeyXXX )
+ {
+ aStdScanCode=EStdKeyXXX;
+ }
+ else if ( str==KStdKeyComma )
+ {
+ aStdScanCode=EStdKeyComma;
+ }
+ else if ( str==KStdKeyFullStop )
+ {
+ aStdScanCode=EStdKeyFullStop;
+ }
+ else if ( str==KStdKeyForwardSlash )
+ {
+ aStdScanCode=EStdKeyForwardSlash;
+ }
+ else if ( str==KStdKeyBackSlash )
+ {
+ aStdScanCode=EStdKeyBackSlash;
+ }
+ else if ( str==KStdKeySemiColon )
+ {
+ aStdScanCode=EStdKeySemiColon;
+ }
+ else if ( str==KStdKeySingleQuote )
+ {
+ aStdScanCode=EStdKeySingleQuote;
+ }
+ else if ( str==KStdKeyHash )
+ {
+ aStdScanCode=EStdKeyHash;
+ }
+ else if ( str==KStdKeySquareBracketLeft )
+ {
+ aStdScanCode=EStdKeySquareBracketLeft;
+ }
+ else if ( str==KStdKeySquareBracketRight )
+ {
+ aStdScanCode=EStdKeySquareBracketRight;
+ }
+ else if ( str==KStdKeyMinus )
+ {
+ aStdScanCode=EStdKeyMinus;
+ }
+ else if ( str==KStdKeyEquals )
+ {
+ aStdScanCode=EStdKeyEquals;
+ }
+ else if ( str==KStdKeyNkpForwardSlash )
+ {
+ aStdScanCode=EStdKeyNkpForwardSlash;
+ }
+ else if ( str==KStdKeyNkpAsterisk )
+ {
+ aStdScanCode=EStdKeyNkpAsterisk;
+ }
+ else if ( str==KStdKeyNkpMinus )
+ {
+ aStdScanCode=EStdKeyNkpMinus;
+ }
+ else if ( str==KStdKeyNkpPlus )
+ {
+ aStdScanCode=EStdKeyNkpPlus;
+ }
+ else if ( str==KStdKeyNkpEnter )
+ {
+ aStdScanCode=EStdKeyNkpEnter;
+ }
+ else if ( str==KStdKeyNkp1 )
+ {
+ aStdScanCode=EStdKeyNkp1;
+ }
+ else if ( str==KStdKeyNkp2 )
+ {
+ aStdScanCode=EStdKeyNkp2;
+ }
+ else if ( str==KStdKeyNkp3 )
+ {
+ aStdScanCode=EStdKeyNkp3;
+ }
+ else if ( str==KStdKeyNkp4 )
+ {
+ aStdScanCode=EStdKeyNkp4;
+ }
+ else if ( str==KStdKeyNkp5 )
+ {
+ aStdScanCode=EStdKeyNkp5;
+ }
+ else if ( str==KStdKeyNkp6 )
+ {
+ aStdScanCode=EStdKeyNkp6;
+ }
+ else if ( str==KStdKeyNkp7 )
+ {
+ aStdScanCode=EStdKeyNkp7;
+ }
+ else if ( str==KStdKeyNkp8 )
+ {
+ aStdScanCode=EStdKeyNkp8;
+ }
+ else if ( str==KStdKeyNkp9 )
+ {
+ aStdScanCode=EStdKeyNkp9;
+ }
+ else if ( str==KStdKeyNkp0 )
+ {
+ aStdScanCode=EStdKeyNkp0;
+ }
+ else if ( str==KStdKeyNkpFullStop )
+ {
+ aStdScanCode=EStdKeyNkpFullStop;
+ }
+ else if ( str==KStdKeyMenu )
+ {
+ aStdScanCode=EStdKeyMenu;
+ }
+ else if ( str==KStdKeyBacklightOn )
+ {
+ aStdScanCode=EStdKeyBacklightOn;
+ }
+ else if ( str==KStdKeyBacklightOff )
+ {
+ aStdScanCode=EStdKeyBacklightOff;
+ }
+ else if ( str==KStdKeyBacklightToggle )
+ {
+ aStdScanCode=EStdKeyBacklightToggle;
+ }
+ else if ( str==KStdKeyIncContrast )
+ {
+ aStdScanCode=EStdKeyIncContrast;
+ }
+ else if ( str==KStdKeyDecContrast )
+ {
+ aStdScanCode=EStdKeyDecContrast;
+ }
+ else if ( str==KStdKeySliderDown )
+ {
+ aStdScanCode=EStdKeySliderDown;
+ }
+ else if ( str==KStdKeySliderUp )
+ {
+ aStdScanCode=EStdKeySliderUp;
+ }
+ else if ( str==KStdKeyDictaphonePlay )
+ {
+ aStdScanCode=EStdKeyDictaphonePlay;
+ }
+ else if ( str==KStdKeyDictaphoneStop )
+ {
+ aStdScanCode=EStdKeyDictaphoneStop;
+ }
+ else if ( str==KStdKeyDictaphoneRecord )
+ {
+ aStdScanCode=EStdKeyDictaphoneRecord;
+ }
+ else if ( str==KStdKeyHelp )
+ {
+ aStdScanCode=EStdKeyHelp;
+ }
+ else if ( str==KStdKeyOff )
+ {
+ aStdScanCode=EStdKeyOff;
+ }
+ else if ( str==KStdKeyDial )
+ {
+ aStdScanCode=EStdKeyDial;
+ }
+ else if ( str==KStdKeyIncVolume )
+ {
+ aStdScanCode=EStdKeyIncVolume;
+ }
+ else if ( str==KStdKeyDecVolume )
+ {
+ aStdScanCode=EStdKeyDecVolume;
+ }
+ else if ( str==KStdKeyDevice0 )
+ {
+ aStdScanCode=EStdKeyDevice0;
+ }
+ else if ( str==KStdKeyDevice1 )
+ {
+ aStdScanCode=EStdKeyDevice1;
+ }
+ else if ( str==KStdKeyDevice2 )
+ {
+ aStdScanCode=EStdKeyDevice2;
+ }
+ else if ( str==KStdKeyDevice3 )
+ {
+ aStdScanCode=EStdKeyDevice3;
+ }
+ else if ( str==KStdKeyDevice4 )
+ {
+ aStdScanCode=EStdKeyDevice4;
+ }
+ else if ( str==KStdKeyDevice5 )
+ {
+ aStdScanCode=EStdKeyDevice5;
+ }
+ else if ( str==KStdKeyDevice6 )
+ {
+ aStdScanCode=EStdKeyDevice6;
+ }
+ else if ( str==KStdKeyDevice7 )
+ {
+ aStdScanCode=EStdKeyDevice7;
+ }
+ else if ( str==KStdKeyDevice8 )
+ {
+ aStdScanCode=EStdKeyDevice8;
+ }
+ else if ( str==KStdKeyDevice9 )
+ {
+ aStdScanCode=EStdKeyDevice9;
+ }
+ else if ( str==KStdKeyDeviceA )
+ {
+ aStdScanCode=EStdKeyDeviceA;
+ }
+ else if ( str==KStdKeyDeviceB )
+ {
+ aStdScanCode=EStdKeyDeviceB;
+ }
+ else if ( str==KStdKeyDeviceC )
+ {
+ aStdScanCode=EStdKeyDeviceC;
+ }
+ else if ( str==KStdKeyDeviceD )
+ {
+ aStdScanCode=EStdKeyDeviceD;
+ }
+ else if ( str==KStdKeyDeviceE )
+ {
+ aStdScanCode=EStdKeyDeviceE;
+ }
+ else if ( str==KStdKeyDeviceF )
+ {
+ aStdScanCode=EStdKeyDeviceF;
+ }
+ else if ( str==KStdKeyApplication0 )
+ {
+ aStdScanCode=EStdKeyApplication0;
+ }
+ else if ( str==KStdKeyApplication1 )
+ {
+ aStdScanCode=EStdKeyApplication1;
+ }
+ else if ( str==KStdKeyApplication2 )
+ {
+ aStdScanCode=EStdKeyApplication2;
+ }
+ else if ( str==KStdKeyApplication3 )
+ {
+ aStdScanCode=EStdKeyApplication3;
+ }
+ else if ( str==KStdKeyApplication4 )
+ {
+ aStdScanCode=EStdKeyApplication4;
+ }
+ else if ( str==KStdKeyApplication5 )
+ {
+ aStdScanCode=EStdKeyApplication5;
+ }
+ else if ( str==KStdKeyApplication6 )
+ {
+ aStdScanCode=EStdKeyApplication6;
+ }
+ else if ( str==KStdKeyApplication7 )
+ {
+ aStdScanCode=EStdKeyApplication7;
+ }
+ else if ( str==KStdKeyApplication8 )
+ {
+ aStdScanCode=EStdKeyApplication8;
+ }
+ else if ( str==KStdKeyApplication9 )
+ {
+ aStdScanCode=EStdKeyApplication9;
+ }
+ else if ( str==KStdKeyApplicationA )
+ {
+ aStdScanCode=EStdKeyApplicationA;
+ }
+ else if ( str==KStdKeyApplicationB )
+ {
+ aStdScanCode=EStdKeyApplicationB;
+ }
+ else if ( str==KStdKeyApplicationC )
+ {
+ aStdScanCode=EStdKeyApplicationC;
+ }
+ else if ( str==KStdKeyApplicationD )
+ {
+ aStdScanCode=EStdKeyApplicationD;
+ }
+ else if ( str==KStdKeyApplicationE )
+ {
+ aStdScanCode=EStdKeyApplicationE;
+ }
+ else if ( str==KStdKeyApplicationF )
+ {
+ aStdScanCode=EStdKeyApplicationF;
+ }
+ else if ( str==KStdKeyYes )
+ {
+ aStdScanCode=EStdKeyYes;
+ }
+ else if ( str==KStdKeyNo )
+ {
+ aStdScanCode=EStdKeyNo;
+ }
+ else if ( str==KStdKeyIncBrightness )
+ {
+ aStdScanCode=EStdKeyIncBrightness;
+ }
+ else if ( str==KStdKeyDecBrightness )
+ {
+ aStdScanCode=EStdKeyDecBrightness;
+ }
+ else if ( str==KStdKeyKeyboardExtend )
+ {
+ aStdScanCode=EStdKeyKeyboardExtend;
+ }
+ else if ( str==KStdKeyDevice10 )
+ {
+ aStdScanCode=EStdKeyDevice10;
+ }
+ else if ( str==KStdKeyDevice11 )
+ {
+ aStdScanCode=EStdKeyDevice11;
+ }
+ else if ( str==KStdKeyDevice12 )
+ {
+ aStdScanCode=EStdKeyDevice12;
+ }
+ else if ( str==KStdKeyDevice13 )
+ {
+ aStdScanCode=EStdKeyDevice13;
+ }
+ else if ( str==KStdKeyDevice14 )
+ {
+ aStdScanCode=EStdKeyDevice14;
+ }
+ else if ( str==KStdKeyDevice15 )
+ {
+ aStdScanCode=EStdKeyDevice15;
+ }
+ else if ( str==KStdKeyDevice16 )
+ {
+ aStdScanCode=EStdKeyDevice16;
+ }
+ else if ( str==KStdKeyDevice17 )
+ {
+ aStdScanCode=EStdKeyDevice17;
+ }
+ else if ( str==KStdKeyDevice18 )
+ {
+ aStdScanCode=EStdKeyDevice18;
+ }
+ else if ( str==KStdKeyDevice19 )
+ {
+ aStdScanCode=EStdKeyDevice19;
+ }
+ else if ( str==KStdKeyDevice1A )
+ {
+ aStdScanCode=EStdKeyDevice1A;
+ }
+ else if ( str==KStdKeyDevice1B )
+ {
+ aStdScanCode=EStdKeyDevice1B;
+ }
+ else if ( str==KStdKeyDevice1C )
+ {
+ aStdScanCode=EStdKeyDevice1C;
+ }
+ else if ( str==KStdKeyDevice1D )
+ {
+ aStdScanCode=EStdKeyDevice1D;
+ }
+ else if ( str==KStdKeyDevice1E )
+ {
+ aStdScanCode=EStdKeyDevice1E;
+ }
+ else if ( str==KStdKeyDevice1F )
+ {
+ aStdScanCode=EStdKeyDevice1F;
+ }
+ else if ( str==KStdKeyApplication10 )
+ {
+ aStdScanCode=EStdKeyApplication10;
+ }
+ else if ( str==KStdKeyApplication11 )
+ {
+ aStdScanCode=EStdKeyApplication11;
+ }
+ else if ( str==KStdKeyApplication12 )
+ {
+ aStdScanCode=EStdKeyApplication12;
+ }
+ else if ( str==KStdKeyApplication13 )
+ {
+ aStdScanCode=EStdKeyApplication13;
+ }
+ else if ( str==KStdKeyApplication14 )
+ {
+ aStdScanCode=EStdKeyApplication14;
+ }
+ else if ( str==KStdKeyApplication15 )
+ {
+ aStdScanCode=EStdKeyApplication15;
+ }
+ else if ( str==KStdKeyApplication16 )
+ {
+ aStdScanCode=EStdKeyApplication16;
+ }
+ else if ( str==KStdKeyApplication17 )
+ {
+ aStdScanCode=EStdKeyApplication17;
+ }
+ else if ( str==KStdKeyApplication18 )
+ {
+ aStdScanCode=EStdKeyApplication18;
+ }
+ else if ( str==KStdKeyApplication19 )
+ {
+ aStdScanCode=EStdKeyApplication19;
+ }
+ else if ( str==KStdKeyApplication1A )
+ {
+ aStdScanCode=EStdKeyApplication1A;
+ }
+ else if ( str==KStdKeyApplication1B )
+ {
+ aStdScanCode=EStdKeyApplication1B;
+ }
+ else if ( str==KStdKeyApplication1C )
+ {
+ aStdScanCode=EStdKeyApplication1C;
+ }
+ else if ( str==KStdKeyApplication1D )
+ {
+ aStdScanCode=EStdKeyApplication1D;
+ }
+ else if ( str==KStdKeyApplication1E )
+ {
+ aStdScanCode=EStdKeyApplication1E;
+ }
+ else if ( str==KStdKeyApplication1F )
+ {
+ aStdScanCode=EStdKeyApplication1F;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aStdScanCode=(TStdScanCode)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadTextAlign(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TTextAlign& aTextAlign)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KTextAlignLeft )
+ {
+ aTextAlign=CGraphicsContext::ELeft;
+ }
+ else if ( str==KTextAlignCenter )
+ {
+ aTextAlign=CGraphicsContext::ECenter;
+ }
+ else if ( str==KTextAlignRight )
+ {
+ aTextAlign=CGraphicsContext::ERight;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aTextAlign=(CGraphicsContext::TTextAlign)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadTextDirection(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFont::TTextDirection& aTextDirection)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KTextDirectionHorizontal )
+ {
+ aTextDirection=CFont::EHorizontal;
+ }
+ else if ( str==KTextDirectionVertical )
+ {
+ aTextDirection=CFont::EVertical;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aTextDirection=(CFont::TTextDirection)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TPointerEvent::TType& aType)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KTypeButton1Down )
+ {
+ aType=TPointerEvent::EButton1Down;
+ }
+ else if ( str==KTypeButton1Up )
+ {
+ aType=TPointerEvent::EButton1Up;
+ }
+ else if ( str==KTypeButton2Down )
+ {
+ aType=TPointerEvent::EButton2Down;
+ }
+ else if ( str==KTypeButton2Up )
+ {
+ aType=TPointerEvent::EButton2Up;
+ }
+ else if ( str==KTypeButton3Down )
+ {
+ aType=TPointerEvent::EButton3Down;
+ }
+ else if ( str==KTypeButton3Up )
+ {
+ aType=TPointerEvent::EButton3Up;
+ }
+ else if ( str==KTypeDrag )
+ {
+ aType=TPointerEvent::EDrag;
+ }
+ else if ( str==KTypeMove )
+ {
+ aType=TPointerEvent::EMove;
+ }
+ else if ( str==KTypeButtonRepeat )
+ {
+ aType=TPointerEvent::EButtonRepeat;
+ }
+ else if ( str==KTypeSwitchOn )
+ {
+ aType=TPointerEvent::ESwitchOn;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aType=(TPointerEvent::TType)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TRawEvent::TType& aType)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KTypeNone )
+ {
+ aType=TRawEvent::ENone;
+ }
+ else if ( str==KTypePointerMove )
+ {
+ aType=TRawEvent::EPointerMove;
+ }
+ else if ( str==KTypePointerSwitchOn )
+ {
+ aType=TRawEvent::EPointerSwitchOn;
+ }
+ else if ( str==KTypeKeyDown )
+ {
+ aType=TRawEvent::EKeyDown;
+ }
+ else if ( str==KTypeKeyUp )
+ {
+ aType=TRawEvent::EKeyUp;
+ }
+ else if ( str==KTypeRedraw )
+ {
+ aType=TRawEvent::ERedraw;
+ }
+ else if ( str==KTypeSwitchOn )
+ {
+ aType=TRawEvent::ESwitchOn;
+ }
+ else if ( str==KTypeActive )
+ {
+ aType=TRawEvent::EActive;
+ }
+ else if ( str==KTypeInactive )
+ {
+ aType=TRawEvent::EInactive;
+ }
+ else if ( str==KTypeUpdateModifiers )
+ {
+ aType=TRawEvent::EUpdateModifiers;
+ }
+ else if ( str==KTypeButton1Down )
+ {
+ aType=TRawEvent::EButton1Down;
+ }
+ else if ( str==KTypeButton1Up )
+ {
+ aType=TRawEvent::EButton1Up;
+ }
+ else if ( str==KTypeButton2Down )
+ {
+ aType=TRawEvent::EButton2Down;
+ }
+ else if ( str==KTypeButton2Up )
+ {
+ aType=TRawEvent::EButton2Up;
+ }
+ else if ( str==KTypeButton3Down )
+ {
+ aType=TRawEvent::EButton3Down;
+ }
+ else if ( str==KTypeButton3Up )
+ {
+ aType=TRawEvent::EButton3Up;
+ }
+ else if ( str==KTypeSwitchOff )
+ {
+ aType=TRawEvent::ESwitchOff;
+ }
+ else if ( str==KTypeKeyRepeat )
+ {
+ aType=TRawEvent::EKeyRepeat;
+ }
+ else if ( str==KTypeCaseOpen )
+ {
+ aType=TRawEvent::ECaseOpen;
+ }
+ else if ( str==KTypeCaseClose )
+ {
+ aType=TRawEvent::ECaseClose;
+ }
+ else if ( str==KTypePointer3DInRange )
+ {
+ aType=TRawEvent::EPointer3DInRange;
+ }
+ else if ( str==KTypePointer3DOutOfRange )
+ {
+ aType=TRawEvent::EPointer3DOutOfRange;
+ }
+ else if ( str==KTypePointer3DTilt )
+ {
+ aType=TRawEvent::EPointer3DTilt;
+ }
+ else if ( str==KTypePointer3DRotation )
+ {
+ aType=TRawEvent::EPointer3DRotation;
+ }
+ else if ( str==KTypePointer3DTiltAndMove )
+ {
+ aType=TRawEvent::EPointer3DTiltAndMove;
+ }
+ else if ( str==KTypeButton4Down )
+ {
+ aType=TRawEvent::EButton4Down;
+ }
+ else if ( str==KTypeButton4Up )
+ {
+ aType=TRawEvent::EButton4Up;
+ }
+ else if ( str==KTypeButton5Down )
+ {
+ aType=TRawEvent::EButton5Down;
+ }
+ else if ( str==KTypeButton5Up )
+ {
+ aType=TRawEvent::EButton5Up;
+ }
+ else if ( str==KTypeButton6Down )
+ {
+ aType=TRawEvent::EButton6Down;
+ }
+ else if ( str==KTypeButton6Up )
+ {
+ aType=TRawEvent::EButton6Up;
+ }
+ else if ( str==KTypeRestartSystem )
+ {
+ aType=TRawEvent::ERestartSystem;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aType=(TRawEvent::TType)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadTerminateReason(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RDirectScreenAccess::TTerminationReasons& aReason)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if(str == KETerminateCancel)
+ {
+ aReason = RDirectScreenAccess::ETerminateCancel;
+ }
+ else if(str == KETerminateRegion)
+ {
+ aReason = RDirectScreenAccess::ETerminateRegion;
+ }
+ else if(str == KETerminateRotation)
+ {
+ aReason = RDirectScreenAccess::ETerminateRotation;
+ }
+ else if(str == KETerminateScreenMode)
+ {
+ aReason = RDirectScreenAccess::ETerminateScreenMode;
+ }
+ else
+ {
+ ret = EFalse;
+ }
+ }
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadWindowBackupType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aWindowBackupType)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ TUint temp=0;
+ ret=ConvertToWindowBackupType(str, temp);
+ if ( ret )
+ {
+ aWindowBackupType=temp;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToWindowBackupType(const TDesC& aStr, TWindowBackupType& aWindowBackupType)
+ {
+ TBool ret=ETrue;
+ if ( aStr==KWindowBackupTypeAreaBehind )
+ {
+ aWindowBackupType=EWindowBackupAreaBehind;
+ }
+ else if ( aStr==KWindowBackupTypeFullScreen )
+ {
+ aWindowBackupType=EWindowBackupFullScreen;
+ }
+ else
+ {
+ TUint windowBackupType;
+ TLex lex(aStr);
+ ret=(lex.Val(windowBackupType, EHex)==KErrNone);
+ if ( ret )
+ {
+ aWindowBackupType=(TWindowBackupType)windowBackupType;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToWindowBackupType(const TDesC& aStr, TUint& aWindowBackupType)
+ {
+ TBool ret=ETrue;
+ TInt location=aStr.Match(_L("*|*"));
+ if( location!=KErrNotFound )
+ {
+ // Converting Left part of the data
+ TPtrC tempStr=aStr.Left(location);
+ ret=ConvertToWindowBackupType(tempStr, aWindowBackupType);
+
+ // Converting right data can be with another "|"
+ tempStr.Set(aStr.Mid(location+1));
+
+ TUint temp;
+ if ( ConvertToWindowBackupType(tempStr, temp) )
+ {
+ aWindowBackupType|=temp;
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ }
+ else
+ {
+ TWindowBackupType windowBackupType;
+ ret=ConvertToWindowBackupType(aStr, windowBackupType);
+ if ( ret )
+ {
+ aWindowBackupType=(TUint)windowBackupType;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadWsTransparencyPolicy(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsTransparencyPolicy& aWsTransparencyPolicy)
+ {
+ // Read displaymode from INI file
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KWsTransparencyPolicyDefault )
+ {
+ aWsTransparencyPolicy=ETransparencyDefault;
+ }
+ else if ( str==KWsTransparencyPolicyFreezeUnder )
+ {
+ aWsTransparencyPolicy=ETransparencyFreezeUnder;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aWsTransparencyPolicy=(TWsTransparencyPolicy)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadWsVisibilityChangedEvent(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsVisibilityChangedEvent& aWsVisibilityChangedEvent)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ ret=ConvertToWsVisibilityChangedEvent(str, aWsVisibilityChangedEvent.iFlags);
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToWsVisibilityChangedEvent(const TDesC& aStr, TUint& aWsVisibilityChangedEvent)
+ {
+ TBool ret=ETrue;
+ TInt location=aStr.Match(_L("*|*"));
+ if( location!=KErrNotFound )
+ {
+ // Converting Left part of the data
+ TPtrC tempStr=aStr.Left(location);
+ ret=ConvertToWsVisibilityChangedEvent(tempStr, aWsVisibilityChangedEvent);
+
+ // Converting right data can be with another "|"
+ tempStr.Set(aStr.Mid(location+1));
+
+ TUint temp;
+ if ( ConvertToWsVisibilityChangedEvent(tempStr, temp) )
+ {
+ aWsVisibilityChangedEvent|=temp;
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ }
+ else
+ {
+ if ( aStr==KWsVisibilityChangedCanBeSeen )
+ {
+ aWsVisibilityChangedEvent=TWsVisibilityChangedEvent::ECanBeSeen;
+ }
+ else if ( aStr==KWsVisibilityChangedCantBeSeen )
+ {
+ aWsVisibilityChangedEvent=TWsVisibilityChangedEvent::ECantBeSeen;
+ }
+ else if ( aStr==KWsVisibilityChangedPartiallyVisible )
+ {
+ aWsVisibilityChangedEvent=TWsVisibilityChangedEvent::EPartiallyVisible;
+ }
+ else if ( aStr==KWsVisibilityChangedNotVisible )
+ {
+ aWsVisibilityChangedEvent=TWsVisibilityChangedEvent::ENotVisible;
+ }
+ else if ( aStr==KWsVisibilityChangedFullyVisible )
+ {
+ aWsVisibilityChangedEvent=TWsVisibilityChangedEvent::EFullyVisible;
+ }
+ else
+ {
+ TLex lex(aStr);
+ ret=(lex.Val(aWsVisibilityChangedEvent, EHex)==KErrNone);
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadLongCaptureFlags(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TLongCaptureFlags& aLongCaptureFlags)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KELongCaptureShortEventImmediately )
+ {
+ aLongCaptureFlags = ELongCaptureShortEventImmediately;
+ }
+ else if ( str==KELongCaptureRepeatEvents )
+ {
+ aLongCaptureFlags = ELongCaptureRepeatEvents;
+ }
+ else if ( str==KELongCaptureNormal )
+ {
+ aLongCaptureFlags = ELongCaptureNormal;
+ }
+ else if ( str==KELongCaptureWaitShort )
+ {
+ aLongCaptureFlags = ELongCaptureWaitShort;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aLongCaptureFlags=(TLongCaptureFlags)intVal;
+ }
+ }
+ }
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadSpriteFlags(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TSpriteFlags& aSpriteFlags)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ ret=ConvertToSpriteFlags(str, aSpriteFlags);
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadSpriteFlags(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TUint& aSpriteFlags)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ ret=ConvertToSpriteFlags(str, aSpriteFlags);
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToSpriteFlags(const TDesC& aStr, TSpriteFlags& aSpriteFlags)
+ {
+ TBool ret=ETrue;
+ if ( aStr==KESpriteFlash )
+ {
+ aSpriteFlags=ESpriteFlash;
+ }
+ else if ( aStr==KESpriteNoChildClip )
+ {
+ aSpriteFlags=ESpriteNoChildClip;
+ }
+ else if ( aStr==KESpriteNoShadows )
+ {
+ aSpriteFlags=ESpriteNoShadows;
+ }
+ else
+ {
+ TUint spriteFlag;
+ TLex lex(aStr);
+ ret=(lex.Val(spriteFlag, EHex)==KErrNone);
+ if ( ret )
+ {
+ aSpriteFlags=(TSpriteFlags)spriteFlag;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToSpriteFlags(const TDesC& aStr, TUint& aSpriteFlags)
+ {
+ TBool ret=ETrue;
+ TInt location=aStr.Match(_L("*|*"));
+ if( location!=KErrNotFound )
+ {
+ // Converting Left part of the data
+ TPtrC tempStr=aStr.Left(location);
+ ret=ConvertToSpriteFlags(tempStr, aSpriteFlags);
+
+ // Converting right data can be with another "|"
+ tempStr.Set(aStr.Mid(location+1));
+
+ TUint temp;
+ if ( ConvertToSpriteFlags(tempStr, temp) )
+ {
+ aSpriteFlags|=temp;
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ }
+ else
+ {
+ TSpriteFlags spriteFlag;
+ ret=ConvertToSpriteFlags(aStr, spriteFlag);
+ if ( ret )
+ {
+ aSpriteFlags=(TUint)spriteFlag;
+ }
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadCustomTextCursorAlignment(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RWsSession::TCustomTextCursorAlignment& aAlignment)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KECustomTextCursorAlignTop )
+ {
+ aAlignment=RWsSession::ECustomTextCursorAlignTop;
+ }
+ else if ( str==KECustomTextCursorAlignBaseline )
+ {
+ aAlignment=RWsSession::ECustomTextCursorAlignBaseline;
+ }
+ else if ( str==KECustomTextCursorAlignBottom )
+ {
+ aAlignment=RWsSession::ECustomTextCursorAlignBottom;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, intVal);
+ if ( ret )
+ {
+ aAlignment=(RWsSession::TCustomTextCursorAlignment)intVal;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches TAlgStyle pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetAlgStyleL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TAlgStyle*& aData)
+ {
+ // get AlgStyleData object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<TAlgStyle*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches RDrawableWindow pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetDrawableWindowL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RDrawableWindow*& aData)
+ {
+ // get CFbsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<RDrawableWindow*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches CGraphicsContext::TDrawTextExtendedParam pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetDrawTextExtendedParamL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CGraphicsContext::TDrawTextExtendedParam*& aData)
+ {
+ // get CFbsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<CGraphicsContext::TDrawTextExtendedParam*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches CFbsBitmap pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetFbsBitmapL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFbsBitmap*& aData)
+ {
+ // get CFbsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<CFbsBitmap*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches CFbsDevice pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetFbsDeviceL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFbsDevice*& aData)
+ {
+ // get CFbsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<CFbsDevice*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches CFont pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetFontL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFont*& aData)
+ {
+ // get CFbsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<CFont*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches CPalette pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetPaletteL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CPalette*& aData)
+ {
+ // get PaletteData object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<CPalette*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches CWsBitmap pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetWsBitmapL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CWsBitmap*& aData)
+ {
+ // get CWsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<CWsBitmap*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches TWsEvent pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetWsEventL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsEvent*& aData)
+ {
+ // get CWsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<TWsEvent*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches RWsGraphicMsgBuf pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetWsGraphicMsgBufL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, RWsGraphicMsgBuf*& aData)
+ {
+ // get CWsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<RWsGraphicMsgBuf*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches CWsScreenDevice pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetWsScreenDeviceL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CWsScreenDevice*& aData)
+ {
+ // get CWsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<CWsScreenDevice*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches TWsGraphicMsgFixedBase pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetWsGraphicMsgFixedBaseL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsGraphicMsgFixedBase*& aData)
+ {
+ // get CWsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<TWsGraphicMsgFixedBase*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches TWsPriorityKeyEvent pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetWsPriorityKeyEventL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsPriorityKeyEvent*& aData)
+ {
+ // get CWsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<TWsPriorityKeyEvent*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+/**
+ * Utility method that fetches TWsRedrawEvent pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetWsRedrawEventL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TWsRedrawEvent*& aData)
+ {
+ // get CWsBitmap data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<TWsRedrawEvent*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::GetTextCursor(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TTextCursor& aTextCursor)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ TPtrC str;
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagTextCursorType);
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, tempStore, str);
+ if ( ret )
+ {
+ if ( str==KETypeRectangle )
+ {
+ aTextCursor.iType = TTextCursor::ETypeRectangle;
+ }
+ else if ( str==KETypeHollowRectangle )
+ {
+ aTextCursor.iType = TTextCursor::ETypeHollowRectangle;
+ }
+ else if ( str==KETypeFirst )
+ {
+ aTextCursor.iType = TTextCursor::ETypeFirst;
+ }
+ else if ( str==KETypeLast )
+ {
+ aTextCursor.iType = TTextCursor::ETypeLast;
+ }
+ else if ( str==KETypeLastBasic )
+ {
+ aTextCursor.iType = TTextCursor::ETypeLastBasic;
+ }
+ else
+ {
+ ret=aDataWrapper.GetIntFromConfig(aSectName, tempStore, aTextCursor.iType);
+ }
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagTextCursorFlags);
+ if ( aDataWrapper.GetStringFromConfig(aSectName, tempStore, str) )
+ {
+ if ( str==KEFlagNoFlash )
+ {
+ aTextCursor.iFlags = TTextCursor::EFlagNoFlash;
+ }
+ else if ( str==KEFlagClipHorizontal )
+ {
+ aTextCursor.iFlags = TTextCursor::EFlagClipHorizontal;
+ }
+ else if ( str==KEFlagClipVertical )
+ {
+ aTextCursor.iFlags = TTextCursor::EFlagClipVertical;
+ }
+ else
+ {
+ TInt intVal=0;
+ ret=aDataWrapper.GetIntFromConfig(aSectName, tempStore, intVal);
+ if ( ret )
+ {
+ aTextCursor.iFlags = (TUint)intVal;
+ }
+ }
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagTextCursorHeight);
+ aDataWrapper.GetIntFromConfig(aSectName, tempStore, aTextCursor.iHeight);
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagTextCursorAscent);
+ aDataWrapper.GetIntFromConfig(aSectName, tempStore, aTextCursor.iAscent);
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagTextCursorWidth);
+ aDataWrapper.GetIntFromConfig(aSectName, tempStore, aTextCursor.iWidth);
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagTextCursorColor);
+ aDataWrapper.GetRgbFromConfig(aSectName, tempStore, aTextCursor.iColor);
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::GetSpriteMemberL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TSpriteMember& aSpriteMember)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ TBool ret=ETrue;
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagSpriteMemberBitmap);
+ if ( !CT_GraphicsUtil::GetFbsBitmapL(aDataWrapper, aSectName, tempStore, aSpriteMember.iBitmap) )
+ {
+ ret=EFalse;
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagSpriteMemberMaskBitmap);
+ if ( !CT_GraphicsUtil::GetFbsBitmapL(aDataWrapper, aSectName, tempStore, aSpriteMember.iMaskBitmap) )
+ {
+ aSpriteMember.iMaskBitmap=NULL;
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagSpriteMemberInvertMask);
+ if ( !aDataWrapper.GetBoolFromConfig(aSectName, tempStore, aSpriteMember.iInvertMask) )
+ {
+ aSpriteMember.iInvertMask=EFalse;
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagSpriteMemberDrawMode);
+ if ( !CT_GraphicsUtil::ReadDrawMode(aDataWrapper, aSectName, tempStore, aSpriteMember.iDrawMode) )
+ {
+ ret=EFalse;
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagSpriteMemberOffset);
+ if ( !aDataWrapper.GetPointFromConfig(aSectName, tempStore, aSpriteMember.iOffset) )
+ {
+ ret=EFalse;
+ }
+
+ TInt interval;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagSpriteMemberInterval);
+ if ( aDataWrapper.GetIntFromConfig(aSectName, tempStore, interval) )
+ {
+ aSpriteMember.iInterval=interval;
+ }
+ return ret;
+ }
+
+
+TBool CT_GraphicsUtil::GetSpriteMemberListL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CArrayFix<TSpriteMember>& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ TSpriteMember spriteMember;
+
+ aResult.Reset();
+ TBool ok=ETrue;
+ for ( TInt index=0; ok; )
+ {
+ tempStore.Format(KFormatFieldNumber, &aKeyName, ++index);
+ ok=CT_GraphicsUtil::GetSpriteMemberL(aDataWrapper, aSectName, tempStore, spriteMember);
+ if ( ok )
+ {
+ aResult.AppendL(spriteMember);
+ }
+ }
+
+ return aResult.Count()>0;
+ }
+
+TBool CT_GraphicsUtil::ReadTypefaceSupport(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TTypefaceSupport& aTypefaceSupport)
+ {
+ TTypefaceSupport typefaceSupport;
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ TPtrC str;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTypefaceFontName);
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, tempStore, str);
+ if(ret)
+ {
+ typefaceSupport.iTypeface.iName = str;
+
+
+ TBool attri = EFalse;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KProportional);
+ if(aDataWrapper.GetBoolFromConfig(aSectName, tempStore, attri))
+ {
+ typefaceSupport.iTypeface.SetIsProportional(attri);
+ }
+ tempStore.Format(KFormatEntryField, &aKeyName, &KSerif);
+ if(aDataWrapper.GetBoolFromConfig(aSectName, tempStore, attri))
+ {
+ typefaceSupport.iTypeface.SetIsSerif(attri);
+ }
+ tempStore.Format(KFormatEntryField, &aKeyName, &KSymbol);
+ if(aDataWrapper.GetBoolFromConfig(aSectName, tempStore, attri))
+ {
+ typefaceSupport.iTypeface.SetIsSymbol(attri);
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KNumHeights);
+ aDataWrapper.GetIntFromConfig(aSectName, tempStore, typefaceSupport.iNumHeights);
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KIsScalable);
+ aDataWrapper.GetBoolFromConfig(aSectName, tempStore, typefaceSupport.iIsScalable);
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KMaxHeightInTwips);
+ aDataWrapper.GetIntFromConfig(aSectName, tempStore, typefaceSupport.iMaxHeightInTwips);
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KMinHeightInTwips);
+ aDataWrapper.GetIntFromConfig(aSectName, tempStore, typefaceSupport.iMinHeightInTwips);
+
+ aTypefaceSupport = typefaceSupport;
+ }
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::BringAppForegroundL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aSessionKeyName , const TDesC& aAppKeyName)
+ {
+ TBool result = ETrue;
+ RWsSession* iClient( NULL ); //Window Session Client
+ TPtrC objectName;
+
+ if ( aDataWrapper.GetStringFromConfig(aSectName, aSessionKeyName, objectName) )
+ {
+ iClient = static_cast<RWsSession*>(aDataWrapper.GetDataObjectL(objectName));
+ }
+ else
+ {
+ result = EFalse;
+ }
+
+ if( !aDataWrapper.GetStringFromConfig(aSectName, aAppKeyName, objectName))
+ {
+ result = EFalse;
+ }
+
+ if( result )
+ {
+ TApaTaskList tasklist(*iClient);
+ TApaTask task(tasklist.FindApp(objectName));
+ task.BringToForeground();
+ }
+ return result;
+ }
+
+void CT_GraphicsUtil::EatupMemory(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName)
+ {
+ // read left size in memory from INI
+ TInt leftsize=0;
+ TBool ret=aDataWrapper.GetIntFromConfig(aSectName, aKeyName, leftsize);
+ if ( !ret || leftsize==0)
+ return;
+
+ // eat memory until fail to avaiable memory is less than is left size
+ TInt nTotalSize=User::Heap().Size();
+ TAny* mem=User::AllocZ(nTotalSize);
+
+ if (mem)
+ iMemArray.Append(mem);
+
+ do {
+ mem=User::AllocZ(leftsize);
+ if(mem)
+ {
+ iMemArray.Append(mem);
+ }
+ } while(mem);
+
+ // get avaiable memory, we can't log here, because no enough memory to write log
+ // so we have to write log after free memory
+ iAvaiableSpace=User::Available(iBiggestBlock);
+ }
+
+void CT_GraphicsUtil::FreeEatenMemory(CDataWrapperBase& aDataWrapper)
+ {
+ for (TInt i=0;i<iMemArray.Count();i++)
+ {
+ TAny* mem=iMemArray[i];
+ User::Free(mem);
+ }
+
+ iMemArray.Reset();
+
+ // write memory status after eat memory
+ aDataWrapper.INFO_PRINTF3(_L("CT_GraphicsUtil::FreeEatenMemory, before free memory, avaiable=%d byte biggestblock=%d byte"),iAvaiableSpace,iBiggestBlock);
+ }
+
+TBool CT_GraphicsUtil::GetFrameInfo(CDataWrapperBase& aDataWrapper,const TDesC& aSectName, TFrameInfo& frameinfo)
+ {
+ // get iFrameCoordsInPixels from parameters
+ aDataWrapper.GetRectFromConfig(aSectName, KFldFrameCoordsInPixels, frameinfo.iFrameCoordsInPixels);
+
+ //get iFrameSizeInTwips from parameters
+ aDataWrapper.GetSizeFromConfig(aSectName,KFldFrameSizeInTwips,frameinfo.iFrameSizeInTwips);
+
+ //get iBitsPerPixel from parameters
+ aDataWrapper.GetIntFromConfig(aSectName,KFldBitsPerPixel,frameinfo.iBitsPerPixel);
+
+ //get iDelay from parameters
+ TInt delay=0;
+ TBool ret=aDataWrapper.GetIntFromConfig(aSectName,KFldDelay,delay);
+
+ if(ret)
+ {
+ frameinfo.iDelay=TTimeIntervalMicroSeconds(delay);
+ }
+
+ //get iFlags from parameters,when set frame info, must set flag.
+ ret=ReadFrameInfoFlags(aDataWrapper,aSectName,KFldFlags,frameinfo.iFlags);
+
+ //get iOverallSizeInPixels from parameters
+ aDataWrapper.GetSizeFromConfig(aSectName,KFldOverallSizeInPixels,frameinfo.iOverallSizeInPixels);
+
+ //get iFrameDisplayMode from parameters
+ ReadDisplayMode(aDataWrapper,aSectName,KFldFrameDisplayMode,frameinfo.iFrameDisplayMode);
+
+ //get iBackgroundColor from parameters
+ aDataWrapper.GetRgbFromConfig(aSectName,KFldBackgroundColor,frameinfo.iBackgroundColor);
+
+ //get iFrameSizeInPixels from parameters
+ aDataWrapper.GetSizeFromConfig(aSectName,KFldFrameSizeInPixels,frameinfo.iFrameSizeInPixels);
+
+ //get FrameState from parameters
+ TFrameInfo::TFrameInfoState state;
+
+ if(GetFrameInfoState(aDataWrapper,aSectName,KFldFrameInfoState,state))
+ {
+ frameinfo.SetCurrentFrameState(state);
+ }
+
+ //get current data offset from parameters
+ TInt offset;
+
+ if(aDataWrapper.GetIntFromConfig(aSectName,KFldCurrentDataOffset,offset))
+ {
+ frameinfo.SetCurrentDataOffset(offset);
+ }
+
+ //get frame data offset from parameters
+ if(aDataWrapper.GetIntFromConfig(aSectName,KFldFrameDataOffset,offset))
+ {
+ frameinfo.SetFrameDataOffset(offset);
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadFrameInfoFlags(CDataWrapperBase& aDataWrapper,const TDesC& aSectName, const TDesC& aKeyName,TUint32& aFlags)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ ret=ConvertToFrameInfoFlags(str, aFlags);
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::GetShaperFactoryL(CDataWrapperBase & aDataWrapper, const TDesC & aSectName, const TDesC & aKeyName, CShaperFactory *& aData)
+ {
+ // get CShaperFactory data object from parameters
+ TPtrC name;
+ TBool ret = aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if (ret)
+ {
+ // Data object found
+ aData = static_cast<CShaperFactory*> (aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::GetRasterizerL(CDataWrapperBase & aDataWrapper, const TDesC & aSectName, const TDesC & aKeyName, COpenFontRasterizer *& aData)
+ {
+ // get COpenFontRasterizer data object from parameters
+ TPtrC name;
+ TBool ret = aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if (ret)
+ {
+ // Data object found
+ aData = static_cast<COpenFontRasterizer*> (aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::GetOpenFontGlyphDataL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TOpenFontGlyphData*& aData)
+ {
+ // get TOpenFontGlyphData data object from parameters
+ TPtrC name;
+ TBool ret = aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if (ret)
+ {
+ // Data object found
+ aData = static_cast<TOpenFontGlyphData*> (aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ConvertToFrameInfoFlags(const TDesC& aStr,TUint32& aFrameInfoFlags)
+ {
+ TBool ret=ETrue;
+ TInt location=aStr.Match(_L("*|*"));
+ if( location!=KErrNotFound )
+ {
+ // Converting Left part of the data
+ TPtrC tempStr=aStr.Left(location);
+ ret=ConvertToFrameInfoFlags(tempStr, aFrameInfoFlags);
+
+ // Converting right data can be with another "|"
+ tempStr.Set(aStr.Mid(location+1));
+
+ TUint32 temp;
+ if ( ConvertToFrameInfoFlags(tempStr, temp) )
+ {
+ aFrameInfoFlags|=temp;
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ }
+ else
+ {
+ if ( aStr==KEColor )
+ {
+ aFrameInfoFlags=TFrameInfo::EColor;
+ }
+ else if ( aStr==KETransparencyPossible )
+ {
+ aFrameInfoFlags=TFrameInfo::ETransparencyPossible;
+ }
+ else if ( aStr==KEFullyScaleable )
+ {
+ aFrameInfoFlags=TFrameInfo::EFullyScaleable;
+ }
+ else if ( aStr==KEConstantAspectRatio )
+ {
+ aFrameInfoFlags=TFrameInfo::EConstantAspectRatio;
+ }
+ else if ( aStr==KECanDither )
+ {
+ aFrameInfoFlags=TFrameInfo::ECanDither;
+ }
+ else if ( aStr==KEAlphaChannel )
+ {
+ aFrameInfoFlags=TFrameInfo::EAlphaChannel;
+ }
+ else if ( aStr==KELeaveInPlace )
+ {
+ aFrameInfoFlags=TFrameInfo::ELeaveInPlace;
+ }
+ else if ( aStr==KERestoreToBackground )
+ {
+ aFrameInfoFlags=TFrameInfo::ERestoreToBackground;
+ }
+ else if ( aStr==KERestoreToPrevious )
+ {
+ aFrameInfoFlags=TFrameInfo::ERestoreToPrevious;
+ }
+ else if ( aStr==KEPartialDecodeInvalid )
+ {
+ aFrameInfoFlags=TFrameInfo::EPartialDecodeInvalid;
+ }
+ else if ( aStr==KEMngMoreFramesToDecode )
+ {
+ aFrameInfoFlags=TFrameInfo::EMngMoreFramesToDecode;
+ }
+ else if ( aStr==KEUsesFrameSizeInPixels )
+ {
+ aFrameInfoFlags=TFrameInfo::EUsesFrameSizeInPixels;
+ }
+ else
+ {
+ TUint32 frameinfoFlag;
+ TLex lex(aStr);
+ ret=(lex.Val(frameinfoFlag, EHex)==KErrNone);
+ if ( ret )
+ {
+ aFrameInfoFlags=frameinfoFlag;
+ }
+ }
+ }
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::GetFrameInfoState(CDataWrapperBase& aDataWrapper,const TDesC& aSectName, const TDesC& aKeyName,TFrameInfo::TFrameInfoState& aState)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KEFrameInfoUninitialised )
+ {
+ aState=TFrameInfo::EFrameInfoUninitialised;
+ }
+ else if ( str==KEFrameInfoProcessingFrameHeader )
+ {
+ aState=TFrameInfo::EFrameInfoProcessingFrameHeader;
+ }
+ else if ( str==KEFrameInfoProcessingFrame )
+ {
+ aState=TFrameInfo::EFrameInfoProcessingFrame;
+ }
+ else if ( str==KEFrameInfoProcessingComplete)
+ {
+ aState=TFrameInfo::EFrameInfoProcessingComplete;
+ }
+ else
+ {
+ TUint state;
+ TLex lex(str);
+ ret=(lex.Val(state, EHex)==KErrNone);
+ if ( ret )
+ {
+ aState=(TFrameInfo::TFrameInfoState)state;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+
+TBool CT_GraphicsUtil::GetWsGraphicAnimationL(CDataWrapperBase& aDataWrapper,const TDesC& aSectName, const TDesC& aKeyName, TWsGraphicAnimation*& aData)
+ {
+ // get TWsGraphicAnimation data object from parameters
+ TPtrC name;
+ TBool ret = aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<TWsGraphicAnimation*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::StartAnimTesterClientL(CDataWrapperBase& aDataWrapper,const TDesC& aSectName)
+ {
+ TPtrC processName;
+ if( !aDataWrapper.GetStringFromConfig(aSectName, KFldProcessName, processName) )
+ {
+ return EFalse;
+ }
+ TInt id;
+ if( !aDataWrapper.GetIntFromConfig(aSectName, KFldId, id) )
+ {
+ return EFalse;
+ }
+ TRect rect;
+ if( !aDataWrapper.GetRectFromConfig(aSectName, KFldRect, rect) )
+ {
+ return EFalse;
+ }
+ TPtrC objectName;
+ if ( !aDataWrapper.GetStringFromConfig(aSectName, KFldWsga, objectName) )
+ {
+ return EFalse;
+ }
+ TWsGraphicAnimation* wsGraphAnim;
+ wsGraphAnim = static_cast<TWsGraphicAnimation*>(aDataWrapper.GetDataObjectL(objectName));
+
+ _LIT(KSpace, " ");
+ TBuf<128> args;
+ // Initialize arguments
+ args.Zero();
+ args.Append(processName);
+ args.Append(KSpace);
+ args.AppendNum(0); // screen number
+ args.Append(KSpace);
+ args.AppendNum(id);
+ args.Append(KSpace);
+ args.AppendNum(rect.iTl.iX);
+ args.Append(KSpace);
+ args.AppendNum(rect.iTl.iY);
+ args.Append(KSpace);
+ args.AppendNum(rect.iBr.iX);
+ args.Append(KSpace);
+ args.AppendNum(rect.iBr.iY);
+ args.Append(KSpace);
+ TBuf<32> data;
+ data.Copy(wsGraphAnim->Pckg());
+ args.Append(data);
+
+ // Launch client process
+ RProcess process;
+ CleanupClosePushL(process);
+ User::LeaveIfError(process.Create(processName,args));
+ process.Resume();
+
+ // Synchronize the process
+ RSemaphore semaphore;
+ CleanupClosePushL(semaphore);
+ TInt err = semaphore.OpenGlobal(processName);
+ if( KErrNotFound == err )
+ {
+ User::LeaveIfError(semaphore.CreateGlobal(processName,0));
+ // Wait until new process finish drawing
+ }
+ else if( KErrNone != err )
+ {
+ User::LeaveIfError(err);
+ }
+ semaphore.Wait();
+ CleanupStack::PopAndDestroy(2);
+ return ETrue;
+ }
+
+TBool CT_GraphicsUtil::CloseAnimTesterClientL(CDataWrapperBase& aDataWrapper,const TDesC& aSectName)
+ {
+ TPtrC processName;
+ if( !aDataWrapper.GetStringFromConfig(aSectName, KFldProcessName, processName) )
+ {
+ return EFalse;
+ }
+
+ RSemaphore semaphore;
+ CleanupClosePushL(semaphore);
+ User::LeaveIfError(semaphore.OpenGlobal(processName));
+ // Waken waiting process
+ semaphore.Signal();
+ CleanupStack::PopAndDestroy();
+ return ETrue;
+ }
+
+TBool CT_GraphicsUtil::ReadAnimType(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TInt& aType)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KEAnimWindows)
+ {
+ aType=EKWindowAnim;
+ }
+ else if ( str==KEAnimSprite )
+ {
+ aType=EKSpriteAnim;
+ }
+ else if ( str==KEAnimFreeTimer )
+ {
+ aType=EKFreeTimerWindowAnim;
+ }
+ else
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::ReadAnimCommand(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TInt& aCommand)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KEAnimCmdSync )
+ {
+ aCommand=ECmdSync;
+ }
+ else if ( str==KEAnimCmdTestWithoutPara )
+ {
+ aCommand=ECmdTestWithoutPara;
+ }
+ else if ( str==KEAnimCmdTestWithPara )
+ {
+ aCommand=ECmdTestWithPara;
+ }
+ else if ( str==KEAnimCmdGetLast )
+ {
+ aCommand=ECmdGetLast;
+ }
+ else if ( str==KEAnimCmdGetAnimInterval )
+ {
+ aCommand=ECmdGetAnimInterval;
+ }
+ //MAnimGeneralFunctions
+ else if (str==KEMAnimECmdRetrieveResult)
+ {
+ aCommand=ECmdRetrieveResult;
+ }
+ else if(str==KEMAnimECmdUtilEatupMemory)
+ {
+ aCommand=ECmdUtilEatupMemory;
+ }
+ else if(str==KEMAnimECmdUtilFreeEatenMemory)
+ {
+ aCommand=ECmdUtilFreeEatenMemory;
+ }
+ else if (str==KEMAnimECmdGeneralAnimate)
+ {
+ aCommand=ECmdGeneralAnimate;
+ }
+ else if (str==KEMAnimECmdGeneralClient)
+ {
+ aCommand=ECmdGeneralClient;
+ }
+ else if (str==KEMAnimECmdGeneralFlashStateOn)
+ {
+ aCommand=ECmdGeneralFlashStateOn;
+ }
+ else if (str==KEMAnimECmdGeneralPanic)
+ {
+ aCommand=ECmdGeneralPanic;
+ }
+ else if (str==KEMAnimECmdGeneralScreenDevice)
+ {
+ aCommand=ECmdGeneralScreenDevice;
+ }
+ else if (str==KEMAnimECmdGeneralExtendedInterface)
+ {
+ aCommand=ECmdGeneralExtendedInterface;
+ }
+ else if (str==KEMAnimECmdGeneralWindowExtension)
+ {
+ aCommand=ECmdGeneralWindowExtension;
+ }
+ else if (str==KEMAnimECmdGeneralNumOfExtInterfaces)
+ {
+ aCommand=ECmdGeneralNumOfExtInterfaces;
+ }
+ else if (str==KEMAnimECmdGeneralEventExtension)
+ {
+ aCommand=ECmdGeneralEventExtension;
+ }
+ else if ( str==KEMAnimECmdGeneralGetRawEvents)
+ {
+ aCommand=ECmdGeneralGetRawEvents;
+ }
+ else if ( str==KEMAnimECmdGeneralPostRawEvent)
+ {
+ aCommand=ECmdGeneralPostRawEvent;
+ }
+ else if ( str==KEMAnimECmdGeneralPostKeyEvent)
+ {
+ aCommand=ECmdGeneralPostKeyEvent;
+ }
+ else if ( str==KEMAnimECmdGeneralSetSync)
+ {
+ aCommand=ECmdGeneralSetSync;
+ }
+ else if ( str==KEMAnimECmdGeneralSync)
+ {
+ aCommand=ECmdGeneralSync;
+ }
+ else if ( str==KEMAnimECmdGeneralSetInterval)
+ {
+ aCommand=ECmdGeneralSetInterval;
+ }
+ else if ( str==KEMAnimECmdGeneralSetNextInterval)
+ {
+ aCommand=ECmdGeneralSetNextInterval;
+ }
+ else if ( str==KEMAnimECmdGeneralSystemTime)
+ {
+ aCommand=ECmdGeneralSystemTime;
+ }
+ else if ( str==KEMAnimECmdGeneralRegisterForNotis)
+ {
+ aCommand=ECmdGeneralRegisterForNotis;
+ }
+ else if ( str==KEMAnimECmdGeneralMessage)
+ {
+ aCommand=ECmdGeneralMessage;
+ }
+ else if ( str==KEMAnimECmdGeneralDuplicateBitmapL)
+ {
+ aCommand=ECmdGeneralDuplicateBitmapL;
+ }
+ else if ( str==KEMAnimECmdGeneralDuplicateFontL)
+ {
+ aCommand=ECmdGeneralDuplicateFontL;
+ }
+ else if ( str==KEMAnimECmdGeneralCloseFont)
+ {
+ aCommand=ECmdGeneralCloseFont;
+ }
+ //Opcodes for MAnimSpriteFunctions
+ else if ( str==KEMAnimECmdSpriteGetSpriteMember)
+ {
+ aCommand=ECmdSpriteGetSpriteMember;
+ }
+ else if ( str==KEMAnimECmdSpriteUpdateMember)
+ {
+ aCommand=ECmdSpriteUpdateMember;
+ }
+ else if ( str==KEMAnimECmdSpriteActivate)
+ {
+ aCommand=ECmdSpriteActivate;
+ }
+ else if ( str==KEMAnimECmdSpriteSpriteCanBeSeen)
+ {
+ aCommand=ECmdSpriteSpriteCanBeSeen;
+ }
+ else if ( str==KEMAnimECmdSpriteSizeChangedL)
+ {
+ aCommand=ECmdSpriteSizeChangedL;
+ }
+ else if ( str==KEMAnimECmdSpriteSetPosition)
+ {
+ aCommand=ECmdSpriteSetPosition;
+ }
+ else if (str==KEMAnimECmdGeneralReplyBuf8)
+ {
+ aCommand=ECmdGeneralReplyBuf8;
+ }
+ else if (str==KEMAnimECmdGeneralReplyBuf16)
+ {
+ aCommand=ECmdGeneralReplyBuf16;
+ }
+
+ //MAnimWindowFunctions
+
+ else if (str==KEMAnimECmdWindowActivateGc)
+ {
+ aCommand=ECmdWindowActivateGc;
+ }
+ else if (str==KEMAnimECmdWindowSetRect)
+ {
+ aCommand=ECmdWindowSetRect;
+ }
+ else if (str==KEMAnimECmdWindowWindowSize)
+ {
+ aCommand=ECmdWindowWindowSize;
+ }
+ else if (str==KEMAnimECmdWindowIsHidden)
+ {
+ aCommand=ECmdWindowIsHidden;
+ }
+ else if (str==KEMAnimECmdWindowSetVisible)
+ {
+ aCommand=ECmdWindowSetVisible;
+ }
+ else if (str==KEMAnimECmdWindowInvalidate)
+ {
+ aCommand=ECmdWindowInvalidate;
+ }
+ else if (str==KEMAnimECmdWindowParameters)
+ {
+ aCommand=ECmdWindowParameters;
+ }
+ else if (str==KEMAnimECmdWindowVisibleRegion)
+ {
+ aCommand=ECmdWindowVisibleRegion;
+ }
+ else if (str==KEMAnimECmdWindowIsStarted)
+ {
+ aCommand=ECmdWindowIsStarted;
+ }
+ else if(str==KEMAnimECmdRetrieveResult)
+ {
+ aCommand=ECmdRetrieveResult;
+ }
+ //Add Opcodes covertion here for MAnimGeneralFunctionsWindowExtension
+
+ else if (str==KEMAnimECmdGfweScreens)
+ {
+ aCommand=ECmdGfweScreens;
+ }
+ else if (str==KEMAnimECmdGfweFocusScreens)
+ {
+ aCommand=ECmdGfweFocusScreens;
+ }
+ else if (str==KEMAnimECmdGfweSetFocusScreen)
+ {
+ aCommand=ECmdGfweSetFocusScreen;
+ }
+ else if (str==KEMAnimECmdGfweWindowGroups)
+ {
+ aCommand=ECmdGfweWindowGroups;
+ }
+ else if (str==KEMAnimECmdGfweWindowGroupInfo)
+ {
+ aCommand=ECmdGfweWindowGroupInfo;
+ }
+ else if (str==KEMAnimECmdGfweWindowGroupName)
+ {
+ aCommand=ECmdGfweWindowGroupName;
+ }
+ else if (str==KEMAnimECmdGfweSetOrdinalPosition)
+ {
+ aCommand=ECmdGfweSetOrdinalPosition;
+ }
+ else if (str==KEMAnimECmdGfweIsFocusable)
+ {
+ aCommand=ECmdGfweIsFocusable;
+ }
+ //Add Opcodes covertion here for MAnimFreeTimerWindowFunctions
+ //*
+ ///*
+ else if (str==KEMAnimECmdFreeTimerWinDeactivateGc)
+ {
+ aCommand=ECmdFreeTimerWinDeactivateGc;
+ }
+ else if (str==KEMAnimECmdFreeTimerWinUpdate)
+ {
+ aCommand=ECmdFreeTimerWinUpdate;
+ }
+ else
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+TBool CT_GraphicsUtil::GetFbsBitGcL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CFbsBitGc*& aData)
+ {
+ // get CFbsBitGc data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<CFbsBitGc*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
+
+
+TBool CT_GraphicsUtil::GetGraphicsOrientation(CDataWrapperBase& aDataWrapper,const TDesC& aSectName, const TDesC& aKeyName,CFbsBitGc::TGraphicsOrientation& aParam)
+ {
+ TPtrC str;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, str);
+ if (ret)
+ {
+ if ( str==KEGraphicsOrientationNormal )
+ {
+ aParam=CFbsBitGc::EGraphicsOrientationNormal;
+ }
+ else if(str==KEGraphicsOrientationRotated90)
+ {
+ aParam=CFbsBitGc::EGraphicsOrientationRotated90;
+ }
+ else if(str==KEGraphicsOrientationRotated180)
+ {
+ aParam=CFbsBitGc::EGraphicsOrientationRotated180;
+ }
+ else if(str==KEGraphicsOrientationRotated270)
+ {
+ aParam=CFbsBitGc::EGraphicsOrientationRotated270;
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ }
+ return ret;
+ }
+
+/**
+ * Utility method that fetches CLinkedTypefaceSpecification pointer by command parameter name from INI-file.
+ */
+TBool CT_GraphicsUtil::GetLinkedTypefaceSpecificationL(CDataWrapperBase& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, CLinkedTypefaceSpecification*& aData)
+ {
+ // get CLinkedTypefaceSpecification data object from parameters
+ TPtrC name;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSectName, aKeyName, name);
+ if ( ret )
+ {
+ // Data object found
+ aData=static_cast<CLinkedTypefaceSpecification*>(aDataWrapper.GetDataObjectL(name));
+ }
+
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/src/TestServerBase.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "TestServerBase.h"
+#include "UtilityClearPanicDlg.h"
+
+/*@{*/
+/// Constant Literals used.
+_LIT(KCmdUtilityClearPanicDlg, "utilityClearPanicDlg");
+/*@}*/
+
+CTestStep* CTestServerBase::CreateTestStep(const TDesC& aStepName)
+ {
+ CTestStep* ret=NULL;
+
+ if ( aStepName == KCmdUtilityClearPanicDlg )
+ {
+ ret=new CUtilityClearPanicDlg();
+ }
+ else
+ {
+ ret=CTestServer2::CreateTestStep(aStepName);
+ }
+
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/common/src/UtilityClearPanicDlg.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "UtilityClearPanicDlg.h"
+
+// EPOC Includes
+#include <w32std.h>
+
+/*@{*/
+/// Constant Literals used.
+_LIT(KCmdUtilityClearPanicDlg, "utilityClearPanicDlg");
+/*@}*/
+
+CUtilityClearPanicDlg::CUtilityClearPanicDlg()
+ {
+ SetTestStepName(KCmdUtilityClearPanicDlg);
+ }
+
+enum TVerdict CUtilityClearPanicDlg::doTestStepL()
+ {
+ RWsSession ws;
+ User::LeaveIfError(ws.Connect());
+ CleanupClosePushL(ws);
+
+ TKeyEvent event;
+ event.iCode=EKeyEnter;
+ event.iScanCode=EKeyEnter;
+ event.iModifiers=0;
+ event.iRepeats=0;
+ ws.SimulateKeyEvent(event);
+
+ ws.Flush();
+ CleanupStack::PopAndDestroy(&ws);
+
+ return TestStepResult();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/inc/T_DataBitmapUtil.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataBitmapUtil
+*/
+
+#if (!defined __T_DATA_BITMAP_UTIL_H__)
+#define __T_DATA_BITMAP_UTIL_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <fbs.h>
+
+class CT_DataBitmapUtil : public CDataWrapperBase
+ {
+public:
+ CT_DataBitmapUtil();
+ ~CT_DataBitmapUtil();
+
+ static CT_DataBitmapUtil* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aObject);
+ virtual void DisownObjectL();
+ void DestroyData();
+
+private:
+ void ConstructL();
+
+ static CT_DataBitmapUtil* GetBitmapUtilDataObjectFromParameterL(CDataWrapper& aDataWrapper, const TDesC& aParameterName, const TDesC& aSection);
+
+ void DoCmdNewL(const TDesC& aSection);
+ void DoCmdBeginL(const TDesC& aSection);
+ void DoCmdEnd();
+ void DoCmdSetPixelL(const TDesC& aSection);
+ void DoCmdGetPixel(const TDesC& aSection);
+ void DoCmdSetPos(const TDesC& aSection);
+ void DoCmdDecXPos();
+ void DoCmdDecYPos();
+ void DoCmdIncXPos();
+ void DoCmdIncYPos();
+
+private:
+ /** TBitmapUtil class instance that is tested */
+ TBitmapUtil* iBitmapUtil;
+ };
+
+#endif /* __T_DATA_BITMAP_UTIL_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/inc/T_DataFbsBitmap.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFbsBitmap
+*/
+
+#if (!defined __T_DATA_FBS_BITMAP_H__)
+#define __T_DATA_FBS_BITMAP_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <fbs.h>
+#include <s32file.h>
+#include <bitdev.h>
+
+class CT_DataFbsBitmap : public CDataWrapperBase
+ {
+public:
+ static CT_DataFbsBitmap* NewL();
+ ~CT_DataFbsBitmap();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+
+protected:
+ CT_DataFbsBitmap();
+ void ConstructL();
+
+ virtual CFbsBitmap* GetFbsBitmap() const;
+
+ void RunL(CActive* aActive, TInt aIndex);
+ void DoCancel(CActive* aActive, TInt aIndex);
+
+private:
+ void DestroyData();
+ void DoCmdNewL();
+ void DoCmdDestructor();
+ void DoCmdCompress(const TDesC& aSection);
+ void DoCmdCompressInBackground(const TDesC& aSection, const TInt aAsyncErrorIndex);
+ void DoCmdCreate(const TDesC& aSection);
+ void DoCmdCreateHardwareBitmap(const TDesC& aSection);
+ void DoCmdDataAddress(const TDesC& aSection);
+ void DoCmdDataStride(const TDesC& aSection);
+ void DoCmdDisplayMode(const TDesC& aSection);
+ void DoCmdDuplicateL(const TDesC& aSection);
+ void DoCmdExternalizeL(const TDesC& aSection);
+ void DoCmdExternalizeRectangleL(const TDesC& aSection);
+ void DoCmdGetPaletteL(const TDesC& aSection);
+ void DoCmdGetPixel(const TDesC& aSection);
+ void DoCmdGetScanLineL(const TDesC& aSection);
+ void DoCmdGetVerticalScanLineL(const TDesC& aSection);
+ void DoCmdHandle(const TDesC& aSection);
+ void DoCmdHardwareBitmapHandle(const TDesC& aSection);
+ void DoCmdHeader();
+ void DoCmdHorizontalPixelsToTwips(const TDesC& aSection);
+ void DoCmdHorizontalTwipsToPixels(const TDesC& aSection);
+ void DoCmdInitialDisplayMode(const TDesC& aSection);
+ void DoCmdInternalizeL(const TDesC& aSection);
+ void DoCmdIsCompressedInRAM(const TDesC& aSection);
+ void DoCmdIsFileInRom(const TDesC& aSection);
+ void DoCmdIsLargeBitmap(const TDesC& aSection);
+ void DoCmdIsMonochrome(const TDesC& aSection);
+ void DoCmdIsRomBitmap(const TDesC& aSection);
+ void DoCmdLoadL(const TDesC& aSection);
+ void DoCmdLoadAndCompressL(const TDesC& aSection);
+ void DoCmdLockHeap(const TDesC& aSection);
+ void DoCmdLockHeapLC(const TDesC& aSection);
+ void DoCmdPaletteAttributes(const TDesC& aSection);
+ void DoCmdReset();
+ void DoCmdResize(const TDesC& aSection);
+ void DoCmdSave(const TDesC& aSection);
+ void DoCmdScanLineLength(const TDesC& aSection);
+ void DoCmdSetDisplayMode(const TDesC& aSection);
+ void DoCmdSetPaletteL(const TDesC& aSection);
+ void DoCmdSetRomBitmapL(const TDesC& aSection);
+ void DoCmdSetScanLineL(const TDesC& aSection);
+ void DoCmdSetSizeInTwipsL(const TDesC& aSection);
+ void DoCmdSizeInPixels(const TDesC& aSection);
+ void DoCmdSizeInTwips(const TDesC& aSection);
+ void DoCmdStoreL(const TDesC& aSection);
+ void DoCmdSwapWidthAndHeight();
+ void DoCmdUnlockHeapL(const TDesC& aSection);
+ void DoCmdVerticalPixelsToTwips(const TDesC& aSection);
+ void DoCmdVerticalTwipsToPixels(const TDesC& aSection);
+
+ // MTPActiveCallback implementation
+ void RunCompressInBackground(const TInt aIndex);
+ void DoCancelCompressInBackground(const TInt aIndex);
+
+ // Helpers
+ void ExternalizeImplL(const TDesC& aSection, const TRect& aRect, TBool aUseRect);
+ void LoadOrLoadAndCompressL(const TDesC& aSection, TBool aCompress);
+ inline TDisplayMode GetDisplayMode() const;
+
+private:
+ /** CFbsBitmap class instance that is tested */
+ CFbsBitmap* iFbsBitmap;
+ TDisplayMode iDisplayMode;
+
+ /** Pop when unlocking */
+ TBool iPopWhenUnlocking;
+
+ TBool iCompressFailed;
+
+ /** Active object for CompressInBackground async operation */
+ CActiveCallback* iActiveCompressInBackground;
+ };
+
+#include "T_DataFbsBitmap.inl"
+
+#endif /* __T_DATA_FBS_BITMAP_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/inc/T_DataFbsBitmap.inl Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFbsBitmap inline functions
+*/
+
+TDisplayMode CT_DataFbsBitmap::GetDisplayMode() const
+ {
+ return iDisplayMode;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/inc/T_DataFbsColor256BitmapUtil.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFbsColor256BitmapUtil
+*/
+
+#if (!defined __T_DATA_FBS_COLOR256_BITMAP_UTIL_H__)
+#define __T_DATA_FBS_COLOR256_BITMAP_UTIL_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+// EPOC includes
+#include <e32std.h>
+#include <fbs.h>
+#include "DataWrapperBase.h"
+
+class CT_DataFbsColor256BitmapUtil : public CDataWrapperBase
+ {
+public:
+
+ static CT_DataFbsColor256BitmapUtil* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+ ~CT_DataFbsColor256BitmapUtil();
+ virtual TAny* GetObject();
+
+protected:
+ CT_DataFbsColor256BitmapUtil();
+ void ConstructL();
+
+private:
+ void DestroyData();
+ void DoCmdNewL(const TDesC& aSection);
+ void DoCmdCopyBitmapL(const TDesC& aSection);
+
+ TBool ReadDither(CDataWrapper& aDataWrapper, const TDesC& aSection, CFbsColor256BitmapUtil::TDither& aDither);
+
+private:
+ /** CFbsColor256BitmapUtil class instance to work with*/
+ CFbsColor256BitmapUtil* iFbsColor256BitmapUtil;
+ };
+
+#endif /* __T_DATA_FBS_COLOR256_BITMAP_UTIL_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/inc/T_DataFbsFont.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFbsFont
+*/
+
+#if (!defined __T_DATA_FBS_FONT_H__)
+#define __T_DATA_FBS_FONT_H__
+
+// User Includes
+#include "T_DataFont.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <fbs.h>
+
+
+class CT_DataFbsFont : public CT_DataFont
+ {
+public:
+ static CT_DataFbsFont* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+ virtual void SetObjectL(TAny* aObject);
+ virtual TAny* GetObject();
+ virtual void DisownObjectL();
+
+protected:
+ CT_DataFbsFont();
+
+ virtual CFont* GetFont() const;
+
+private:
+ void DoCmdGetFontMetrics(const TDesC& aSection);
+ void DoCmdTextWidthInPixelsWithCharWidth(const TDesC& aSection);
+ void DoCmdHandle();
+ void DoCmdCharacterMetrics(const TDesC& aSection);
+ void DoCmdRawTextWidthInPixels(const TDesC& aSection);
+ void DoCmdGetFaceAttrib(const TDesC& aSection);
+ void DoCmdIsOpenFont(const TDesC& aSection);
+ void DoCmdHasCharacter(const TDesC& aSection);
+
+private:
+ /** CFbsFont class instance that is tested, not owned by the data-object */
+ CFbsFont* iFbsFont;
+ };
+
+#endif /* __T_DATA_FBS_FONT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/inc/T_DataFbsSession.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFbsSession
+*/
+
+#if (!defined __T_DATA_FBS_SESSION_H__)
+#define __T_DATA_FBS_SESSION_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+// EPOC includes
+#include <e32std.h>
+#include <fbs.h>
+
+class CT_DataFbsSession : public CDataWrapperBase
+ {
+public:
+ static CT_DataFbsSession* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+
+ ~CT_DataFbsSession();
+
+ virtual TAny* GetObject();
+
+protected:
+ CT_DataFbsSession();
+ void ConstructL();
+
+private:
+ inline void DoCmdConstructor();
+ inline void DoCmdConnect(const TDesC& aSection);
+ inline void DoCmdDisconnect();
+ inline void DoCmdGetSession(const TDesC& aSection);
+ inline void DoCmdCallBack(const TDesC& aSection);
+ inline void DoCmdSetCallBack();
+ inline void DoCmdResetCallBack();
+ inline void DoCmdResourceCount(const TDesC& aSection);
+ inline void DoCmdSendCommandL(const TDesC& aSection);
+ inline void DoCmdVersion(const TDesC& aSection);
+ inline void DoCmdHeapBase();
+ inline void DoCmdSessionHandle();
+
+ static TInt CallBackFunction(TAny* aPtr);
+ TInt CallBackFunction();
+
+ TBool GetFbsMessage(const TDesC& aSection, TInt& aMessage);
+
+private:
+ RFs iFsUnconnected;
+
+ RFbsSession* iSession;
+
+ /** vaiable that temporarily stores value of server resource count that is set
+ * by iSession->ResourceCount()
+ */
+ TInt iResourceCount;
+
+ /* used to check if the callback function was called*/
+ TBool iCallBackCalled;
+ };
+
+#endif /* __T_DATA_FBS_SESSION_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/inc/T_DataFbsTypefaceStore.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFbsTypefaceStore
+*/
+
+#if (!defined __T_DATA_FBS_TYPEFACE_STORE_H__)
+#define __T_DATA_FBS_TYPEFACE_STORE_H__
+
+// User Includes
+#include "T_DataTypefaceStore.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <fbs.h>
+
+class CT_DataFbsTypefaceStore : public CT_DataTypefaceStore
+ {
+public:
+ static CT_DataFbsTypefaceStore* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+ ~CT_DataFbsTypefaceStore();
+
+ virtual TAny* GetObject();
+
+protected:
+ CT_DataFbsTypefaceStore();
+ void ConstructL();
+
+ // CT_DataTypefaceStore implementation
+ virtual CTypefaceStore* GetTypefaceStore() const;
+
+private:
+ void DestroyData();
+ void DoCmdNewL(const TDesC& aSection);
+ void DoCmdGetNearestFontInPixelsL(const TDesC& aSection);
+ void DoCmdGetNearestFontToDesignHeightInPixelsL(const TDesC& aSection);
+ void DoCmdGetNearestFontToMaxHeightInPixelsL(const TDesC& aSection);
+ void DoCmdAddFile(const TDesC& aSection);
+ void DoCmdInstallFile(const TDesC& aSection);
+ void DoCmdRemoveFile(const TDesC& aSection);
+ void DoCmdGetFontByIdL(const TDesC& aSection);
+ void DoCmdFontHeightInPixels(const TDesC& aSection);
+ void DoCmdDefaultBitmapType(const TDesC& aSection);
+ void DoCmdSetDefaultBitmapType(const TDesC& aSection);
+ void DoCmdSetFontNameAlias(const TDesC& aSection);
+ void DoCmdSetDefaultLanguageForMetrics(const TDesC& aSection);
+ void DoCmdRemoveFontFileLocks(const TDesC& aSection);
+ void DoCmdSetSystemDefaultTypefaceName(const TDesC& aSection);
+
+private:
+ /** CFbsTypefaceStore class instance to work with*/
+ CFbsTypefaceStore* iFbsTypefaceStore;
+
+ /** temporarily stored value of typeface file id. Set by AddFile() and InstallFile() for later use in RemoveFile() */
+ TInt iLastTypefaceFileId;
+ };
+
+#endif /* __T_DATA_FBS_TYPEFACE_STORE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/inc/T_FBServAPIServer.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_FBServAPIServer
+*/
+
+#if (!defined __T_FBSERV_API_SERVER_H__)
+#define __T_FBSERV_API_SERVER_H__
+
+// User Include
+#include "T_DataFbsSession.h"
+#include "T_DataFbsFont.h"
+#include "T_DataFbsBitmap.h"
+#include "T_DataBitmapUtil.h"
+#include "T_DataFbsTypefaceStore.h"
+#include "T_DataFbsColor256BitmapUtil.h"
+
+#include "T_DataPalette.h"
+#include "T_DataFbsBitmapDevice.h"
+#include "T_DataFbsScreenDevice.h"
+#include "T_DataAlgStyle.h"
+#include "T_DataMeasureTextInput.h"
+#include "T_DataMeasureTextOutput.h"
+
+#include "TestServerBase.h"
+
+class CT_FBServAPIServer : public CTestServerBase
+ {
+private:
+ class CT_FBServAPIBlock : public CTestBlockController
+ {
+ public:
+ inline CT_FBServAPIBlock();
+ inline ~CT_FBServAPIBlock();
+
+ inline CDataWrapper* CreateDataL( const TDesC& aData );
+ };
+public:
+ inline CT_FBServAPIServer();
+ inline ~CT_FBServAPIServer();
+
+ static CT_FBServAPIServer* NewL();
+
+ inline CTestBlockController* CreateTestBlock();
+ };
+
+#include "T_FBServAPIServer.inl"
+
+#endif /* __T_FBSERV_API_SERVER_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/inc/T_FBServAPIServer.inl Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_FBServAPIServer inline functions
+*/
+
+
+_LIT(KRFbsSessionData, "RFbsSession");
+_LIT(KCFbsFontData, "CFbsFont");
+_LIT(KCFbsBitmapData, "CFbsBitmap");
+_LIT(KTBitmapUtilData, "TBitmapUtil");
+_LIT(KCFbsTypefaceStoreData, "CFbsTypefaceStore");
+_LIT(KCFbsColor256BitmapUtil, "CFbsColor256BitmapUtil");
+_LIT(KCPalette, "CPalette");
+_LIT(KCFbsBitmapDevice, "CFbsBitmapDevice");
+_LIT(KCFbsScreenDevice, "CFbsScreenDevice");
+_LIT(KTAlgStyle, "TAlgStyle");
+_LIT(KTMeasureTextInput, "TMeasureTextInput");
+_LIT(KTMeasureTextOutput, "TMeasureTextOutput");
+
+inline CT_FBServAPIServer::CT_FBServAPIBlock::CT_FBServAPIBlock()
+ {
+ }
+
+inline CT_FBServAPIServer::CT_FBServAPIBlock::~CT_FBServAPIBlock()
+ {
+ }
+
+inline CDataWrapper* CT_FBServAPIServer::CT_FBServAPIBlock::CreateDataL( const TDesC& aData )
+ {
+ CDataWrapper* wrapper = NULL;
+ if (aData == KRFbsSessionData())
+ {
+ wrapper = CT_DataFbsSession::NewL();
+ }
+ else if (aData == KCFbsFontData())
+ {
+ wrapper = CT_DataFbsFont::NewL();
+ }
+ else if (aData == KCFbsBitmapData())
+ {
+ wrapper = CT_DataFbsBitmap::NewL();
+ }
+ else if (aData == KTBitmapUtilData())
+ {
+ wrapper = CT_DataBitmapUtil::NewL();
+ }
+ else if (aData == KCFbsTypefaceStoreData())
+ {
+ wrapper = CT_DataFbsTypefaceStore::NewL();
+ }
+ else if (aData == KCFbsColor256BitmapUtil())
+ {
+ wrapper = CT_DataFbsColor256BitmapUtil::NewL();
+ }
+ else if (aData == KCPalette())
+ {
+ wrapper = CT_DataPalette::NewL();
+ }
+ else if ( aData==KCFbsBitmapDevice() )
+ {
+ wrapper = CT_DataFbsBitmapDevice::NewL();
+ }
+ else if ( aData==KCFbsScreenDevice() )
+ {
+ wrapper = CT_DataFbsScreenDevice::NewL();
+ }
+ else if ( aData==KTAlgStyle() )
+ {
+ wrapper = CT_DataAlgStyle::NewL();
+ }
+ else if ( aData==KTMeasureTextInput() )
+ {
+ wrapper = CT_DataMeasureTextInput::NewL();
+ }
+ else if ( aData==KTMeasureTextOutput() )
+ {
+ wrapper = CT_DataMeasureTextOutput::NewL();
+ }
+ return wrapper;
+ }
+
+inline CT_FBServAPIServer::CT_FBServAPIServer()
+ {
+ }
+
+inline CT_FBServAPIServer::~CT_FBServAPIServer()
+ {
+ }
+
+inline CTestBlockController* CT_FBServAPIServer::CreateTestBlock()
+ {
+ return new CT_FBServAPIBlock();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/src/T_DataBitmapUtil.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,403 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataBitmapUtil
+*/
+
+// User includes
+#include "T_DataBitmapUtil.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Parameters
+_LIT(KBitmap, "bitmap");
+_LIT(KPointX, "point_x");
+_LIT(KPointY, "point_y");
+_LIT(KOtherBitmapUtil, "other_bitmap_util");
+_LIT(KColor, "color");
+_LIT(KColorMask, "colormask");
+
+/// Commands
+_LIT(KCmdNew, "new");
+_LIT(KCmdBegin, "Begin");
+_LIT(KCmdEnd, "End");
+_LIT(KCmdSetPixel, "SetPixel");
+_LIT(KCmdGetPixel, "GetPixel");
+_LIT(KCmdSetPos, "SetPos");
+_LIT(KCmdDecXPos, "DecXPos");
+_LIT(KCmdDecYPos, "DecYPos");
+_LIT(KCmdIncXPos, "IncXPos");
+_LIT(KCmdIncYPos, "IncYPos");
+_LIT(KCleanup, "~");
+/*@}*/
+
+/**
+* Two phase constructor
+*/
+CT_DataBitmapUtil* CT_DataBitmapUtil::NewL()
+ {
+ CT_DataBitmapUtil* ret = new (ELeave) CT_DataBitmapUtil();
+ return ret;
+ }
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataBitmapUtil::CT_DataBitmapUtil()
+: CDataWrapperBase()
+, iBitmapUtil(NULL)
+ {
+ }
+
+/**
+* Protected desctructor
+*/
+CT_DataBitmapUtil::~CT_DataBitmapUtil()
+ {
+ DestroyData();
+ }
+
+/**
+* Contains cleanup implementation
+*/
+void CT_DataBitmapUtil::DestroyData()
+ {
+ delete iBitmapUtil;
+ iBitmapUtil = NULL;
+ }
+
+TAny* CT_DataBitmapUtil::GetObject()
+ {
+ return iBitmapUtil;
+ }
+
+void CT_DataBitmapUtil::SetObjectL(TAny* aObject)
+ {
+ DestroyData();
+ iBitmapUtil = static_cast<TBitmapUtil*> (aObject);
+ }
+
+void CT_DataBitmapUtil::DisownObjectL()
+ {
+ iBitmapUtil = NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataBitmapUtil::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNew)
+ {
+ DoCmdNewL(aSection);
+ }
+ else if (aCommand == KCmdBegin)
+ {
+ DoCmdBeginL(aSection);
+ }
+ else if (aCommand == KCmdEnd)
+ {
+ DoCmdEnd();
+ }
+ else if (aCommand == KCmdSetPixel)
+ {
+ DoCmdSetPixelL(aSection);
+ }
+ else if (aCommand == KCmdGetPixel)
+ {
+ DoCmdGetPixel(aSection);
+ }
+ else if (aCommand == KCmdSetPos)
+ {
+ DoCmdSetPos(aSection);
+ }
+ else if (aCommand == KCmdDecXPos)
+ {
+ DoCmdDecXPos();
+ }
+ else if (aCommand == KCmdDecYPos)
+ {
+ DoCmdDecYPos();
+ }
+ else if (aCommand == KCmdIncXPos)
+ {
+ DoCmdIncXPos();
+ }
+ else if (aCommand == KCmdIncYPos)
+ {
+ DoCmdIncYPos();
+ }
+ else if (aCommand == KCleanup)
+ {
+ DestroyData();
+ }
+ else
+ {
+ retVal=EFalse;
+ }
+
+ return retVal;
+ }
+
+
+
+/** Creates a TBitmapUtil instance */
+void CT_DataBitmapUtil::DoCmdNewL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Creates a TBitmapUtil instance"));
+
+ // get fbsBitmap passed as a parameter
+ CFbsBitmap* fbsBitmap=NULL;
+ CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KBitmap(), fbsBitmap);
+
+ // cleanup if already created
+ delete iBitmapUtil;
+ iBitmapUtil = NULL;
+
+ // call new operator
+ TRAPD(err, iBitmapUtil = new (ELeave) TBitmapUtil(fbsBitmap));
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Error creation instance: %d"), err);
+ SetError(err);
+ }
+ }
+
+
+/** Calls TBitmapUtil::Begin() */
+void CT_DataBitmapUtil::DoCmdBeginL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls TBitmapUtil::Begin()"));
+ TBool dataOk=ETrue;
+
+ // get position x-coordinate from parameters
+ TInt pointX;
+ if(!GetIntFromConfig(aSection, KPointX(), pointX))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPointX());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get position y-coordinate from parameters
+ TInt pointY;
+ if(!GetIntFromConfig(aSection, KPointY(), pointY))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPointY());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ if ( dataOk )
+ {
+ // call Begin()
+ // get bitmapUtil passed as a parameter
+ CT_DataBitmapUtil* bitmapUtilDataObject = CT_DataBitmapUtil::GetBitmapUtilDataObjectFromParameterL(*this, KOtherBitmapUtil(), aSection);
+
+ if (bitmapUtilDataObject == NULL)
+ {
+ iBitmapUtil->Begin(TPoint(pointX, pointY));
+ }
+ else
+ {
+ TBitmapUtil* otherBitmapUtil = static_cast<TBitmapUtil*>(bitmapUtilDataObject->GetObject());
+
+ // call Begin()
+ iBitmapUtil->Begin(TPoint(pointX, pointY), *otherBitmapUtil);
+ }
+ }
+ }
+
+
+/** Calls TBitmapUtil::End() */
+void CT_DataBitmapUtil::DoCmdEnd()
+ {
+ INFO_PRINTF1(_L("Calls TBitmapUtil::End()"));
+
+ // call End()
+ iBitmapUtil->End();
+ }
+
+
+/** Calls TBitmapUtil::SetPixel() */
+void CT_DataBitmapUtil::DoCmdSetPixelL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls TBitmapUtil::SetPixel()"));
+
+ // get bitmapUtil passed as a parameter
+ CT_DataBitmapUtil* bitmapUtilDataObject = CT_DataBitmapUtil::GetBitmapUtilDataObjectFromParameterL(*this, KOtherBitmapUtil(), aSection);
+
+ if (bitmapUtilDataObject == NULL)
+ {
+ // get color from parameters
+ TInt color;
+ if(!GetIntFromConfig(aSection, KColor(), color))
+ {
+ ERR_PRINTF2(_L("No %S"), &KColor());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call SetPixel()
+ iBitmapUtil->SetPixel(TUint32(color));
+ }
+ }
+ else
+ {
+ TBitmapUtil* otherBitmapUtil = static_cast<TBitmapUtil*>(bitmapUtilDataObject->GetObject());
+
+ // call SetPixel()
+ iBitmapUtil->SetPixel(*otherBitmapUtil);
+ }
+ }
+
+
+/** Calls TBitmapUtil::GetPixel() */
+void CT_DataBitmapUtil::DoCmdGetPixel(const TDesC& aSection)
+ {
+ // call GetPixel()
+ TUint32 color = iBitmapUtil->GetPixel();
+ INFO_PRINTF2(_L("Calls TBitmapUtil::GetPixel() %d"), color);
+
+ TInt colorMask;
+ if ( GetHexFromConfig(aSection, KColorMask(), colorMask) )
+ {
+ color &= colorMask;
+ INFO_PRINTF2(_L("Color after masking %d"), color);
+ }
+
+ // get expected color from parameters
+ TInt expectedColor;
+ if(GetIntFromConfig(aSection, KColor(), expectedColor))
+ {
+ // check that the value is as expected
+ if (color != (TUint32)expectedColor )
+ {
+ ERR_PRINTF3(_L("The value is not as expected! expected: %d, actual: %d"), expectedColor, color);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls TBitmapUtil::SetPos() */
+void CT_DataBitmapUtil::DoCmdSetPos(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls TBitmapUtil::SetPos()"));
+ TBool dataOk=ETrue;
+
+ // get position x-coordinate from parameters
+ TInt pointX;
+ if(!GetIntFromConfig(aSection, KPointX(), pointX))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPointX());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get position y-coordinate from parameters
+ TInt pointY;
+ if(!GetIntFromConfig(aSection, KPointY(), pointY))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPointY());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ if ( dataOk )
+ {
+ // call SetPos()
+ iBitmapUtil->SetPos(TPoint(pointX, pointY));
+ }
+ }
+
+
+/** Calls TBitmapUtil::DecXPos() */
+void CT_DataBitmapUtil::DoCmdDecXPos()
+ {
+ INFO_PRINTF1(_L("Calls TBitmapUtil::DecXPos()"));
+
+ // call DecXPos()
+ iBitmapUtil->DecXPos();
+ }
+
+
+/** Calls TBitmapUtil::DecYPos() */
+void CT_DataBitmapUtil::DoCmdDecYPos()
+ {
+ INFO_PRINTF1(_L("Calls TBitmapUtil::DecYPos()"));
+
+ // call DecYPos()
+ iBitmapUtil->DecYPos();
+ }
+
+
+/** Calls TBitmapUtil::IncXPos() */
+void CT_DataBitmapUtil::DoCmdIncXPos()
+ {
+ INFO_PRINTF1(_L("Calls TBitmapUtil::IncXPos()"));
+
+ // call IncXPos()
+ iBitmapUtil->IncXPos();
+ }
+
+
+/** Calls TBitmapUtil::IncYPos() */
+void CT_DataBitmapUtil::DoCmdIncYPos()
+ {
+ INFO_PRINTF1(_L("Calls TBitmapUtil::IncYPos()"));
+
+ // call IncYPos()
+ iBitmapUtil->IncYPos();
+ }
+
+
+
+///////////////////////////////// UTIL METHODS //////////////////////////////////////
+
+
+/**
+* Utility method that fetches CT_DataBitmapUtil pointer by command parameter name from INI-file.
+*/
+CT_DataBitmapUtil* CT_DataBitmapUtil::GetBitmapUtilDataObjectFromParameterL(CDataWrapper& aDataWrapper, const TDesC& aParameterName, const TDesC& aSection)
+ {
+ // get AlgStyleData object from parameters
+ CT_DataBitmapUtil* ret=NULL;
+
+ TPtrC bitmapUtilDataObjectName;
+ // get BitmapUtilData object from parameters
+ if ( aDataWrapper.GetStringFromConfig(aSection, aParameterName, bitmapUtilDataObjectName) )
+ {
+ // check that the data object was found
+ ret=static_cast<CT_DataBitmapUtil*>(aDataWrapper.GetDataWrapperL(bitmapUtilDataObjectName));
+ }
+
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/src/T_DataFbsBitmap.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,2294 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+v
+This contains CT_DataFbsBitmap
+*/
+
+// User includes
+#include "T_DataFbsBitmap.h"
+#include "T_GraphicsUtil.h"
+
+
+/*@{*/
+/// Parameters
+_LIT(KAlways, "always");
+_LIT(KBitmapId, "bitmap_id");
+_LIT(KBuffLength, "buff_length");
+_LIT(KDitherOffsetX, "dither_offset_x");
+_LIT(KDitherOffsetY, "dither_offset_y");
+_LIT(KExpectedBool, "expected_bool");
+_LIT(KExpectedInt, "expected_int");
+_LIT(KFbsBitmapName, "fbs_bitmap_name");
+_LIT(KFileName, "file_name");
+_LIT(KFileOffset, "file_offset");
+_LIT(KHeight, "height");
+_LIT(KHandle, "handle");
+_LIT(KWidth, "width");
+_LIT(KLength, "length");
+_LIT(KNullExpected, "null_expected");
+_LIT(KDevice, "device");
+_LIT(KNumberOfSources, "number_of_sources");
+_LIT(KPixels, "pixels");
+_LIT(KPointX, "point_x");
+_LIT(KPointY, "point_y");
+_LIT(KRectTlX, "rect_tl_x");
+_LIT(KRectTlY, "rect_tl_y");
+_LIT(KRectBrX, "rect_br_x");
+_LIT(KRectBrY, "rect_br_y");
+_LIT(KScanLineCoord, "scan_line_coord");
+_LIT(KSourceFileName0, "source_file_name_0"); // we don't need more than 3 sources for our test anyway.
+_LIT(KSourceFileName1, "source_file_name_1"); // So that this solution is ok
+_LIT(KSourceFileName2, "source_file_name_2");
+_LIT(KSourceBitmapId0, "source_bitmap_id_0");
+_LIT(KSourceBitmapId1, "source_bitmap_id_1");
+_LIT(KSourceBitmapId2, "source_bitmap_id_2");
+_LIT(KShareIfLoaded, "share_if_loaded");
+_LIT(KTwips, "twips");
+_LIT(KUseDitherOffset, "use_dither_offset");
+_LIT(KUseRFile, "use_rfile");
+_LIT(KUseClosedRFile, "use_closed_rfile");
+_LIT(KUseClosedStream, "use_closed_stream");
+_LIT(KUseRequestStatus, "use_request_status");
+_LIT(KUid, "uid");
+_LIT(KPalette, "palette");
+_LIT(KModifiable, "modifiable");
+_LIT(KEntries, "entries");
+_LIT(KRed, "red");
+_LIT(KGreen, "green");
+_LIT(KBlue, "blue");
+_LIT(KDisplayMode, "displaymode");
+_LIT(KBitmapfileCompressionScheme, "bitmap_compression_scheme");
+
+/// Commands
+_LIT(KCmdDisown, "disown");
+_LIT(KCmdNew, "new");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdCompress, "Compress");
+_LIT(KCmdCompressInBackground, "CompressInBackground");
+_LIT(KCmdCreate, "Create");
+_LIT(KCmdCreateHardwareBitmap, "CreateHardwareBitmap");
+_LIT(KCmdDataAddress, "DataAddress");
+_LIT(KCmdDataStride, "DataStride");
+_LIT(KCmdDisplayMode, "DisplayMode");
+_LIT(KCmdDuplicate, "Duplicate");
+_LIT(KCmdExternalizeL, "ExternalizeL");
+_LIT(KCmdExternalizeRectangleL, "ExternalizeRectangleL");
+_LIT(KCmdGetPalette, "GetPalette");
+_LIT(KCmdGetPixel, "GetPixel");
+_LIT(KCmdGetScanLine, "GetScanLine");
+_LIT(KCmdGetVerticalScanLine, "GetVerticalScanLine");
+_LIT(KCmdHandle, "Handle");
+_LIT(KCmdHardwareBitmapHandle, "HardwareBitmapHandle");
+_LIT(KCmdHeader, "Header");
+_LIT(KCmdHorizontalPixelsToTwips, "HorizontalPixelsToTwips");
+_LIT(KCmdHorizontalTwipsToPixels, "HorizontalTwipsToPixels");
+_LIT(KCmdInitialDisplayMode, "InitialDisplayMode");
+_LIT(KCmdInternalizeL, "InternalizeL");
+_LIT(KCmdIsCompressedInRAM, "IsCompressedInRAM");
+_LIT(KCmdIsFileInRom, "IsFileInRom");
+_LIT(KCmdIsLargeBitmap, "IsLargeBitmap");
+_LIT(KCmdIsMonochrome, "IsMonochrome");
+_LIT(KCmdIsRomBitmap, "IsRomBitmap");
+_LIT(KCmdLoad, "Load");
+_LIT(KCmdLoadAndCompress, "LoadAndCompress");
+_LIT(KCmdLockHeap, "LockHeap");
+_LIT(KCmdLockHeapLC, "LockHeapLC");
+_LIT(KCmdPaletteAttributes, "PaletteAttributes");
+_LIT(KCmdReset, "Reset");
+_LIT(KCmdResize, "Resize");
+_LIT(KCmdSave, "Save");
+_LIT(KCmdScanLineLength, "ScanLineLength");
+_LIT(KCmdSetDisplayMode, "SetDisplayMode");
+_LIT(KCmdSetPalette, "SetPalette");
+_LIT(KCmdSetRomBitmapL, "SetRomBitmapL");
+_LIT(KCmdSetScanLine, "SetScanLine");
+_LIT(KCmdSetSizeInTwips, "SetSizeInTwips");
+_LIT(KCmdSizeInPixels, "SizeInPixels");
+_LIT(KCmdSizeInTwips, "SizeInTwips");
+_LIT(KCmdStoreL, "StoreL");
+_LIT(KCmdSwapWidthAndHeight, "SwapWidthAndHeight");
+_LIT(KCmdUnlockHeap, "UnlockHeap");
+_LIT(KCmdVerticalPixelsToTwips, "VerticalPixelsToTwips");
+_LIT(KCmdVerticalTwipsToPixels, "VerticalTwipsToPixels");
+
+//?? SetRomBitmapL
+// Begin
+// End
+// GetDecompressionBuffer
+// GetAllBitmapHandles
+/*@}*/
+
+/**
+* Two phase constructor
+*/
+CT_DataFbsBitmap* CT_DataFbsBitmap::NewL()
+ {
+ CT_DataFbsBitmap* ret = new (ELeave) CT_DataFbsBitmap();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataFbsBitmap::CT_DataFbsBitmap()
+: CDataWrapperBase()
+, iFbsBitmap(NULL)
+, iDisplayMode(ENone)
+, iPopWhenUnlocking(EFalse)
+, iCompressFailed(EFalse)
+, iActiveCompressInBackground(NULL)
+ {
+ }
+
+/**
+* Protected constructor. Second phase construction
+*/
+void CT_DataFbsBitmap::ConstructL()
+ {
+ iActiveCompressInBackground=CActiveCallback::NewL(*this);
+ }
+
+/**
+* Destructor.
+*/
+CT_DataFbsBitmap::~CT_DataFbsBitmap()
+ {
+ DestroyData();
+ delete iActiveCompressInBackground;
+ iActiveCompressInBackground=NULL;
+ }
+
+/**
+* Contains cleanup implementation
+*/
+void CT_DataFbsBitmap::DestroyData()
+ {
+ delete iFbsBitmap;
+ iFbsBitmap=NULL;
+ }
+
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataFbsBitmap::GetObject()
+ {
+ return iFbsBitmap;
+ }
+
+void CT_DataFbsBitmap::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iFbsBitmap=static_cast<CFbsBitmap*> (aAny);
+ }
+
+void CT_DataFbsBitmap::DisownObjectL()
+ {
+ iFbsBitmap=NULL;
+ }
+
+CFbsBitmap* CT_DataFbsBitmap::GetFbsBitmap() const
+ {
+ return iFbsBitmap;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsBitmap::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNew)
+ {
+ DoCmdNewL();
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DoCmdDestructor();
+ }
+ else if (aCommand == KCmdCompress)
+ {
+ DoCmdCompress(aSection);
+ }
+ else if (aCommand == KCmdCompressInBackground)
+ {
+ DoCmdCompressInBackground(aSection, aAsyncErrorIndex);
+ }
+ else if (aCommand == KCmdCreate)
+ {
+ DoCmdCreate(aSection);
+ }
+ else if (aCommand == KCmdCreateHardwareBitmap)
+ {
+ DoCmdCreateHardwareBitmap(aSection);
+ }
+ else if (aCommand == KCmdDataAddress)
+ {
+ DoCmdDataAddress(aSection);
+ }
+ else if (aCommand == KCmdDataStride)
+ {
+ DoCmdDataStride(aSection);
+ }
+ else if (aCommand == KCmdDisplayMode)
+ {
+ DoCmdDisplayMode(aSection);
+ }
+ else if (aCommand == KCmdDuplicate)
+ {
+ DoCmdDuplicateL(aSection);
+ }
+ else if (aCommand == KCmdExternalizeL)
+ {
+ DoCmdExternalizeL(aSection);
+ }
+ else if (aCommand == KCmdExternalizeRectangleL)
+ {
+ DoCmdExternalizeRectangleL(aSection);
+ }
+ else if (aCommand == KCmdGetPalette)
+ {
+ DoCmdGetPaletteL(aSection);
+ }
+ else if (aCommand == KCmdGetPixel)
+ {
+ DoCmdGetPixel(aSection);
+ }
+ else if (aCommand == KCmdGetScanLine)
+ {
+ DoCmdGetScanLineL(aSection);
+ }
+ else if (aCommand == KCmdGetVerticalScanLine)
+ {
+ DoCmdGetVerticalScanLineL(aSection);
+ }
+ else if (aCommand == KCmdHandle)
+ {
+ DoCmdHandle(aSection);
+ }
+ else if (aCommand == KCmdHardwareBitmapHandle)
+ {
+ DoCmdHardwareBitmapHandle(aSection);
+ }
+ else if (aCommand == KCmdHeader)
+ {
+ DoCmdHeader();
+ }
+ else if (aCommand == KCmdHorizontalPixelsToTwips)
+ {
+ DoCmdHorizontalPixelsToTwips(aSection);
+ }
+ else if (aCommand == KCmdHorizontalTwipsToPixels)
+ {
+ DoCmdHorizontalTwipsToPixels(aSection);
+ }
+ else if (aCommand == KCmdInitialDisplayMode)
+ {
+ DoCmdInitialDisplayMode(aSection);
+ }
+ else if (aCommand == KCmdInternalizeL)
+ {
+ DoCmdInternalizeL(aSection);
+ }
+ else if (aCommand == KCmdIsCompressedInRAM)
+ {
+ DoCmdIsCompressedInRAM(aSection);
+ }
+ else if (aCommand == KCmdIsFileInRom)
+ {
+ DoCmdIsFileInRom(aSection);
+ }
+ else if (aCommand == KCmdIsLargeBitmap)
+ {
+ DoCmdIsLargeBitmap(aSection);
+ }
+ else if (aCommand == KCmdIsMonochrome)
+ {
+ DoCmdIsMonochrome(aSection);
+ }
+ else if (aCommand == KCmdIsRomBitmap)
+ {
+ DoCmdIsRomBitmap(aSection);
+ }
+ else if (aCommand == KCmdLoad)
+ {
+ DoCmdLoadL(aSection);
+ }
+ else if (aCommand == KCmdLoadAndCompress)
+ {
+ DoCmdLoadAndCompressL(aSection);
+ }
+ else if (aCommand == KCmdLockHeap)
+ {
+ DoCmdLockHeap(aSection);
+ }
+ else if (aCommand == KCmdLockHeapLC)
+ {
+ DoCmdLockHeapLC(aSection);
+ }
+ else if (aCommand == KCmdPaletteAttributes)
+ {
+ DoCmdPaletteAttributes(aSection);
+ }
+ else if (aCommand == KCmdReset)
+ {
+ DoCmdReset();
+ }
+ else if (aCommand == KCmdResize)
+ {
+ DoCmdResize(aSection);
+ }
+ else if (aCommand == KCmdSave)
+ {
+ DoCmdSave(aSection);
+ }
+ else if (aCommand == KCmdScanLineLength)
+ {
+ DoCmdScanLineLength(aSection);
+ }
+ else if (aCommand == KCmdSetDisplayMode)
+ {
+ DoCmdSetDisplayMode(aSection);
+ }
+ else if (aCommand == KCmdSetPalette)
+ {
+ DoCmdSetPaletteL(aSection);
+ }
+ else if (aCommand == KCmdSetRomBitmapL)
+ {
+ DoCmdSetRomBitmapL(aSection);
+ }
+ else if (aCommand == KCmdSetScanLine)
+ {
+ DoCmdSetScanLineL(aSection);
+ }
+ else if (aCommand == KCmdSetSizeInTwips)
+ {
+ DoCmdSetSizeInTwipsL(aSection);
+ }
+ else if (aCommand == KCmdSizeInPixels)
+ {
+ DoCmdSizeInPixels(aSection);
+ }
+ else if (aCommand == KCmdSizeInTwips)
+ {
+ DoCmdSizeInTwips(aSection);
+ }
+ else if (aCommand == KCmdStoreL)
+ {
+ DoCmdStoreL(aSection);
+ }
+ else if (aCommand == KCmdSwapWidthAndHeight)
+ {
+ DoCmdSwapWidthAndHeight();
+ }
+ else if (aCommand == KCmdUnlockHeap)
+ {
+ DoCmdUnlockHeapL(aSection);
+ }
+ else if (aCommand == KCmdVerticalPixelsToTwips)
+ {
+ DoCmdVerticalPixelsToTwips(aSection);
+ }
+ else if (aCommand == KCmdVerticalTwipsToPixels)
+ {
+ DoCmdVerticalTwipsToPixels(aSection);
+ }
+ else if (aCommand == KCmdDisown)
+ {
+ DisownObjectL();
+ }
+ else
+ {
+ retVal=EFalse;
+ }
+
+ return retVal;
+ }
+
+
+/** Creates new CFbsBitmap class instance */
+void CT_DataFbsBitmap::DoCmdNewL()
+ {
+ INFO_PRINTF1(_L("Creates new CFbsBitmap class instance"));
+
+ // cleanup if already created
+ DestroyData();
+ iFbsBitmap=new (ELeave) CFbsBitmap();
+ }
+
+/** Calls static CFbsBitmap destructor */
+void CT_DataFbsBitmap::DoCmdDestructor()
+ {
+ DestroyData();
+ }
+
+/** Calls CFbsBitmap::Compress() */
+void CT_DataFbsBitmap::DoCmdCompress(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::Compress()"));
+
+ TInt err=KErrNone;
+ TBitmapfileCompressionScheme compressionScheme;
+ if ( CT_GraphicsUtil::ReadBitmapfileCompressionScheme(*this, aSection, KBitmapfileCompressionScheme(), compressionScheme) )
+ {
+ err=GetFbsBitmap()->Compress(compressionScheme);
+ }
+ else
+ {
+ // call Compress()
+ err=GetFbsBitmap()->Compress();
+ }
+ // check error code
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("Compress error: %d"), err);
+ SetError(err);
+ iCompressFailed = ETrue;
+ }
+ else
+ {
+ iCompressFailed = EFalse;
+ };
+ }
+
+/** Calls CFbsBitmap::CompressInBackground() */
+void CT_DataFbsBitmap::DoCmdCompressInBackground(const TDesC& aSection, const TInt aAsyncErrorIndex)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::CompressInBackground()"));
+
+ // get a flag if to use requset status from parameters
+ TBool useRequestStatus = EFalse;
+ GetBoolFromConfig(aSection, KUseRequestStatus(), useRequestStatus);
+
+ TBitmapfileCompressionScheme compressionScheme;
+ TBool hasCompressionScheme=CT_GraphicsUtil::ReadBitmapfileCompressionScheme(*this, aSection, KBitmapfileCompressionScheme(), compressionScheme);
+
+ // call CompressInBackground()
+ if ( useRequestStatus )
+ {
+ if ( hasCompressionScheme )
+ {
+ GetFbsBitmap()->CompressInBackground(iActiveCompressInBackground->iStatus, compressionScheme);
+ }
+ else
+ {
+ GetFbsBitmap()->CompressInBackground(iActiveCompressInBackground->iStatus);
+ }
+ iActiveCompressInBackground->Activate(aAsyncErrorIndex);
+ IncOutstanding();
+ }
+ else
+ {
+ TInt err = KErrNone;
+
+ if ( hasCompressionScheme )
+ {
+ err=GetFbsBitmap()->CompressInBackground(compressionScheme);
+ }
+ else
+ {
+ err=GetFbsBitmap()->CompressInBackground();
+ }
+
+ // check error code
+ if ( err != KErrNone )
+ {
+ ERR_PRINTF2(_L("Compress in background error: %d"), err);
+ SetError(err);
+ iCompressFailed = ETrue;
+ }
+ else
+ {
+ iCompressFailed = EFalse;
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::Create() */
+void CT_DataFbsBitmap::DoCmdCreate(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::Create()"));
+
+ // get size height from parameters
+ TInt height;
+ if(!GetIntFromConfig(aSection, KHeight(), height))
+ {
+ ERR_PRINTF2(_L("No %S"), &KHeight());
+ SetBlockResult(EFail);
+ }
+
+ // get size width from parameters
+ TInt width;
+ if(!GetIntFromConfig(aSection, KWidth(), width))
+ {
+ ERR_PRINTF2(_L("No %S"), &KWidth());
+ SetBlockResult(EFail);
+ }
+
+ // get display mode from parameters
+
+ TDisplayMode displayMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), displayMode) )
+ {
+ ERR_PRINTF1(_L("No display mode"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call Create()
+ TInt err = GetFbsBitmap()->Create(TSize(width, height), displayMode);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Creation error: %d"), err);
+ SetError(err);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::CreateHardwareBitmap() */
+void CT_DataFbsBitmap::DoCmdCreateHardwareBitmap(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::CreateHardwareBitmap()"));
+
+ // get size height from parameters
+ TInt height;
+ if(!GetIntFromConfig(aSection, KHeight(), height))
+ {
+ ERR_PRINTF2(_L("No %S"), &KHeight());
+ SetBlockResult(EFail);
+ }
+
+ // get size width from parameters
+ TInt width;
+ if(!GetIntFromConfig(aSection, KWidth(), width))
+ {
+ ERR_PRINTF2(_L("No %S"), &KWidth());
+ SetBlockResult(EFail);
+ }
+
+ // get display mode from parameters
+ TDisplayMode displayMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), displayMode) )
+ {
+ ERR_PRINTF1(_L("No display mode"));
+ SetBlockResult(EFail);
+ }
+
+ // get application uid from parameters
+ TInt uidInt;
+ if(!GetIntFromConfig(aSection, KUid(), uidInt))
+ {
+ ERR_PRINTF2(_L("No %S"), &KUid());
+ SetBlockResult(EFail);
+ }
+
+ // call Create()
+ TInt err = GetFbsBitmap()->CreateHardwareBitmap(TSize(width, height), displayMode, TUid::Uid(uidInt));
+
+ // check error code
+ if ( err != KErrNone )
+ {
+ ERR_PRINTF2(_L("Hardware bitmap creation error: %d"), err);
+ SetError(err);
+ }
+ }
+
+/** Calls CFbsBitmap::DataAddress() locking and unlocking heap by defined in parameters means */
+void CT_DataFbsBitmap::DoCmdDataAddress(const TDesC& aSection)
+ {
+ // call DataAddress()
+ TUint32* address=GetFbsBitmap()->DataAddress();
+ INFO_PRINTF2(_L("DataAddress %d"), address);
+
+ // validate returned value if needed
+ TInt expectedValue;
+ if(GetIntFromConfig(aSection, KExpectedInt(), expectedValue))
+ {
+ if (expectedValue != (TInt)address)
+ {
+ ERR_PRINTF1(_L("The returned value is not as expected"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::DataStride() */
+void CT_DataFbsBitmap::DoCmdDataStride(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::DataStride()"));
+
+ // call DataStride()
+ TInt value = GetFbsBitmap()->DataStride();
+ INFO_PRINTF2(_L("Data stride: %d"), value);
+
+ // validate returned value if needed
+ TInt expectedValue;
+ if(GetIntFromConfig(aSection, KExpectedInt(), expectedValue))
+ {
+ if (expectedValue != value)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedValue, value);
+ SetBlockResult(EFail);
+ }
+ }
+
+ // check the value is not NULL
+ if (value <= 0)
+ {
+ ERR_PRINTF2(_L("The data stride is not expected zero or less, value: %d"), value);
+ SetBlockResult(EFail);
+ }
+ }
+
+/** Checks CFbsBitmap::DisplayMode() value */
+void CT_DataFbsBitmap::DoCmdDisplayMode(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Checks CFbsBitmap::DisplayMode() value"));
+
+ // call DisplayMode()
+ iDisplayMode=GetFbsBitmap()->DisplayMode();
+ INFO_PRINTF2(_L("Display Mode %d"), iDisplayMode);
+
+ // get display mode from parameters
+ TDisplayMode expectedValue;
+ if ( CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), expectedValue) )
+ {
+ // check value against NULL
+ if ( iDisplayMode!=expectedValue )
+ {
+ ERR_PRINTF3(_L("The value is not as expected! expected: %d, actual: %d"), expectedValue, iDisplayMode);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::Duplicate() */
+void CT_DataFbsBitmap::DoCmdDuplicateL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::Duplicate()"));
+ TInt handle=GetHandle();
+ TPtrC objectName;
+ if ( GetStringFromConfig(aSection, KFbsBitmapName(), objectName) )
+ {
+ CDataWrapperBase* wrapper=static_cast<CDataWrapperBase*>(GetDataWrapperL(objectName));
+ handle=wrapper->GetHandle();
+ }
+ else
+ {
+ GetIntFromConfig(aSection, KHandle(), handle);
+ }
+
+ // call Duplicate()
+ TInt err = GetFbsBitmap()->Duplicate(handle);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Duplicate error: %d"), err);
+ SetError(err);
+ }
+ }
+
+/** Calls CFbsBitmap::ExternalizeL() */
+void CT_DataFbsBitmap::DoCmdExternalizeL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::ExternalizeL()"));
+ ExternalizeImplL(aSection, TRect(), EFalse);
+ }
+
+/** Calls CFbsBitmap::ExternalizeRectangleL() */
+void CT_DataFbsBitmap::DoCmdExternalizeRectangleL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::ExternalizeRectangleL()"));
+
+ // get rectangle top left x-coordinate from parameters
+ TInt tlx;
+ if(!GetIntFromConfig(aSection, KRectTlX(), tlx))
+ {
+ ERR_PRINTF2(_L("No %S"), &KRectTlX());
+ SetBlockResult(EFail);
+ }
+
+ // get rectangle top left x-coordinate from parameters
+ TInt tly;
+ if(!GetIntFromConfig(aSection, KRectTlY(), tly))
+ {
+ ERR_PRINTF2(_L("No %S"), &KRectTlY());
+ SetBlockResult(EFail);
+ }
+
+ // get rectangle top left x-coordinate from parameters
+ TInt brx;
+ if(!GetIntFromConfig(aSection, KRectBrX(), brx))
+ {
+ ERR_PRINTF2(_L("No %S"), &KRectBrX());
+ SetBlockResult(EFail);
+ }
+
+ // get rectangle top left x-coordinate from parameters
+ TInt bry;
+ if(!GetIntFromConfig(aSection, KRectBrY(), bry))
+ {
+ ERR_PRINTF2(_L("No %S"), &KRectBrY());
+ SetBlockResult(EFail);
+ }
+
+ ExternalizeImplL(aSection, TRect(tlx, tly, brx, bry), ETrue);
+ }
+
+/** Calls CFbsBitmap::GetPalette() */
+void CT_DataFbsBitmap::DoCmdGetPaletteL(const TDesC& aSection)
+ {
+ // call GetPalette()
+ CPalette* palette = NULL;
+ TInt err = GetFbsBitmap()->GetPalette(palette);
+ INFO_PRINTF2(_L("Calls CFbsBitmap::GetPalette() %d"), palette);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("GetPalette error: %d"), err);
+ SetError(err);
+ }
+ else
+ {
+ // Verify palette
+ CPalette* expectedPalette = NULL;
+
+ if ( CT_GraphicsUtil::GetPaletteL(*this, aSection, KPalette(), expectedPalette) )
+ {
+ if ( palette != expectedPalette )
+ {
+ ERR_PRINTF3(_L("GetPalette palette %d not the expected palette %d"), palette, expectedPalette);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::GetPixel() */
+void CT_DataFbsBitmap::DoCmdGetPixel(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::GetPixel()"));
+
+ // get point x-coordinate from parameters
+ TInt pointX;
+ if(!GetIntFromConfig(aSection, KPointX(), pointX))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPointX());
+ SetBlockResult(EFail);
+ }
+
+ // get point y-coordinate from parameters
+ TInt pointY;
+ if(!GetIntFromConfig(aSection, KPointY(), pointY))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPointY());
+ SetBlockResult(EFail);
+ }
+
+ // call GetPixel()
+ TRgb color;
+ GetFbsBitmap()->GetPixel(color, TPoint(pointX, pointY));
+
+ INFO_PRINTF2(_L("Red %d"), color.Red());
+ INFO_PRINTF2(_L("Green %d"), color.Green());
+ INFO_PRINTF2(_L("Blue %d"), color.Blue());
+
+ TInt actual;
+ TInt expected;
+
+ if(GetIntFromConfig(aSection, KRed(), expected))
+ {
+ actual=color.Red();
+ if ( expected != actual )
+ {
+ ERR_PRINTF3(_L("Expected Red %d does not match actual %d"), expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+
+ if(GetIntFromConfig(aSection, KGreen(), expected))
+ {
+ actual=color.Green();
+ if ( expected != actual )
+ {
+ ERR_PRINTF3(_L("Expected Green %d does not match actual %d"), expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+
+ if(GetIntFromConfig(aSection, KBlue(), expected))
+ {
+ actual=color.Blue();
+ if ( expected != actual )
+ {
+ ERR_PRINTF3(_L("Expected Blue %d does not match actual %d"), expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::GetScanLine() */
+void CT_DataFbsBitmap::DoCmdGetScanLineL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::GetScanLine()"));
+ TBool dataOk=ETrue;
+
+ // get point x coordinate from parameters
+ TInt pointX = 0;
+ if(!GetIntFromConfig(aSection, KPointX(), pointX))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPointX());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get point y coordinate from parameters
+ TInt pointY = 0;
+ if(!GetIntFromConfig(aSection, KPointY(), pointY))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPointY());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get length from parameters
+ TInt length = 0;
+ if(!GetIntFromConfig(aSection, KLength(), length))
+ {
+ ERR_PRINTF2(_L("No %S"), &KLength());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get buffer length from parameters
+ TInt buffLength = 0;
+ if(!GetIntFromConfig(aSection, KBuffLength(), buffLength))
+ {
+ ERR_PRINTF2(_L("No %S"), &KBuffLength());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get display mode from parameters
+ TDisplayMode displayMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), displayMode) )
+ {
+ ERR_PRINTF1(_L("No display mode"));
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ if ( dataOk )
+ {
+ // call GetScanLine()
+ TUint8* buffer = new (ELeave) TUint8[buffLength];
+ TPtr8 scanline(buffer, buffLength, buffLength);
+
+ GetFbsBitmap()->GetScanLine(scanline, TPoint(pointX, pointY), length, displayMode);
+
+ delete [] buffer;
+ }
+ }
+
+/** Calls CFbsBitmap::GetVerticalScanLine() */
+void CT_DataFbsBitmap::DoCmdGetVerticalScanLineL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::GetVerticalScanLine()"));
+ TBool dataOk=ETrue;
+
+ // get point x coordinate from parameters
+ TInt pointX = 0;
+ if(!GetIntFromConfig(aSection, KPointX(), pointX))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPointX());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get if to use dither offset flag from parameters
+ TBool useDitherOffset = EFalse;
+ if(!GetBoolFromConfig(aSection, KUseDitherOffset(), useDitherOffset))
+ {
+ ERR_PRINTF2(_L("No %S"), &KUseDitherOffset());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get dither offset x coordinate from parameters
+ TInt ditherOffsetX = 0;
+ if(useDitherOffset && !GetIntFromConfig(aSection, KDitherOffsetX(), ditherOffsetX))
+ {
+ ERR_PRINTF2(_L("No %S"), &KDitherOffsetX());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get dither offset y coordinate from parameters
+ TInt ditherOffsetY = 0;
+ if(useDitherOffset && !GetIntFromConfig(aSection, KDitherOffsetY(), ditherOffsetY))
+ {
+ ERR_PRINTF2(_L("No %S"), &KDitherOffsetY());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get buffer length from parameters
+ TInt buffLength = 0;
+ if(!GetIntFromConfig(aSection, KBuffLength(), buffLength))
+ {
+ ERR_PRINTF2(_L("No %S"), &KBuffLength());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get display mode from parameters
+ TDisplayMode displayMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), displayMode) )
+ {
+ ERR_PRINTF1(_L("No display mode"));
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ if ( dataOk )
+ {
+ // call GetVerticalScanLine()
+ TUint8* buffer = new (ELeave) TUint8[buffLength];
+ TPtr8 scanline(buffer, buffLength, buffLength);
+
+ if (useDitherOffset)
+ {
+ GetFbsBitmap()->GetVerticalScanLine(scanline, pointX, displayMode);
+ }
+ else
+ {
+ GetFbsBitmap()->GetVerticalScanLine(scanline, pointX, TPoint(ditherOffsetX, ditherOffsetY), displayMode);
+ }
+
+ delete [] buffer;
+ }
+ }
+
+/** Calls CFbsBitmap::Handle() */
+void CT_DataFbsBitmap::DoCmdHandle(const TDesC& aSection)
+ {
+
+ // call Handle()
+ TInt handle=GetFbsBitmap()->Handle();
+ INFO_PRINTF2(_L("Calls CFbsBitmap::Handle() %d"), handle);
+ SetHandle(handle);
+
+ // validate returned value if needed
+ TInt expectedValue;
+ if(GetIntFromConfig(aSection, KExpectedInt(), expectedValue))
+ {
+ if (expectedValue != handle)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedValue, handle);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Checks CFbsBitmap::HardwareBitmapHandle() */
+void CT_DataFbsBitmap::DoCmdHardwareBitmapHandle(const TDesC& aSection)
+ {
+ // call HardwareBitmapHandle()
+ TInt handle=GetFbsBitmap()->HardwareBitmapHandle();
+ INFO_PRINTF2(_L("CFbsBitmap::HardwareBitmapHandle() %d"), handle);
+ SetHandle(handle);
+
+ // get if null expected flag from parameters
+ TBool nullExpected = EFalse;
+ if ( GetBoolFromConfig(aSection, KNullExpected(), nullExpected) )
+ {
+ // check value againts NULL
+ if ( (handle == NULL) != nullExpected )
+ {
+ ERR_PRINTF2(_L("The value is not as expected! value: %d"), handle);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::Header() */
+void CT_DataFbsBitmap::DoCmdHeader()
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::Header()"));
+
+ // call Header()
+ SEpocBitmapHeader header=GetFbsBitmap()->Header();
+ INFO_PRINTF2(_L("Header iBitmapSize &d"), header.iBitmapSize);
+ INFO_PRINTF2(_L("Header iBitsPerPixel &d"), header.iBitsPerPixel);
+ INFO_PRINTF2(_L("Header iColor &d"), header.iColor);
+ INFO_PRINTF2(_L("Header iCompression &d"), header.iCompression);
+ INFO_PRINTF2(_L("Header iPaletteEntries &d"), header.iPaletteEntries);
+ INFO_PRINTF3(_L("Header iSizeInPixels &d %d"), header.iSizeInPixels.iWidth, header.iSizeInPixels.iHeight);
+ INFO_PRINTF3(_L("Header iSizeInTwips &d %d"), header.iSizeInTwips.iWidth, header.iSizeInTwips.iHeight);
+ INFO_PRINTF2(_L("Header iStructSize &d"), header.iStructSize);
+ }
+
+/** Calls CFbsBitmap::HorizontalPixelsToTwips() */
+void CT_DataFbsBitmap::DoCmdHorizontalPixelsToTwips(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::HorizontalPixelsToTwips()"));
+
+ // get pixels from parameters
+ TInt pixels;
+ if(!GetIntFromConfig(aSection, KPixels(), pixels))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPixels());
+ SetBlockResult(EFail);
+ }
+
+ // call HorizontalPixelsToTwips()
+ TInt value = GetFbsBitmap()->HorizontalPixelsToTwips(pixels);
+ INFO_PRINTF2(_L("Twips: %d"), value);
+
+ // validate returned value if needed
+ TInt expectedValue;
+ if(GetIntFromConfig(aSection, KExpectedInt(), expectedValue))
+ {
+ if (expectedValue != value)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedValue, value);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::HorizontalTwipsToPixels() */
+void CT_DataFbsBitmap::DoCmdHorizontalTwipsToPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::HorizontalTwipsToPixels()"));
+
+ // get twips from parameters
+ TInt twips;
+ if(!GetIntFromConfig(aSection, KTwips(), twips))
+ {
+ ERR_PRINTF2(_L("No %S"), &KTwips());
+ SetBlockResult(EFail);
+ }
+
+ // call HorizontalTwipsToPixels()
+ TInt value = GetFbsBitmap()->HorizontalTwipsToPixels(twips);
+ INFO_PRINTF2(_L("Pixels: %d"), value);
+
+ // validate returned value if needed
+ TInt expectedValue;
+ if(GetIntFromConfig(aSection, KExpectedInt(), expectedValue))
+ {
+ if (expectedValue != value)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedValue, value);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Checks CFbsBitmap::InitialDisplayMode() value */
+void CT_DataFbsBitmap::DoCmdInitialDisplayMode(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Checks CFbsBitmap::InitialDisplayMode() value"));
+
+ // call InitialDisplayMode()
+ TInt actualValue = GetFbsBitmap()->InitialDisplayMode();
+ INFO_PRINTF2(_L("Initial Display Mode %d"), actualValue);
+
+ // get display mode from parameters
+ TDisplayMode expectedValue;
+ if ( CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), expectedValue) )
+ {
+ // check value againts NULL
+ if (actualValue != expectedValue)
+ {
+ ERR_PRINTF3(_L("The value is not as expected! expecyed: %d, actual: %d"), expectedValue, actualValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::InternalizeL() */
+void CT_DataFbsBitmap::DoCmdInternalizeL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::InternalizeL()"));
+
+ // get file name from parameters
+ TPtrC fileName;
+ if (!GetStringFromConfig(aSection, KFileName(), fileName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFileName());
+ SetBlockResult(EFail);
+ }
+
+ // get a flag if to use closed stream from parameters
+ TBool useClosedStream = EFalse;
+ if(!GetBoolFromConfig(aSection, KUseClosedStream(), useClosedStream))
+ {
+ ERR_PRINTF2(_L("No %S"), &KUseClosedStream());
+ SetBlockResult(EFail);
+ }
+
+ // ReadStore creation
+ CDirectFileStore* readstore = CDirectFileStore::OpenL(FileServer(), fileName, EFileStream | EFileRead);
+ CleanupStack::PushL(readstore);
+ TInt popCount=1;
+ TStreamId headerid = readstore->Root();
+ RStoreReadStream readstrm;
+
+ // close stream if defined by parameters
+ if (!useClosedStream)
+ {
+ readstrm.OpenL(*readstore, headerid);
+ CleanupClosePushL(readstrm);
+ popCount=2;
+ }
+
+ // call InternalizeL()
+ TRAPD(err, GetFbsBitmap()->InternalizeL(readstrm));
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Internalize error: %d"), err);
+ SetError(err);
+ }
+
+ // cleanup
+ CleanupStack::PopAndDestroy(popCount, readstore);
+ }
+
+/** Calls CFbsBitmap::IsCompressedInRAM() to check againt expected value */
+void CT_DataFbsBitmap::DoCmdIsCompressedInRAM(const TDesC& aSection)
+ {
+ // call IsCompressedInRAM() to get actual value
+ TBool actualValue = GetFbsBitmap()->IsCompressedInRAM();
+ INFO_PRINTF2(_L("CFbsBitmap::IsCompressedInRAM() %d"), actualValue);
+
+ // get expected value from parameters
+ TBool expectedValue = EFalse;
+ if ( GetBoolFromConfig(aSection, KExpectedBool(), expectedValue) )
+ {
+ if (actualValue != expectedValue)
+ {
+ ERR_PRINTF3(_L("Expected value doesn't match to actual! expected: %d, actual: %d"), expectedValue, actualValue);
+ if (!iCompressFailed)
+ {
+ SetBlockResult(EFail);
+ };
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::IsFileInRom() and check against expectation */
+void CT_DataFbsBitmap::DoCmdIsFileInRom(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::IsFileInRom() and check against expectation"));
+
+ // get file name from parameters
+
+ TPtrC fileName;
+ if ( !GetStringFromConfig(aSection, KFileName(), fileName) )
+ {
+ ERR_PRINTF2(_L("No %S"), &KFileName());
+ SetBlockResult(EFail);
+ }
+
+ // get flag if use RFile instance in Save() call from parameters
+ TBool useRFile = EFalse;
+ GetBoolFromConfig(aSection, KUseRFile(), useRFile);
+
+ TInt err = KErrNone;
+ TBool isFileInRom = EFalse;
+ TUint32* addressInRom = NULL;
+ if (useRFile)
+ {
+ // open rfile
+ RFile file;
+ err = file.Open(FileServer(), fileName, EFileShareReadersOnly);
+
+ // check if failed to open file
+ if ( err != KErrNone )
+ {
+ ERR_PRINTF2(_L("File open error: %d"), err);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call IsFileInRom()
+ isFileInRom = CFbsBitmap::IsFileInRom(file, addressInRom);
+
+ // close rfile
+ file.Close();
+ }
+ }
+ else
+ {
+ isFileInRom = CFbsBitmap::IsFileInRom(fileName, addressInRom);
+ }
+
+ // get expected value if is in ROM from parameters
+ TBool expectedIsFileInRom = EFalse;
+ if ( GetBoolFromConfig(aSection, KExpectedBool(), expectedIsFileInRom) )
+ {
+ // check the expectation
+ if (expectedIsFileInRom != isFileInRom)
+ {
+ ERR_PRINTF3(_L("The value is not as expected! expected: %d, actual: %d"), expectedIsFileInRom, isFileInRom);
+ SetBlockResult(EFail);
+ }
+ }
+
+ // check that address is not null if in rom
+ if ( isFileInRom && addressInRom == NULL )
+ {
+ ERR_PRINTF1(_L("The file is in ROM but returned address is NULL"));
+ SetBlockResult(EFail);
+ }
+ }
+
+/** Calls CFbsBitmap::IsLargeBitmap() */
+void CT_DataFbsBitmap::DoCmdIsLargeBitmap(const TDesC& aSection)
+ {
+ // call IsLargeBitmap()
+ TBool value = GetFbsBitmap()->IsLargeBitmap();
+ INFO_PRINTF2(_L("Is large bitmap: %d"), value);
+
+ // validate returned value if needed
+ TBool expectedBool;
+ if(GetIntFromConfig(aSection, KExpectedBool(), expectedBool))
+ {
+ if (expectedBool != value)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedBool, value);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::IsMonochrome() */
+void CT_DataFbsBitmap::DoCmdIsMonochrome(const TDesC& aSection)
+ {
+
+ // call IsMonochrome()
+ TBool value = GetFbsBitmap()->IsMonochrome();
+ INFO_PRINTF2(_L("Is monochrome: %d"), value);
+
+ // validate returned value if needed
+ TBool expectedBool;
+ if(GetIntFromConfig(aSection, KExpectedBool(), expectedBool))
+ {
+ if (expectedBool != value)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedBool, value);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::IsRomBitmap() and check against expectation */
+void CT_DataFbsBitmap::DoCmdIsRomBitmap(const TDesC& aSection)
+ {
+ // call IsRomBitmap()
+ TBool actualValue = GetFbsBitmap()->IsRomBitmap();
+ INFO_PRINTF2(_L("CFbsBitmap::IsRomBitmap() %d"), actualValue);
+
+ // get expected value if is in ROM from parameters
+ TBool expectedIsRomBitmap = EFalse;
+ if ( GetBoolFromConfig(aSection, KExpectedBool(), expectedIsRomBitmap) )
+ {
+ // check the expectation
+ if (expectedIsRomBitmap != actualValue)
+ {
+ ERR_PRINTF3(_L("The value is not as expected! expected: %d, actual: %d"), expectedIsRomBitmap, actualValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** CFbsBitmap::Load() Call */
+void CT_DataFbsBitmap::DoCmdLoadL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("CFbsBitmap::Load() Call"));
+ LoadOrLoadAndCompressL(aSection, EFalse);
+ }
+
+/** CFbsBitmap::LoadAndCompress() Call */
+void CT_DataFbsBitmap::DoCmdLoadAndCompressL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("CFbsBitmap::LoadAndCompress() Call"));
+ LoadOrLoadAndCompressL(aSection, ETrue);
+ }
+
+/** Calls static CFbsBitmap destructor */
+void CT_DataFbsBitmap::DoCmdLockHeap(const TDesC& aSection)
+ {
+ TBool always=EFalse;
+ GetBoolFromConfig(aSection, KAlways(), always);
+ GetFbsBitmap()->LockHeap(always);
+ }
+
+/** Calls static CFbsBitmap destructor */
+void CT_DataFbsBitmap::DoCmdLockHeapLC(const TDesC& aSection)
+ {
+ TBool always=EFalse;
+ GetBoolFromConfig(aSection, KAlways(), always);
+
+ GetFbsBitmap()->LockHeapLC(always);
+ iPopWhenUnlocking=ETrue;
+ }
+
+/** Calls CFbsBitmap::PaletteAttributes() */
+void CT_DataFbsBitmap::DoCmdPaletteAttributes(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::PaletteAttributes()"));
+
+ // call PaletteAttributes()
+ TBool modifiable;
+ TInt entries;
+ GetFbsBitmap()->PaletteAttributes(modifiable, entries);
+
+ INFO_PRINTF3(_L("Modifiable: %d, Number of entries: %d"), modifiable, entries);
+
+ // validate returned value if needed
+ TBool expectedModifiable;
+ if(GetBoolFromConfig(aSection, KModifiable(), expectedModifiable))
+ {
+ if (expectedModifiable != modifiable)
+ {
+ ERR_PRINTF3(_L("The returned modifaiable value is not as expected, expected: %d, actual: %d"), expectedModifiable, modifiable);
+ SetBlockResult(EFail);
+ }
+ }
+
+ // validate returned value if needed
+ TBool expectedEntries;
+ if(GetIntFromConfig(aSection, KEntries(), expectedEntries))
+ {
+ if (expectedEntries != entries)
+ {
+ ERR_PRINTF3(_L("The returned modifaiable value is not as expected, expected: %d, actual: %d"), expectedEntries, entries);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::Reset() */
+void CT_DataFbsBitmap::DoCmdReset()
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::Reset()"));
+
+ // call Reset()
+ GetFbsBitmap()->Reset();
+ }
+
+/** Calls CFbsBitmap::Resize() */
+void CT_DataFbsBitmap::DoCmdResize(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::Resize()"));
+
+ // get size height from parameters
+ TInt height;
+ if(!GetIntFromConfig(aSection, KHeight(), height))
+ {
+ ERR_PRINTF2(_L("No %S"), &KHeight());
+ SetBlockResult(EFail);
+ }
+
+ // get size width from parameters
+ TInt width;
+ if(!GetIntFromConfig(aSection, KWidth(), width))
+ {
+ ERR_PRINTF2(_L("No %S"), &KWidth());
+ SetBlockResult(EFail);
+ }
+
+ // call Resize()
+ TInt err = GetFbsBitmap()->Resize(TSize(width, height));
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Resize error: %d"), err);
+ SetError(err);
+ }
+ }
+
+/** Calls CFbsBitmap::Save() */
+void CT_DataFbsBitmap::DoCmdSave(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::Save()"));
+
+ // get file name from parameters
+ TPtrC fileName;
+ if (!GetStringFromConfig(aSection, KFileName(), fileName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFileName());
+ SetBlockResult(EFail);
+ }
+
+ // get flag if use RFile instance in Save() call from parameters
+ TBool useRFile = EFalse;
+ if(!GetBoolFromConfig(aSection, KUseRFile(), useRFile))
+ {
+ ERR_PRINTF2(_L("No %S"), &KUseRFile());
+ SetBlockResult(EFail);
+ }
+
+ // get flag if use RFile instance in Load() call from parameters
+ TBool useClosedRFile = EFalse;
+ if(GetBoolFromConfig(aSection, KUseClosedRFile(), useClosedRFile))
+ {
+ if (useClosedRFile && !useRFile)
+ {
+ ERR_PRINTF3(_L("Cannot use %S parameter if %S is not set to TRUE"), &KUseClosedRFile(), &KUseRFile());
+ SetBlockResult(EFail);
+ }
+ }
+
+ TInt err = KErrNone;
+ if (useRFile)
+ {
+ // required to allow file handle to be adopted by another process
+ FileServer().ShareProtected();
+
+ // open or create rfile
+ RFile file;
+
+ if (!useClosedRFile)
+ {
+ err = file.Open(FileServer(), fileName, EFileWrite);
+
+ if (err == KErrNotFound)
+ {
+ err = file.Create(FileServer(), fileName, EFileWrite);
+
+ // check if failed to create file
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("File create error: %d"), err);
+ SetBlockResult(EFail);
+ }
+ }
+ else if (err != KErrNone)
+ {
+ // if failed to open file
+ ERR_PRINTF2(_L("File open error: %d"), err);
+ SetBlockResult(EFail);
+ }
+ }
+
+ // call Save()
+ err = GetFbsBitmap()->Save(file);
+
+ // close rfile
+ file.Close();
+ }
+ else
+ {
+ err = GetFbsBitmap()->Save(fileName);
+ }
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Save error: %d"), err);
+ SetError(err);
+ }
+ }
+
+/** Calls CFbsBitmap::ScanLineLength() */
+void CT_DataFbsBitmap::DoCmdScanLineLength(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::ScanLineLength()"));
+
+ // get length from parameters
+ TInt length = 0;
+ if(!GetIntFromConfig(aSection, KLength(), length))
+ {
+ ERR_PRINTF2(_L("No %S"), &KLength());
+ SetBlockResult(EFail);
+ }
+
+ // get display mode from parameters
+ TDisplayMode displayMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), displayMode) )
+ {
+ ERR_PRINTF1(_L("No display mode"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TInt actualValue = CFbsBitmap::ScanLineLength(length, displayMode);
+ INFO_PRINTF2(_L("CFbsBitmap::ScanLineLength() %d"), actualValue);
+
+ TInt expectedValue = 0;
+ if ( GetIntFromConfig(aSection, KExpectedInt(), expectedValue) )
+ {
+ if (actualValue != expectedValue)
+ {
+ ERR_PRINTF3(_L("Expected value doesn't match to actual! expected: %d, actual: %d"), expectedValue, actualValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::SetDisplayMode() */
+void CT_DataFbsBitmap::DoCmdSetDisplayMode(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::SetDisplayMode()"));
+
+ // get display mode from parameters
+ TDisplayMode displayMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), displayMode) )
+ {
+ ERR_PRINTF1(_L("No display mode"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call SetDisplayMode()
+ TInt err = GetFbsBitmap()->SetDisplayMode(displayMode);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Set display mode error: %d"), err);
+ SetError(err);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::SetPalette() by previously created palette */
+void CT_DataFbsBitmap::DoCmdSetPaletteL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::SetPalette() by previously created palette"));
+
+ // get CPalette object passed as a parameter
+ CPalette* palette = NULL;
+
+ CT_GraphicsUtil::GetPaletteL(*this, aSection, KPalette(), palette);
+
+ // call SetPalette()
+ GetFbsBitmap()->SetPalette(palette);
+ }
+
+/** Calls CFbsBitmap::SetRomBitmapL() by another bitmap */
+void CT_DataFbsBitmap::DoCmdSetRomBitmapL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::SetRomBitmapL() by another bitmap"));
+
+ // get fbsBitmap passed as a parameter
+ CFbsBitmap* otherFbsBitmap=NULL;
+
+ CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFbsBitmapName(), otherFbsBitmap);
+
+ // get romPointer. If the bitmap is ROM bitmap then Handle() returns ROM pointer
+ CBitwiseBitmap* bitmapRomAddress=NULL;
+ if ( otherFbsBitmap!=NULL )
+ {
+ bitmapRomAddress=REINTERPRET_CAST(CBitwiseBitmap*, otherFbsBitmap->Handle());
+ }
+
+ // call SetRomBitmapL()
+ TInt bitmapSizeInBytes=0;
+ TRAPD(err, GetFbsBitmap()->SetRomBitmapL(bitmapRomAddress, bitmapSizeInBytes));
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Set ROM bitmap error: %d"), err);
+ SetError(err);
+ }
+ }
+
+/** Calls CFbsBitmap::SetScanLine() */
+void CT_DataFbsBitmap::DoCmdSetScanLineL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::SetScanLine()"));
+
+ // get scanline coordinate from parameters
+ TInt coordinate = 0;
+ if(!GetIntFromConfig(aSection, KScanLineCoord(), coordinate))
+ {
+ ERR_PRINTF2(_L("No %S"), &KScanLineCoord());
+ SetBlockResult(EFail);
+ }
+
+ // get file name from parameters
+ TPtrC fileName;
+ if (!GetStringFromConfig(aSection, KFileName(), fileName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFileName());
+ SetBlockResult(EFail);
+ }
+
+ // open file
+ RFile file;
+ User::LeaveIfError(file.Open(FileServer(), fileName, EFileRead | EFileShareAny));
+ CleanupClosePushL(file);
+
+ // get size
+ TInt size = 0;
+ User::LeaveIfError(file.Size(size));
+
+ // read file
+ HBufC8* fileDataBuff = HBufC8::NewLC(size);
+ TPtr8 fileData = fileDataBuff->Des();
+
+ User::LeaveIfError(file.Read(fileData));
+
+ GetFbsBitmap()->SetScanLine(fileData, coordinate);
+
+ CleanupStack::PopAndDestroy(2, &file); // fileDataBuff, file
+ }
+
+/** Calls CFbsBitmap::SetSizeInTwips() by size parameter */
+void CT_DataFbsBitmap::DoCmdSetSizeInTwipsL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::SetSizeInTwips()"));
+
+ // get if to NULL device pointer flag from parameters
+ TPtrC device;
+ if ( GetStringFromConfig(aSection, KDevice(), device) )
+ {
+ CFbsBitmapDevice* bitmapDevice=static_cast<CFbsBitmapDevice*>(GetDataObjectL(device));
+ GetFbsBitmap()->SetSizeInTwips(bitmapDevice);
+ }
+ else
+ {
+ // get size height from parameters
+ TInt height;
+ if(!GetIntFromConfig(aSection, KHeight(), height))
+ {
+ ERR_PRINTF2(_L("No %S"), &KHeight());
+ SetBlockResult(EFail);
+ }
+
+ // get size width from parameters
+ TInt width;
+ if(!GetIntFromConfig(aSection, KWidth(), width))
+ {
+ ERR_PRINTF2(_L("No %S"), &KWidth());
+ SetBlockResult(EFail);
+ }
+
+ // call SetSizeInTwips()
+ GetFbsBitmap()->SetSizeInTwips(TSize(width, height));
+ }
+ }
+
+/** Calls CFbsBitmap::SizeInPixels() and checks the size */
+void CT_DataFbsBitmap::DoCmdSizeInPixels(const TDesC& aSection)
+ {
+ // call SizeInTwips()
+ TSize actualSize = GetFbsBitmap()->SizeInPixels();
+ INFO_PRINTF3(_L("CFbsBitmap::SizeInPixels() height %d, width %d"), actualSize.iHeight, actualSize.iWidth);
+
+ // get size height from parameters
+ TInt height;
+ if ( GetIntFromConfig(aSection, KHeight(), height) )
+ {
+ if ( actualSize.iHeight != height )
+ {
+ ERR_PRINTF3(_L("Height mismatch expected: %d, actual: %d"), height, actualSize.iHeight);
+ SetBlockResult(EFail);
+ }
+ }
+
+ // get size width from parameters
+ TInt width;
+ if ( GetIntFromConfig(aSection, KWidth(), width) )
+ {
+ // check that value is as expected
+ if ( actualSize.iWidth != width )
+ {
+ ERR_PRINTF3(_L("Width mismatch expected: %d, actual: %d"), width, actualSize.iWidth);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::SizeInTwips() and compares the result with expected */
+void CT_DataFbsBitmap::DoCmdSizeInTwips(const TDesC& aSection)
+ {
+ // call SizeInTwips()
+ TSize actualSize = GetFbsBitmap()->SizeInTwips();
+ INFO_PRINTF3(_L("CFbsBitmap::SizeInTwips() height %d, width %d"), actualSize.iHeight, actualSize.iWidth);
+
+ // get size height from parameters
+ TInt height;
+ if ( GetIntFromConfig(aSection, KHeight(), height) )
+ {
+ if ( actualSize.iHeight != height )
+ {
+ ERR_PRINTF3(_L("Height mismatch expected: %d, actual: %d"), height, actualSize.iHeight);
+ SetBlockResult(EFail);
+ }
+ }
+
+ // get size width from parameters
+ TInt width;
+ if ( GetIntFromConfig(aSection, KWidth(), width) )
+ {
+ // check that value is as expected
+ if ( actualSize.iWidth != width )
+ {
+ ERR_PRINTF3(_L("Width mismatch expected: %d, actual: %d"), width, actualSize.iWidth);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::StoreL() */
+void CT_DataFbsBitmap::DoCmdStoreL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::StoreL()"));
+
+ TInt numberOfFiles = 0;
+ TInt numberOfBitmapIds = 0;
+ TPtrC sourceFileName1;
+ TPtrC sourceFileName2;
+ TInt sourceBitmapId0 = -1;
+ TInt sourceBitmapId1 = -1;
+ TInt sourceBitmapId2 = -1;
+
+ // get file name from parameters
+ TPtrC fileName;
+ if (!GetStringFromConfig(aSection, KFileName(), fileName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFileName());
+ SetBlockResult(EFail);
+ }
+
+ // get flag if use RFile instance in Save() call from parameters
+ TBool useRFile = EFalse;
+ if(!GetBoolFromConfig(aSection, KUseRFile(), useRFile))
+ {
+ ERR_PRINTF2(_L("No %S"), &KUseRFile());
+ SetBlockResult(EFail);
+ }
+
+ // get flag if use RFile instance in Load() call from parameters
+ TBool useClosedRFile = EFalse;
+ if(GetBoolFromConfig(aSection, KUseClosedRFile(), useClosedRFile))
+ {
+ if (useClosedRFile && !useRFile)
+ {
+ ERR_PRINTF3(_L("Cannot use %S parameter if %S is not set to TRUE"), &KUseClosedRFile(), &KUseRFile());
+ SetBlockResult(EFail);
+ }
+ }
+
+ // get up to 3 source file names from parameters
+ TPtrC sourceFileName0;
+ if (GetStringFromConfig(aSection, KSourceFileName0(), sourceFileName0))
+ {
+ numberOfFiles++;
+ if (GetStringFromConfig(aSection, KSourceFileName1(), sourceFileName1))
+ {
+ numberOfFiles++;
+ if (GetStringFromConfig(aSection, KSourceFileName2(), sourceFileName2))
+ {
+ numberOfFiles++;
+ }
+ }
+ }
+
+ // get up to 3 source bitmap ids from parameters
+ if (GetIntFromConfig(aSection, KSourceBitmapId0(), sourceBitmapId0))
+ {
+ numberOfBitmapIds++;
+ if (GetIntFromConfig(aSection, KSourceBitmapId1(), sourceBitmapId1))
+ {
+ numberOfBitmapIds++;
+ if (GetIntFromConfig(aSection, KSourceBitmapId2(), sourceBitmapId2))
+ {
+ numberOfBitmapIds++;
+ }
+ }
+ }
+
+ // get number of sources argument from parameters
+ TInt numberOfSources;
+ if(!GetIntFromConfig(aSection, KNumberOfSources(), numberOfSources))
+ {
+ ERR_PRINTF2(_L("No %S"), &KNumberOfSources());
+ SetBlockResult(EFail);
+ }
+
+ // create array of file names
+ TFileName** sourceFiles = new (ELeave) TFileName*[numberOfFiles];
+ CleanupStack::PushL(sourceFiles);
+ if (numberOfFiles > 0) sourceFiles[0] = new (ELeave) TFileName(sourceFileName0);
+ if (numberOfFiles > 1) sourceFiles[1] = new (ELeave) TFileName(sourceFileName1);
+ if (numberOfFiles > 2) sourceFiles[2] = new (ELeave) TFileName(sourceFileName2);
+
+ // create array of bitmap ids
+ TInt32* bitmapIds = new (ELeave) TInt32[numberOfBitmapIds];
+ CleanupStack::PushL(bitmapIds);
+
+ if (numberOfBitmapIds > 0) bitmapIds[0] = sourceBitmapId0;
+ if (numberOfBitmapIds > 1) bitmapIds[1] = sourceBitmapId1;
+ if (numberOfBitmapIds > 2) bitmapIds[2] = sourceBitmapId2;
+
+ TInt err = KErrNone;
+ if (useRFile)
+ {
+ // required to allow file handle to be adopted by another process
+ FileServer().ShareProtected();
+
+ // open rfile
+ TBool openSuccess = EFalse;
+
+ RFile file;
+ err = file.Open(FileServer(), fileName, EFileWrite);
+
+ // check if ok, if not fount => try to create new file
+ if (err == KErrNone)
+ {
+ openSuccess = ETrue;
+ }
+ else if (err == KErrNotFound)
+ {
+ INFO_PRINTF1(_L("File doesn't exist, trying to create it."));
+
+ err = file.Create(FileServer(), fileName, EFileWrite);
+
+ // check if failed to create file
+ if (err == KErrNone)
+ {
+ openSuccess = ETrue;
+ }
+ else
+ {
+ ERR_PRINTF2(_L("File create error: %d"), err);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("File open error: %d"), err);
+ SetBlockResult(EFail);
+ }
+
+ // if ok => do store
+ if (openSuccess)
+ {
+ // if we use invalid RFile handle in our test
+ if (useClosedRFile)
+ {
+ file.Close();
+ }
+
+ // call StoreL()
+ TRAP(err, CFbsBitmap::StoreL(file, numberOfSources, (const TDesC**) sourceFiles, bitmapIds));
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Store error: %d"), err);
+ SetError(err);
+ }
+
+ // close rfile
+ file.Close();
+ }
+ }
+ else
+ {
+ // call StoreL()
+ TRAP(err, CFbsBitmap::StoreL(fileName, numberOfSources, (const TDesC**) sourceFiles, bitmapIds));
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Store error: %d"), err);
+ SetError(err);
+ }
+ }
+
+ // Iterate over the file name pointer array and cleanup
+ for (TInt i = 0; i < numberOfFiles; ++i)
+ {
+ delete sourceFiles[i];
+ }
+
+ // Cleanup the arrays allocated on the heap
+ CleanupStack::PopAndDestroy(2, sourceFiles);
+ }
+
+/** Calls CFbsBitmap::SwapWidthAndHeight() */
+void CT_DataFbsBitmap::DoCmdSwapWidthAndHeight()
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::SwapWidthAndHeight()"));
+
+ // call SwapWidthAndHeight()
+ TInt err = GetFbsBitmap()->SwapWidthAndHeight();
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Swap width and height error: %d"), err);
+ SetError(err);
+ }
+ }
+
+/** Calls static CFbsBitmap destructor */
+void CT_DataFbsBitmap::DoCmdUnlockHeapL(const TDesC& aSection)
+ {
+
+ CFbsBitmap* bitmap=NULL;
+ if ( CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFbsBitmapName(), bitmap) )
+ {
+ CFbsBitmap::UnlockHeap(bitmap);
+ }
+ else
+ {
+ TBool always=EFalse;
+ GetBoolFromConfig(aSection, KAlways(), always);
+
+ GetFbsBitmap()->UnlockHeap(always);
+ }
+
+ if ( iPopWhenUnlocking )
+ {
+ iPopWhenUnlocking=EFalse;
+ CleanupStack::Pop();
+ }
+ }
+
+/** Calls CFbsBitmap::VerticalPixelsToTwips() */
+void CT_DataFbsBitmap::DoCmdVerticalPixelsToTwips(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::VerticalPixelsToTwips()"));
+
+ // get pixels from parameters
+ TInt pixels;
+ if(!GetIntFromConfig(aSection, KPixels(), pixels))
+ {
+ ERR_PRINTF2(_L("No %S"), &KPixels());
+ SetBlockResult(EFail);
+ }
+
+ // call VerticalPixelsToTwips()
+ TInt value = GetFbsBitmap()->VerticalPixelsToTwips(pixels);
+ INFO_PRINTF2(_L("Twips: %d"), value);
+
+ // validate returned value if needed
+ TInt expectedValue;
+ if(GetIntFromConfig(aSection, KExpectedInt(), expectedValue))
+ {
+ if (expectedValue != value)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedValue, value);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::VerticalTwipsToPixels() */
+void CT_DataFbsBitmap::DoCmdVerticalTwipsToPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::VerticalTwipsToPixels()"));
+
+ // get twips from parameters
+ TInt twips;
+ if(!GetIntFromConfig(aSection, KTwips(), twips))
+ {
+ ERR_PRINTF2(_L("No %S"), &KTwips());
+ SetBlockResult(EFail);
+ }
+
+ // call VerticalTwipsToPixels()
+ TInt value = GetFbsBitmap()->VerticalTwipsToPixels(twips);
+ INFO_PRINTF2(_L("Pixels: %d"), value);
+
+ // validate returned value if needed
+ TInt expectedValue;
+ if(GetIntFromConfig(aSection, KExpectedInt(), expectedValue))
+ {
+ if (expectedValue != value)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedValue, value);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** Calls CFbsBitmap::ExternalizeL() or CFbsBitmap::ExternalizeRectangleL(). Used by DoCmdExternalize() and DoCmdExternalizeRectangle() methods */
+void CT_DataFbsBitmap::ExternalizeImplL(const TDesC& aSection, const TRect& aRect, TBool aUseRect)
+ {
+ // get file name from parameters
+ TPtrC fileName;
+ if (!GetStringFromConfig(aSection, KFileName(), fileName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFileName());
+ SetBlockResult(EFail);
+ }
+
+ // get a flag if to use closed stream from parameters
+ TBool useClosedStream = EFalse;
+ if(!GetBoolFromConfig(aSection, KUseClosedStream(), useClosedStream))
+ {
+ ERR_PRINTF2(_L("No %S"), &KUseClosedStream());
+ SetBlockResult(EFail);
+ }
+
+ // create write store
+ CDirectFileStore* writestore = CDirectFileStore::ReplaceL(FileServer(), fileName, EFileStream | EFileWrite);
+ CleanupStack::PushL(writestore);
+ TInt popCount=1;
+ TUidType uidtype(KDirectFileStoreLayoutUid, KMultiBitmapFileImageUid);
+
+ writestore->SetTypeL(uidtype);
+
+ // create write stream
+ RStoreWriteStream writestrm;
+
+ // close stream set by parameters
+ if (!useClosedStream)
+ {
+ TStreamId headerid=writestrm.CreateL(*writestore);
+ CleanupClosePushL(writestrm);
+
+ ++popCount;
+ writestore->SetRootL(headerid);
+ }
+
+ if (aUseRect)
+ {
+ // call ExternalizeRectangleL()
+ TRAPD(err, GetFbsBitmap()->ExternalizeRectangleL(writestrm, aRect));
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Externalize rectangle error: %d"), err);
+ SetError(err);
+ }
+ }
+ else
+ {
+ // call ExternalizaL()
+ TRAPD(err, GetFbsBitmap()->ExternalizeL(writestrm));
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Externalize error: %d"), err);
+ SetError(err);
+ }
+ }
+
+ // cleanup
+ CleanupStack::PopAndDestroy(popCount, writestore);
+ }
+
+/** Calls CFbsBitmap::Load() or CFbsBitmap::LoadAndCompress(). Used by DoCmdLoad() and DoCmdLoadAndCompress() methods */
+void CT_DataFbsBitmap::LoadOrLoadAndCompressL(const TDesC& aSection, TBool aCompress)
+ {
+
+ // get bitmap id from parameters
+ TInt bitmapId;
+ if(!GetIntFromConfig(aSection, KBitmapId(), bitmapId))
+ {
+ ERR_PRINTF2(_L("No %S"), &KBitmapId());
+ SetBlockResult(EFail);
+ }
+
+ // get file name from parameters
+ TPtrC fileName;
+ if (!GetStringFromConfig(aSection, KFileName(), fileName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFileName());
+ SetBlockResult(EFail);
+ }
+
+ // get file offset from parameters
+ TInt fileOffset;
+ TBool useOffset = GetIntFromConfig(aSection, KFileOffset(), fileOffset);
+
+ // get share if loaded from parameters
+ TBool shareIfLoaded = EFalse;
+ GetBoolFromConfig(aSection, KShareIfLoaded(), shareIfLoaded);
+
+ // get flag if use RFile instance in Load() call from parameters
+ TBool useRFile = EFalse;
+ GetBoolFromConfig(aSection, KUseRFile(), useRFile);
+
+ // get flag if use RFile instance in Load() call from parameters
+ TBool useClosedRFile = EFalse;
+ GetBoolFromConfig(aSection, KUseClosedRFile(), useClosedRFile);
+
+ if (useClosedRFile && !useRFile)
+ {
+ ERR_PRINTF3(_L("Cannot use %S parameter if %S is not set to TRUE"), &KUseClosedRFile(), &KUseRFile());
+ SetBlockResult(EFail);
+ }
+
+ // load bitmap
+ TInt err = KErrNone;
+ if (useRFile)
+ {
+ // required to allow file handle to be adopted by another process
+ FileServer().ShareProtected();
+
+ // open rfile
+ RFile file;
+
+ // if we use invalid RFile handle in our test
+ if (!useClosedRFile)
+ {
+ User::LeaveIfError(file.Open(FileServer(), fileName, EFileShareReadersOnly));
+ CleanupClosePushL(file);
+ }
+
+ // do load
+ if (aCompress)
+ {
+ if (useOffset)
+ {
+ err = GetFbsBitmap()->LoadAndCompress(file, bitmapId, shareIfLoaded, fileOffset);
+ }
+ else
+ {
+ err = GetFbsBitmap()->LoadAndCompress(file, bitmapId, shareIfLoaded);
+ }
+ }
+ else
+ {
+ if (useOffset)
+ {
+ err = GetFbsBitmap()->Load(file, bitmapId, shareIfLoaded, fileOffset);
+ }
+ else
+ {
+ err = GetFbsBitmap()->Load(file, bitmapId, shareIfLoaded);
+ }
+ }
+
+ if (!useClosedRFile)
+ {
+ CleanupStack::PopAndDestroy(&file);
+ }
+ }
+ else
+ {
+ if (aCompress)
+ {
+ if (useOffset)
+ {
+ err = GetFbsBitmap()->LoadAndCompress(fileName, bitmapId, shareIfLoaded, fileOffset);
+ }
+ else
+ {
+ err = GetFbsBitmap()->LoadAndCompress(fileName, bitmapId, shareIfLoaded);
+ }
+ }
+ else
+ {
+ if (useOffset)
+ {
+ err = GetFbsBitmap()->Load(fileName, bitmapId, shareIfLoaded, fileOffset);
+ }
+ else
+ {
+ err = GetFbsBitmap()->Load(fileName, bitmapId, shareIfLoaded);
+ }
+ }
+ }
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Load error: %d"), err);
+ SetError(err);
+ }
+ }
+
+/**
+ Virtual RunL - Called on completion of an asynchronous command
+ @see MTPActiveCallback
+ @param aActive Active Object that RunL has been called on
+ @pre N/A
+ @post N/A
+ @leave system wide error code
+*/
+void CT_DataFbsBitmap::RunL(CActive* aActive, const TInt aIndex)
+ {
+ if ( aActive==iActiveCompressInBackground )
+ {
+ RunCompressInBackground(aIndex);
+ }
+ else
+ {
+ ERR_PRINTF1(_L("Stray signal"));
+ SetBlockResult(EFail);
+ }
+ DecOutstanding();
+ }
+
+/**
+ Virtual DoCancel - Request to cancel the asynchronous command
+ @see - MTPActiveCallback
+ @param aActive Active Object that DoCancel has been called on
+ @pre - N/A
+ @post - N/A
+ @leave system wide error code
+*/
+void CT_DataFbsBitmap::DoCancel(CActive* aActive, const TInt aIndex)
+ {
+ if ( aActive==iActiveCompressInBackground )
+ {
+ DoCancelCompressInBackground(aIndex);
+ }
+ else
+ {
+ ERR_PRINTF1(_L("Stray signal"));
+ SetBlockResult(EFail);
+ }
+ DecOutstanding();
+ }
+
+void CT_DataFbsBitmap::RunCompressInBackground(const TInt aIndex)
+ {
+ TInt err=iActiveCompressInBackground->iStatus.Int();
+ INFO_PRINTF2(_L("RunCompressInBackground %d"), err);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("RunL Error %d"), err);
+ SetAsyncError(aIndex, err);
+ }
+ }
+
+void CT_DataFbsBitmap::DoCancelCompressInBackground(const TInt /*aIndex*/)
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/src/T_DataFbsColor256BitmapUtil.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFbsColor256BitmapUtil
+*/
+
+// User includes
+#include "T_DataFbsColor256BitmapUtil.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Parameters
+_LIT(KDither, "dither");
+_LIT(KBitmapFrom, "bitmap_from");
+_LIT(KBitmapTo, "bitmap_to");
+_LIT(KPalette, "palette");
+
+/// Enumeration parameter values
+_LIT(KDitherNoDither, "ENoDither");
+_LIT(KDitherFloydSteinberg, "EFloydSteinberg");
+
+/// Commands
+_LIT(KCmdNewL, "NewL");
+_LIT(KCmdCopyBitmap, "CopyBitmap");
+_LIT(KCleanup, "~");
+/*@}*/
+
+
+/**
+* Two phase constructor
+*/
+CT_DataFbsColor256BitmapUtil* CT_DataFbsColor256BitmapUtil::NewL()
+ {
+ CT_DataFbsColor256BitmapUtil* ret = new (ELeave) CT_DataFbsColor256BitmapUtil();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataFbsColor256BitmapUtil::CT_DataFbsColor256BitmapUtil()
+: CDataWrapperBase()
+, iFbsColor256BitmapUtil(NULL)
+ {
+ }
+
+
+void CT_DataFbsColor256BitmapUtil::ConstructL()
+ {
+ }
+
+
+CT_DataFbsColor256BitmapUtil::~CT_DataFbsColor256BitmapUtil()
+ {
+ DestroyData();
+ }
+
+
+/**
+* Contains cleanup implementation
+*/
+void CT_DataFbsColor256BitmapUtil::DestroyData()
+ {
+ delete iFbsColor256BitmapUtil;
+ iFbsColor256BitmapUtil = NULL;
+ }
+
+
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataFbsColor256BitmapUtil::GetObject()
+ {
+ return iFbsColor256BitmapUtil;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsColor256BitmapUtil::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNewL)
+ {
+ DoCmdNewL(aSection);
+ }
+ else if (aCommand == KCmdCopyBitmap)
+ {
+ DoCmdCopyBitmapL(aSection);
+ }
+ else if (aCommand == KCleanup)
+ {
+ DestroyData();
+ }
+ else
+ {
+ retVal=EFalse;
+ }
+
+ return retVal;
+ }
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** CFbsColor256BitmapUtil::NewL() call */
+void CT_DataFbsColor256BitmapUtil::DoCmdNewL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("CFbsColor256BitmapUtil::NewL() call"));
+
+ // cleanup if any
+ delete iFbsColor256BitmapUtil;
+ iFbsColor256BitmapUtil = NULL;
+
+ // get CPalette object passed as a parameter
+ CPalette* palette = NULL;
+ CT_GraphicsUtil::GetPaletteL(*this, aSection, KPalette(), palette);
+
+ // call NewL()
+ TRAPD(err, iFbsColor256BitmapUtil = CFbsColor256BitmapUtil::NewL(palette));
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("CFbsColor256BitmapUtil::NewL error: %d"), err);
+ SetError(err);
+ }
+ }
+
+
+/** CFbsColor256BitmapUtil::CopyBitmap() call */
+void CT_DataFbsColor256BitmapUtil::DoCmdCopyBitmapL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("CFbsColor256BitmapUtil::CopyBitmap() call"));
+
+ // get source CFbsBitmap passed as a parameter
+ CFbsBitmap* fbsBitmapFrom = NULL;
+ CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KBitmapFrom(), fbsBitmapFrom);
+
+ // get destination CFbsBitmap passed as a parameter
+ CFbsBitmap* fbsBitmapTo = NULL;
+ CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KBitmapTo(), fbsBitmapTo);
+
+ // get dither mode from parameters
+ CFbsColor256BitmapUtil::TDither dither;
+ if (!ReadDither(*this, aSection, dither))
+ {
+ ERR_PRINTF1(_L("No dither"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call CopyBitmap()
+ TInt err = iFbsColor256BitmapUtil->CopyBitmap(fbsBitmapTo, fbsBitmapFrom, dither);
+
+ // check error
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("CopyBitmap failed with error %d"), err);
+ SetError(err);
+ }
+ }
+ }
+
+//////////////////// UTIL METHODS ////////////////////////////
+
+
+TBool CT_DataFbsColor256BitmapUtil::ReadDither(CDataWrapper& aDataWrapper, const TDesC& aSection, CFbsColor256BitmapUtil::TDither& aDither)
+ {
+ // Read dither from INI file
+ TPtrC ditherStr;
+ TBool found=aDataWrapper.GetStringFromConfig(aSection, KDither(), ditherStr);
+ if ( found )
+ {
+ if (ditherStr == KDitherNoDither)
+ {
+ aDither = CFbsColor256BitmapUtil::ENoDither;
+ }
+ else if (ditherStr == KDitherFloydSteinberg)
+ {
+ aDither = CFbsColor256BitmapUtil::EFloydSteinberg;
+ }
+ else
+ {
+ TInt dither = 0;
+ found = aDataWrapper.GetIntFromConfig(aSection, KDither(), dither);
+ if ( found )
+ {
+ aDither = (CFbsColor256BitmapUtil::TDither) dither;
+ }
+ }
+ }
+
+ return found;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/src/T_DataFbsFont.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,367 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFbsFont
+*/
+
+#include "T_DataFbsFont.h"
+
+/*@{*/
+/// Parameters
+_LIT(KText, "text");
+_LIT(KExpectedBool, "expected_bool");
+_LIT(KCharCode, "char_code");
+_LIT(KNullBitmapPointerExpected, "null_bitmap_pointer_expected");
+
+/// Commands
+_LIT(KCmdGetFontMetrics, "GetFontMetrics");
+_LIT(KCmdTextWidthInPixelsWithCharWidth, "TextWidthInPixelsWithCharWidth");
+_LIT(KCmdHandle, "Handle");
+_LIT(KCmdCharacterMetrics, "CharacterMetrics");
+_LIT(KCmdRawTextWidthInPixels, "RawTextWidthInPixels");
+_LIT(KCmdGetFaceAttrib, "GetFaceAttrib");
+_LIT(KCmdIsOpenFont, "IsOpenFont");
+_LIT(KCmdHasCharacter, "HasCharacter");
+/*@}*/
+
+/**
+* Constructor
+*/
+CT_DataFbsFont* CT_DataFbsFont::NewL()
+ {
+ CT_DataFbsFont* ret = new (ELeave) CT_DataFbsFont();
+ return ret;
+ }
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataFbsFont::CT_DataFbsFont()
+: CT_DataFont()
+, iFbsFont(NULL)
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsFont::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret=ETrue;
+
+ if (aCommand == KCmdGetFontMetrics)
+ {
+ DoCmdGetFontMetrics(aSection);
+ }
+ else if (aCommand == KCmdTextWidthInPixelsWithCharWidth)
+ {
+ DoCmdTextWidthInPixelsWithCharWidth(aSection);
+ }
+ else if (aCommand == KCmdHandle)
+ {
+ DoCmdHandle();
+ }
+ else if (aCommand == KCmdCharacterMetrics)
+ {
+ DoCmdCharacterMetrics(aSection);
+ }
+ else if (aCommand == KCmdRawTextWidthInPixels)
+ {
+ DoCmdRawTextWidthInPixels(aSection);
+ }
+ else if (aCommand == KCmdGetFaceAttrib)
+ {
+ DoCmdGetFaceAttrib(aSection);
+ }
+ else if (aCommand == KCmdIsOpenFont)
+ {
+ DoCmdIsOpenFont(aSection);
+ }
+ else if (aCommand == KCmdHasCharacter)
+ {
+ DoCmdHasCharacter(aSection);
+ }
+ else
+ {
+ ret=CT_DataFont::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+
+CFont* CT_DataFbsFont::GetFont() const
+ {
+ return iFbsFont;
+ }
+
+
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataFbsFont::GetObject()
+ {
+ return iFbsFont;
+ }
+
+
+/**
+* Sets a fbs font
+*
+* @param aNewFont fbs font
+*/
+void CT_DataFbsFont::SetObjectL(TAny* aObject)
+ {
+ // no clean up needed, because fonts are managed by server side
+ iFbsFont = static_cast<CFbsFont*>(aObject);
+ }
+
+
+/**
+* Disown a fbs font
+*
+*/
+void CT_DataFbsFont::DisownObjectL()
+ {
+ // no clean up needed, because fonts are managed by server side
+ iFbsFont=NULL;
+ }
+
+
+/** Calls CFbsFont::GetFontMetrics() */
+void CT_DataFbsFont::DoCmdGetFontMetrics(const TDesC& aSection)
+ {
+ TOpenFontMetrics metrics;
+ TBool actual = iFbsFont->GetFontMetrics(metrics);
+ INFO_PRINTF2(_L("Calls CFbsFont::GetFontMetrics() %d"), actual);
+
+ // get if true expected flag from parameters
+ TBool expected;
+ if ( GetBoolFromConfig(aSection, KExpectedBool(), expected) )
+ {
+ // check that the value is as expected
+ if (actual != expected)
+ {
+ ERR_PRINTF3(_L("The value is not as expected! expected: %d, actual: %d"), expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFbsFont::TextWidthInPixels() using SCharWidth output paramter */
+void CT_DataFbsFont::DoCmdTextWidthInPixelsWithCharWidth(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsFont::TextWidthInPixels() using SCharWidth output paramter"));
+
+ // get text from parameters
+ TPtrC text;
+ if (!GetStringFromConfig(aSection, KText(), text))
+ {
+ ERR_PRINTF2(_L("No %S"), &KText());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call TextWidthInPixels()
+ SCharWidth charWidth;
+ iFbsFont->TextWidthInPixels(text, charWidth);
+
+ // validate SCharWidth
+ if (charWidth.iMove != charWidth.iLeftAdjust + charWidth.iWidth + charWidth.iRightAdjust)
+ {
+ ERR_PRINTF5(_L("Move is not equal to left adjust + width + right adjust!, move: %d, leftAdjust: %d, width: %d, rightAdjust: %d"), charWidth.iMove, charWidth.iLeftAdjust, charWidth.iWidth, charWidth.iRightAdjust);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFbsFont::Handle() */
+void CT_DataFbsFont::DoCmdHandle()
+ {
+ // call Handle()
+ TInt handle = iFbsFont->Handle();
+ INFO_PRINTF2(_L("Calls CFbsFont::Handle() %d"), handle);
+
+ // validate hanle
+ if (handle == 0)
+ {
+ ERR_PRINTF1(_L("Handle is zero!"));
+ SetBlockResult(EFail);
+ }
+ }
+
+
+/** Calls CFbsFont::CharacterMetrics() */
+void CT_DataFbsFont::DoCmdCharacterMetrics(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsFont::CharacterMetrics()"));
+
+ // get character code from parameters
+ TInt charCode = 0;
+ if(!GetIntFromConfig(aSection, KCharCode(), charCode))
+ {
+ ERR_PRINTF2(_L("No %S"), &KCharCode());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call CharacterMetrics()
+ const TUint8* bitmapPointer;
+ iFbsFont->CharacterMetrics(charCode, bitmapPointer);
+
+ // get if NULL bitmap pointer expected flag from parameters
+ TBool expectedNull = EFalse;
+ if(GetBoolFromConfig(aSection, KNullBitmapPointerExpected(), expectedNull))
+ {
+ // check that on retirn the bitmap pointer is not NULL
+ if ( expectedNull )
+ {
+ if ( bitmapPointer!=NULL )
+ {
+ ERR_PRINTF1(_L("Bitmap pointer is NOT null!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ if ( bitmapPointer==NULL )
+ {
+ ERR_PRINTF1(_L("Bitmap pointer is null!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+ }
+
+
+/** Calls CFbsFont::RawTextWidthInPixels() */
+void CT_DataFbsFont::DoCmdRawTextWidthInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsFont::RawTextWidthInPixels()"));
+
+ // get text from parameters
+ TPtrC text;
+ if (!GetStringFromConfig(aSection, KText(), text))
+ {
+ ERR_PRINTF2(_L("No %S"), &KText());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call RawTextWidthInPixels()
+ TInt width = iFbsFont->RawTextWidthInPixels(text);
+
+ // check result against MeasureText()
+ TInt measureTextWidth = iFbsFont->MeasureText(text);
+ if ( width != measureTextWidth)
+ {
+ ERR_PRINTF3(_L("The result of RawTextWidthInPixels() is not the same as for MeasureText(): %d, and %d"), width, measureTextWidth);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFbsFont::GetFaceAttrib() */
+void CT_DataFbsFont::DoCmdGetFaceAttrib(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsFont::GetFaceAttrib()"));
+
+ // call GetFaceAttrib()
+ TOpenFontFaceAttrib attrib;
+ TBool actual = iFbsFont->GetFaceAttrib(attrib);
+
+ // get if true expected flag from parameters
+ TBool expected;
+ if(GetBoolFromConfig(aSection, KExpectedBool(), expected))
+ {
+ // check that the value is as expected
+ if (actual != expected)
+ {
+ ERR_PRINTF3(_L("The value is not as expected! expected: %d, actual: %d"), expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFbsFont::IsOpenFont() */
+void CT_DataFbsFont::DoCmdIsOpenFont(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsFont::IsOpenFont()"));
+
+ // call IsOpenFont()
+ TBool actual = iFbsFont->IsOpenFont();
+
+ // check that the value is as expected if there is a expected bool parameter
+ TBool expected;
+ if (GetBoolFromConfig(aSection, KExpectedBool(), expected) )
+ {
+ // check that the value is as expected
+ if (actual != expected)
+ {
+ ERR_PRINTF3(_L("The value is not as expected! expected: %d, actual: %d"), expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFbsFont::HasCharacter() */
+void CT_DataFbsFont::DoCmdHasCharacter(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsFont::HasCharacter()"));
+
+ // get character code from parameters
+ TInt charCode = 0;
+ if(!GetIntFromConfig(aSection, KCharCode(), charCode))
+ {
+ ERR_PRINTF2(_L("No %S"), &KCharCode());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call HasCharacter()
+ TBool actual = iFbsFont->HasCharacter(charCode);
+
+ TBool expected;
+ if(GetBoolFromConfig(aSection, KExpectedBool(), expected))
+ {
+ // check that the value is as expected
+ if (actual != expected)
+ {
+ ERR_PRINTF3(_L("The value is not as expected! expected: %d, actual: %d"), expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/src/T_DataFbsSession.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,749 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFbsSession
+*/
+
+#include "T_DataFbsSession.h"
+#include "T_GraphicsUtil.h"
+
+
+/*@{*/
+/// Parameters
+_LIT(KSession, "session");
+_LIT(KInvalidSession, "invalid_session");
+_LIT(KNullSession, "null_session");
+_LIT(KExpectedCallBack, "expected");
+_LIT(KExpectedDiff, "expected_diff");
+_LIT(KFbsMessage, "fbs_message");
+_LIT(KBitmap, "bitmap");
+_LIT(KFbsParameter0, "parameter0");
+_LIT(KFbsParameter1, "parameter1");
+_LIT(KFbsParameter2, "parameter2");
+_LIT(KFbsParameter3, "parameter3");
+_LIT(KVersionName, "name");
+_LIT(KVersionBuild, "build");
+_LIT(KVersionMajor, "major");
+_LIT(KVersionMinor, "minor");
+
+/// Commands
+_LIT(KCmdConstructor, "Constructor");
+_LIT(KCmdConnect, "Connect");
+_LIT(KCmdDisconnect, "Disconnect");
+_LIT(KCmdGetSession, "GetSession");
+_LIT(KCmdCallBack, "CallBack");
+_LIT(KCmdSetCallBack, "SetCallBack");
+_LIT(KCmdResetCallBack, "ResetCallBack");
+_LIT(KCmdResourceCount, "ResourceCount");
+_LIT(KCmdSendCommand, "SendCommand");
+_LIT(KCmdVersion, "Version");
+_LIT(KCmdHeapBase, "HeapBase");
+_LIT(KCmdSessionHandle, "SessionHandle");
+
+_LIT(KFbsMessInit, "EFbsMessInit");
+_LIT(KFbsMessShutdown, "EFbsMessShutdown");
+_LIT(KFbsMessClose, "EFbsMessClose");
+_LIT(KFbsMessResourceCount, "EFbsMessResourceCount");
+_LIT(KFbsMessNumTypefaces, "EFbsMessNumTypefaces");
+_LIT(KFbsMessTypefaceSupport, "EFbsMessTypefaceSupport");
+_LIT(KFbsMessFontHeightInTwips, "EFbsMessFontHeightInTwips");
+_LIT(KFbsMessFontHeightInPixels, "EFbsMessFontHeightInPixels");
+_LIT(KFbsMessAddFontStoreFile, "EFbsMessAddFontStoreFile");
+_LIT(KFbsMessInstallFontStoreFile, "EFbsMessInstallFontStoreFile");
+_LIT(KFbsMessRemoveFontStoreFile, "EFbsMessRemoveFontStoreFile");
+_LIT(KFbsMessSetPixelHeight, "EFbsMessSetPixelHeight");
+_LIT(KFbsMessGetFontById, "EFbsMessGetFontById");
+_LIT(KFbsMessFontDuplicate, "EFbsMessFontDuplicate");
+_LIT(KFbsMessBitmapCreate, "EFbsMessBitmapCreate");
+_LIT(KFbsMessBitmapResize, "EFbsMessBitmapResize");
+_LIT(KFbsMessBitmapDuplicate, "EFbsMessBitmapDuplicate");
+_LIT(KFbsMessBitmapLoad, "EFbsMessBitmapLoad");
+_LIT(KFbsMessDefaultAllocFail, "EFbsMessDefaultAllocFail");
+_LIT(KFbsMessDefaultMark, "EFbsMessDefaultMark");
+_LIT(KFbsMessDefaultMarkEnd, "EFbsMessDefaultMarkEnd");
+_LIT(KFbsMessUserAllocFail, "EFbsMessUserAllocFail");
+_LIT(KFbsMessUserMark, "EFbsMessUserMark");
+_LIT(KFbsMessUserMarkEnd, "EFbsMessUserMarkEnd");
+_LIT(KFbsMessHeapCheck, "EFbsMessHeapCheck");
+_LIT(KFbsMessRasterize, "EFbsMessRasterize");
+_LIT(KFbsMessFaceAttrib, "EFbsMessFaceAttrib");
+_LIT(KFbsMessHasCharacter, "EFbsMessHasCharacter");
+_LIT(KFbsMessSetDefaultGlyphBitmapType, "EFbsMessSetDefaultGlyphBitmapType");
+_LIT(KFbsMessGetDefaultGlyphBitmapType, "EFbsMessGetDefaultGlyphBitmapType");
+_LIT(KFbsMessFontNameAlias, "EFbsMessFontNameAlias");
+_LIT(KFbsMessBitmapCompress, "EFbsMessBitmapCompress");
+_LIT(KFbsMessGetHeapSizes, "EFbsMessGetHeapSizes");
+_LIT(KFbsMessGetNearestFontToDesignHeightInTwips, "EFbsMessGetNearestFontToDesignHeightInTwips");
+_LIT(KFbsMessGetNearestFontToMaxHeightInTwips, "EFbsMessGetNearestFontToMaxHeightInTwips");
+_LIT(KFbsMessGetNearestFontToDesignHeightInPixels, "EFbsMessGetNearestFontToDesignHeightInPixels");
+_LIT(KFbsMessGetNearestFontToMaxHeightInPixels, "EFbsMessGetNearestFontToMaxHeightInPixels");
+_LIT(KFbsMessShapeText, "EFbsMessShapeText");
+_LIT(KFbsMessShapeDelete, "EFbsMessShapeDelete");
+_LIT(KFbsMessDefaultLanguageForMetrics, "EFbsMessDefaultLanguageForMetrics");
+_LIT(KFbsMessSetTwipsHeight, "EFbsMessSetTwipsHeight");
+_LIT(KFbsMessGetTwipsHeight, "EFbsMessGetTwipsHeight");
+_LIT(KFbsCompress, "EFbsCompress");
+_LIT(KFbsMessBitmapBgCompress, "EFbsMessBitmapBgCompress");
+_LIT(KFbsSetSystemDefaultTypefaceName, "EFbsSetSystemDefaultTypefaceName");
+_LIT(KFbsGetAllBitmapHandles, "EFbsGetAllBitmapHandles");
+_LIT(KFbsMessCreateLinkedTypeface, "EFbsMessCreateLinkedTypeface");
+_LIT(KFbsMessSetHeapFail, "EFbsMessSetHeapFail");
+_LIT(KFbsMessHeapCount, "EFbsMessHeapCount");
+_LIT(KFbsMessSetHeapReset, "EFbsMessSetHeapReset");
+_LIT(KFbsMessSetHeapCheck, "EFbsMessSetHeapCheck");
+_LIT(KFbsMessHeap, "EFbsMessHeap");
+_LIT(KFbsMessLinkedCache, "EFbsMessLinkedCache");
+_LIT(KFbsMessBitmapClean, "EFbsMessBitmapClean");
+/*@}*/
+
+/**
+* Two phase constructor
+*/
+CT_DataFbsSession* CT_DataFbsSession::NewL()
+ {
+ CT_DataFbsSession* ret = new (ELeave) CT_DataFbsSession();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataFbsSession::CT_DataFbsSession()
+: CDataWrapperBase()
+, iSession(NULL)
+, iResourceCount(-1)
+, iCallBackCalled(EFalse)
+ {
+ }
+
+/**
+* Second phase construction
+*/
+void CT_DataFbsSession::ConstructL()
+ {
+ }
+
+/**
+* Protected destructor.
+*/
+CT_DataFbsSession::~CT_DataFbsSession()
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsSession::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret=ETrue;
+
+ if (aCommand == KCmdConstructor)
+ {
+ DoCmdConstructor();
+ }
+ else if (aCommand == KCmdConnect)
+ {
+ DoCmdConnect(aSection);
+ }
+ else if (aCommand == KCmdDisconnect)
+ {
+ DoCmdDisconnect();
+ }
+ else if (aCommand == KCmdGetSession)
+ {
+ DoCmdGetSession(aSection);
+ }
+ else if (aCommand == KCmdCallBack)
+ {
+ DoCmdCallBack(aSection);
+ }
+ else if (aCommand == KCmdResetCallBack)
+ {
+ DoCmdResetCallBack();
+ }
+ else if (aCommand == KCmdSetCallBack)
+ {
+ DoCmdSetCallBack();
+ }
+ else if (aCommand == KCmdResourceCount)
+ {
+ DoCmdResourceCount(aSection);
+ }
+ else if (aCommand == KCmdSendCommand)
+ {
+ DoCmdSendCommandL(aSection);
+ }
+ else if (aCommand == KCmdVersion)
+ {
+ DoCmdVersion(aSection);
+ }
+ else if (aCommand == KCmdHeapBase)
+ {
+ DoCmdHeapBase();
+ }
+ else if (aCommand == KCmdSessionHandle)
+ {
+ DoCmdSessionHandle();
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+
+void CT_DataFbsSession::DoCmdConstructor()
+ {
+ INFO_PRINTF1(_L("Call RFbsSession's constructor"));
+
+ RFbsSession tempSession;
+ }
+
+
+/** RFbsSession::Connect() Call */
+void CT_DataFbsSession::DoCmdConnect(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("RFbsSession::Connect() call"));
+
+ TBool session=EFalse;
+ GetBoolFromConfig(aSection, KSession(), session);
+
+ TBool invalidSession=EFalse;
+ GetBoolFromConfig(aSection, KInvalidSession(), invalidSession);
+
+ TInt err=KErrNone;
+ if ( session )
+ {
+ err=RFbsSession::Connect(FileServer());
+ }
+ else if ( invalidSession )
+ {
+ err=RFbsSession::Connect(iFsUnconnected);
+ }
+ else
+ {
+ err=RFbsSession::Connect();
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("Connect failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+/** RFbsSession::Disconnect() call */
+void CT_DataFbsSession::DoCmdDisconnect()
+ {
+ INFO_PRINTF1(_L("RFbsSession::Disconnect() call"));
+ RFbsSession::Disconnect();
+ }
+
+/** RFbsSession::GetSession() check */
+void CT_DataFbsSession::DoCmdGetSession(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("RFbsSession::GetSession() check"));
+
+ // get not_null_session parameter value
+
+ TBool nullSessionExpected = EFalse;
+ GetBoolFromConfig(aSection, KNullSession(), nullSessionExpected);
+
+ // check result of GetSession() method
+ iSession = RFbsSession::GetSession();
+
+ if ( nullSessionExpected )
+ {
+ if ( iSession != NULL )
+ {
+ // Session is expected to be null but it is not null
+ ERR_PRINTF1(_L("Session is expected to be null but it is not null!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ if ( iSession == NULL )
+ {
+ ERR_PRINTF1(_L("Session is expected to be not null but it is null!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** RFbsSession::CallBack() call */
+void CT_DataFbsSession::DoCmdCallBack(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("RFbsSession::CallBack() call"));
+ iCallBackCalled=EFalse;
+ iSession->CallBack();
+
+ // get expected callback parameter value
+ TBool expected;
+ if( GetBoolFromConfig(aSection, KExpectedCallBack(), expected) )
+ {
+ if ( expected != iCallBackCalled )
+ {
+ ERR_PRINTF3(_L("Expected callback %d does not equal actual callback %d"), expected, iCallBackCalled);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Set call back function uding RFbsSession::SetCallBack() */
+void CT_DataFbsSession::DoCmdSetCallBack()
+ {
+ INFO_PRINTF1(_L("Set call back function uding SetCallBack()"));
+ TCallBack callBack(CallBackFunction, this);
+ iCallBackCalled=EFalse;
+ iSession->SetCallBack(callBack);
+ }
+
+
+/** RFbsSession::ResetCallBack() call */
+void CT_DataFbsSession::DoCmdResetCallBack()
+ {
+ INFO_PRINTF1(_L("RFbsSession::ResetCallBack() call"));
+ iCallBackCalled=EFalse;
+ iSession->ResetCallBack();
+ }
+
+
+/** RFbsSession::ResourceCount() call, memorize resource count */
+void CT_DataFbsSession::DoCmdResourceCount(const TDesC& aSection)
+ {
+ TInt resourceCount=iSession->ResourceCount();
+ INFO_PRINTF2(_L("RFbsSession::ResourceCount() %d"), resourceCount);
+
+
+ // get expected difference from parameters
+ TInt expectedDifference;
+ if ( GetIntFromConfig(aSection, KExpectedDiff(), expectedDifference) )
+ {
+ TInt actualDifference=resourceCount-iResourceCount;
+ if ( actualDifference != expectedDifference )
+ {
+ ERR_PRINTF3(_L("Resource count difference is not as expected! expected: %d, actual: %d"), expectedDifference, actualDifference);
+ SetBlockResult(EFail);
+ }
+ }
+
+ iResourceCount = resourceCount;
+ }
+
+
+/** RFbsSession::SendCommand() call */
+void CT_DataFbsSession::DoCmdSendCommandL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("RFbsSession::SendCommand() call"));
+
+ TInt fbsParameter0=0;
+ CFbsBitmap* fbsBitmap=NULL;
+ if ( CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KBitmap(), fbsBitmap) )
+ {
+ fbsParameter0=fbsBitmap->Handle();
+ }
+ else
+ {
+ GetIntFromConfig(aSection, KFbsParameter0(), fbsParameter0);
+ }
+
+ TInt fbsParameter1=0;
+ GetIntFromConfig(aSection, KFbsParameter1(), fbsParameter1);
+
+ TInt fbsParameter2=0;
+ GetIntFromConfig(aSection, KFbsParameter2(), fbsParameter2);
+
+ TInt fbsParameter3=0;
+ GetIntFromConfig(aSection, KFbsParameter3(), fbsParameter3);
+
+ TInt fbsMessage;
+ if ( !GetFbsMessage(aSection, fbsMessage) )
+ {
+ ERR_PRINTF1(_L("No fbs message"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iSession->SendCommand(fbsMessage, fbsParameter0, fbsParameter1, fbsParameter2, fbsParameter3);
+ }
+ }
+
+
+/** RFbsSession::Version() call */
+void CT_DataFbsSession::DoCmdVersion(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("RFbsSession::Version() call"));
+
+ TVersion version = iSession->Version();
+ TVersionName versionName = version.Name();
+ INFO_PRINTF2(_L("Version name : %s"), &versionName);
+ INFO_PRINTF2(_L("Version build : %d"), (TInt)version.iBuild);
+ INFO_PRINTF2(_L("Version major : %d"), (TInt)version.iMajor);
+ INFO_PRINTF2(_L("Version minor : %d"), (TInt)version.iMinor);
+
+ TPtrC name;
+ if ( GetStringFromConfig(aSection, KVersionName(), name) )
+ {
+ if ( name != version.Name() )
+ {
+ ERR_PRINTF1(_L("Name does not match expected name"));
+ SetBlockResult(EFail);
+ }
+ }
+
+ TInt intTemp;
+ if ( GetIntFromConfig(aSection, KVersionBuild(), intTemp) )
+ {
+ if ( intTemp != version.iBuild )
+ {
+ ERR_PRINTF1(_L("Build does not match expected build"));
+ SetBlockResult(EFail);
+ }
+ }
+
+ if ( GetIntFromConfig(aSection, KVersionMajor(), intTemp) )
+ {
+ if ( intTemp != version.iMajor )
+ {
+ ERR_PRINTF1(_L("Major does not match expected major"));
+ SetBlockResult(EFail);
+ }
+ }
+
+ if ( GetIntFromConfig(aSection, KVersionMinor(), intTemp) )
+ {
+ if ( intTemp != version.iMinor )
+ {
+ ERR_PRINTF1(_L("Minor does not match expected minor"));
+ SetBlockResult(EFail);
+ }
+ }
+
+ if (version.Name() == _L("") && version.iBuild == 0 && version.iMajor == 0 && version.iMinor == 0)
+ {
+ ERR_PRINTF1(_L("Some version fields are not set!"));
+ SetBlockResult(EFail);
+ }
+ }
+
+
+/** RFbsSession::HeapBase() call */
+void CT_DataFbsSession::DoCmdHeapBase()
+ {
+ TUint8* heapBase = iSession->HeapBase();
+ INFO_PRINTF2(_L("RFbsSession::HeapBase() %d"), heapBase);
+
+ if (heapBase == NULL)
+ {
+ ERR_PRINTF1(_L("Heap base is null!"));
+ SetBlockResult(EFail);
+ }
+ }
+
+
+/** RFbsSession::SessionHandle() call */
+void CT_DataFbsSession::DoCmdSessionHandle()
+ {
+ TInt sessionHandle = iSession->SessionHandle();
+ INFO_PRINTF2(_L("RFbsSession::SessionHandle() %d"), sessionHandle);
+
+ if (sessionHandle == 0)
+ {
+ ERR_PRINTF1(_L("Session handle is 0!"));
+ SetBlockResult(EFail);
+ }
+ }
+
+
+/**
+* Return a pointer to the object that the data wraps. Not implemented, returns NULL.
+*
+* @return pointer to the object that the data wraps. Not implemented, returns NULL.
+*/
+TAny* CT_DataFbsSession::GetObject()
+ {
+ return iSession;
+ }
+
+
+/** Function used as a call back, that sets GlobalCallBackCalled to true*/
+TInt CT_DataFbsSession::CallBackFunction(TAny* aThis)
+ {
+ return static_cast<CT_DataFbsSession*>(aThis)->CallBackFunction();
+ }
+
+
+/** Function used as a call back, that sets GlobalCallBackCalled to true*/
+TInt CT_DataFbsSession::CallBackFunction()
+ {
+ return iCallBackCalled = ETrue;
+ }
+
+TBool CT_DataFbsSession::GetFbsMessage(const TDesC& aSection, TInt& aMessage)
+ {
+ TPtrC fbsMessage;
+ TBool ret=GetStringFromConfig(aSection, KFbsMessage(), fbsMessage);
+ if ( !ret )
+ {
+ ERR_PRINTF2(_L("No %S"), &KFbsMessage());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( fbsMessage==KFbsMessInit )
+ {
+ aMessage = EFbsMessInit;
+ }
+ else if ( fbsMessage==KFbsMessShutdown )
+ {
+ aMessage = EFbsMessShutdown;
+ }
+ else if ( fbsMessage==KFbsMessClose )
+ {
+ aMessage = EFbsMessClose;
+ }
+ else if ( fbsMessage==KFbsMessResourceCount )
+ {
+ aMessage = EFbsMessResourceCount;
+ }
+ else if ( fbsMessage==KFbsMessNumTypefaces )
+ {
+ aMessage = EFbsMessNumTypefaces;
+ }
+ else if ( fbsMessage==KFbsMessTypefaceSupport )
+ {
+ aMessage = EFbsMessTypefaceSupport;
+ }
+ else if ( fbsMessage==KFbsMessFontHeightInTwips )
+ {
+ aMessage = EFbsMessFontHeightInTwips;
+ }
+ else if ( fbsMessage==KFbsMessFontHeightInPixels )
+ {
+ aMessage = EFbsMessFontHeightInPixels;
+ }
+ else if ( fbsMessage==KFbsMessAddFontStoreFile )
+ {
+ aMessage = EFbsMessAddFontStoreFile;
+ }
+ else if ( fbsMessage==KFbsMessInstallFontStoreFile )
+ {
+ aMessage = EFbsMessInstallFontStoreFile;
+ }
+ else if ( fbsMessage==KFbsMessRemoveFontStoreFile )
+ {
+ aMessage = EFbsMessRemoveFontStoreFile;
+ }
+ else if ( fbsMessage==KFbsMessSetPixelHeight )
+ {
+ aMessage = EFbsMessSetPixelHeight;
+ }
+ else if ( fbsMessage==KFbsMessGetFontById )
+ {
+ aMessage = EFbsMessGetFontById;
+ }
+ else if ( fbsMessage==KFbsMessFontDuplicate )
+ {
+ aMessage = EFbsMessFontDuplicate;
+ }
+ else if ( fbsMessage==KFbsMessBitmapCreate )
+ {
+ aMessage = EFbsMessBitmapCreate;
+ }
+ else if ( fbsMessage==KFbsMessBitmapResize )
+ {
+ aMessage = EFbsMessBitmapResize;
+ }
+ else if ( fbsMessage==KFbsMessBitmapDuplicate )
+ {
+ aMessage = EFbsMessBitmapDuplicate;
+ }
+ else if ( fbsMessage==KFbsMessBitmapLoad )
+ {
+ aMessage = EFbsMessBitmapLoad;
+ }
+ else if ( fbsMessage==KFbsMessDefaultAllocFail )
+ {
+ aMessage = EFbsMessDefaultAllocFail;
+ }
+ else if ( fbsMessage==KFbsMessDefaultMark )
+ {
+ aMessage = EFbsMessDefaultMark;
+ }
+ else if ( fbsMessage==KFbsMessDefaultMarkEnd )
+ {
+ aMessage = EFbsMessDefaultMarkEnd;
+ }
+ else if ( fbsMessage==KFbsMessUserAllocFail )
+ {
+ aMessage = EFbsMessUserAllocFail;
+ }
+ else if ( fbsMessage==KFbsMessUserMark )
+ {
+ aMessage = EFbsMessUserMark;
+ }
+ else if ( fbsMessage==KFbsMessUserMarkEnd )
+ {
+ aMessage = EFbsMessUserMarkEnd;
+ }
+ else if ( fbsMessage==KFbsMessHeapCheck )
+ {
+ aMessage = EFbsMessHeapCheck;
+ }
+ else if ( fbsMessage==KFbsMessRasterize )
+ {
+ aMessage = EFbsMessRasterize;
+ }
+ else if ( fbsMessage==KFbsMessFaceAttrib )
+ {
+ aMessage = EFbsMessFaceAttrib;
+ }
+ else if ( fbsMessage==KFbsMessHasCharacter )
+ {
+ aMessage = EFbsMessHasCharacter;
+ }
+ else if ( fbsMessage==KFbsMessSetDefaultGlyphBitmapType )
+ {
+ aMessage = EFbsMessSetDefaultGlyphBitmapType;
+ }
+ else if ( fbsMessage==KFbsMessGetDefaultGlyphBitmapType )
+ {
+ aMessage = EFbsMessGetDefaultGlyphBitmapType;
+ }
+ else if ( fbsMessage==KFbsMessFontNameAlias )
+ {
+ aMessage = EFbsMessFontNameAlias;
+ }
+ else if ( fbsMessage==KFbsMessBitmapCompress )
+ {
+ aMessage = EFbsMessBitmapCompress;
+ }
+ else if ( fbsMessage==KFbsMessGetHeapSizes )
+ {
+ aMessage = EFbsMessGetHeapSizes;
+ }
+ else if ( fbsMessage==KFbsMessGetNearestFontToDesignHeightInTwips )
+ {
+ aMessage = EFbsMessGetNearestFontToDesignHeightInTwips;
+ }
+ else if ( fbsMessage==KFbsMessGetNearestFontToMaxHeightInTwips )
+ {
+ aMessage = EFbsMessGetNearestFontToMaxHeightInTwips;
+ }
+ else if ( fbsMessage==KFbsMessGetNearestFontToDesignHeightInPixels )
+ {
+ aMessage = EFbsMessGetNearestFontToDesignHeightInPixels;
+ }
+ else if ( fbsMessage==KFbsMessGetNearestFontToMaxHeightInPixels )
+ {
+ aMessage = EFbsMessGetNearestFontToMaxHeightInPixels;
+ }
+ else if ( fbsMessage==KFbsMessShapeText )
+ {
+ aMessage = EFbsMessShapeText;
+ }
+ else if ( fbsMessage==KFbsMessShapeDelete )
+ {
+ aMessage = EFbsMessShapeDelete;
+ }
+ else if ( fbsMessage==KFbsMessDefaultLanguageForMetrics )
+ {
+ aMessage = EFbsMessDefaultLanguageForMetrics;
+ }
+ else if ( fbsMessage==KFbsMessSetTwipsHeight )
+ {
+ aMessage = EFbsMessSetTwipsHeight;
+ }
+ else if ( fbsMessage==KFbsMessGetTwipsHeight )
+ {
+ aMessage = EFbsMessGetTwipsHeight;
+ }
+ else if ( fbsMessage==KFbsCompress )
+ {
+ aMessage = EFbsCompress;
+ }
+ else if ( fbsMessage==KFbsMessBitmapBgCompress )
+ {
+ aMessage = EFbsMessBitmapBgCompress;
+ }
+
+ else if ( fbsMessage==KFbsSetSystemDefaultTypefaceName )
+ {
+ aMessage = EFbsSetSystemDefaultTypefaceName;
+ }
+ else if ( fbsMessage==KFbsGetAllBitmapHandles )
+ {
+ aMessage = EFbsGetAllBitmapHandles;
+ }
+ else if ( fbsMessage==KFbsMessCreateLinkedTypeface )
+ {
+ aMessage = EFbsMessCreateLinkedTypeface;
+ }
+ else if ( fbsMessage==KFbsMessSetHeapFail )
+ {
+ aMessage = EFbsMessSetHeapFail;
+ }
+ else if ( fbsMessage==KFbsMessHeapCount )
+ {
+ aMessage = EFbsMessHeapCount;
+ }
+ else if ( fbsMessage==KFbsMessSetHeapReset )
+ {
+ aMessage = EFbsMessSetHeapReset;
+ }
+ else if ( fbsMessage==KFbsMessSetHeapCheck )
+ {
+ aMessage = EFbsMessSetHeapCheck;
+ }
+ else if ( fbsMessage==KFbsMessHeap )
+ {
+ aMessage = EFbsMessHeap;
+ }
+ else if ( fbsMessage==KFbsMessLinkedCache )
+ {
+ aMessage = EFbsMessLinkedCache;
+ }
+ else if ( fbsMessage==KFbsMessBitmapClean )
+ {
+ aMessage = EFbsMessBitmapClean;
+ }
+ else
+ {
+ ret=GetIntFromConfig(aSection, KFbsMessage(), aMessage);
+ }
+ }
+
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/src/T_DataFbsTypefaceStore.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,722 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFbsTypefaceStore
+*/
+
+#include "T_DataFbsTypefaceStore.h"
+#include "T_GraphicsUtil.h"
+
+
+/*@{*/
+/// Parameters
+_LIT(KAllFonts, "all_fonts");
+_LIT(KDriveName, "drive_name");
+_LIT(KFileName, "file_name");
+_LIT(KFont, "font");
+_LIT(KFontUid, "font_uid");
+_LIT(KFontNameAlias, "font_name_alias");
+_LIT(KFontName, "font_name");
+_LIT(KLanguage, "language");
+_LIT(KTypefaceId, "typeface_id");
+_LIT(KGraphicsDevice, "graphics_device");
+_LIT(KFontMaxHeight, "font_max_height");
+_LIT(KTypefaceIndex, "typeface_index");
+_LIT(KHeightIndex, "height_index");
+_LIT(KUseFileName, "use_file_name");
+_LIT(KUseDriveName, "use_drive_name");
+_LIT(KAlgStyle, "alg_style");
+_LIT(KCheckAgainstMaximum, "check_against_maximum");
+_LIT(KCheckHeightPositive, "check_height_positive");
+_LIT(KGlyphBitmapType, "glyph_bitmap_type");
+
+/// Commands
+_LIT(KCmdNewL, "NewL");
+_LIT(KCmdAddFile, "AddFile");
+_LIT(KCmdInstallFile, "InstallFile");
+_LIT(KCmdRemoveFile, "RemoveFile");
+_LIT(KCmdGetNearestFontInPixels, "GetNearestFontInPixels");
+_LIT(KCmdGetNearestFontToDesignHeightInPixels, "GetNearestFontToDesignHeightInPixels");
+_LIT(KCmdGetNearestFontToMaxHeightInPixels, "GetNearestFontToMaxHeightInPixels");
+_LIT(KCmdGetFontById, "GetFontById");
+_LIT(KCmdFontHeightInPixels, "FontHeightInPixels");
+_LIT(KCmdDefaultBitmapType, "DefaultBitmapType");
+_LIT(KCmdSetDefaultBitmapType, "SetDefaultBitmapType");
+_LIT(KCmdSetFontNameAliasL, "SetFontNameAliasL");
+_LIT(KCmdSetDefaultLanguageForMetrics, "SetDefaultLanguageForMetrics");
+_LIT(KCmdRemoveFontFileLocksL, "RemoveFontFileLocksL");
+_LIT(KCmdSetSystemDefaultTypefaceName, "SetSystemDefaultTypefaceNameL");
+_LIT(KCmdDestructor, "~");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+/*@}*/
+
+
+/**
+* Two phase constructor
+*/
+CT_DataFbsTypefaceStore* CT_DataFbsTypefaceStore::NewL()
+ {
+ CT_DataFbsTypefaceStore* ret = new (ELeave) CT_DataFbsTypefaceStore();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataFbsTypefaceStore::CT_DataFbsTypefaceStore()
+: CT_DataTypefaceStore()
+, iFbsTypefaceStore(NULL)
+, iLastTypefaceFileId(0)
+ {
+ }
+
+
+/**
+* Protected second phase construction
+*/
+void CT_DataFbsTypefaceStore::ConstructL()
+ {
+ }
+
+
+/**
+* Destructor.
+*/
+CT_DataFbsTypefaceStore::~CT_DataFbsTypefaceStore()
+ {
+ DestroyData();
+ }
+
+
+/**
+* cleanup implementation.
+*/
+void CT_DataFbsTypefaceStore::DestroyData()
+ {
+ delete iFbsTypefaceStore;
+ iFbsTypefaceStore = NULL;
+ }
+
+
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataFbsTypefaceStore::GetObject()
+ {
+ return iFbsTypefaceStore;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFbsTypefaceStore::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret=ETrue;
+
+ if (aCommand == KCmdNewL)
+ {
+ DoCmdNewL(aSection);
+ }
+ else if (aCommand == KCmdAddFile)
+ {
+ DoCmdAddFile(aSection);
+ }
+ else if (aCommand == KCmdInstallFile)
+ {
+ DoCmdInstallFile(aSection);
+ }
+ else if (aCommand == KCmdRemoveFile)
+ {
+ DoCmdRemoveFile(aSection);
+ }
+ else if (aCommand == KCmdGetNearestFontInPixels)
+ {
+ DoCmdGetNearestFontInPixelsL(aSection);
+ }
+ else if (aCommand == KCmdGetNearestFontToDesignHeightInPixels)
+ {
+ DoCmdGetNearestFontToDesignHeightInPixelsL(aSection);
+ }
+ else if (aCommand == KCmdGetNearestFontToMaxHeightInPixels)
+ {
+ DoCmdGetNearestFontToMaxHeightInPixelsL(aSection);
+ }
+ else if (aCommand == KCmdGetFontById)
+ {
+ DoCmdGetFontByIdL(aSection);
+ }
+ else if (aCommand == KCmdFontHeightInPixels)
+ {
+ DoCmdFontHeightInPixels(aSection);
+ }
+ else if (aCommand == KCmdDefaultBitmapType)
+ {
+ DoCmdDefaultBitmapType(aSection);
+ }
+ else if (aCommand == KCmdSetDefaultBitmapType)
+ {
+ DoCmdSetDefaultBitmapType(aSection);
+ }
+ else if (aCommand == KCmdSetFontNameAliasL)
+ {
+ DoCmdSetFontNameAlias(aSection);
+ }
+ else if (aCommand == KCmdSetDefaultLanguageForMetrics)
+ {
+ DoCmdSetDefaultLanguageForMetrics(aSection);
+ }
+ else if (aCommand == KCmdRemoveFontFileLocksL)
+ {
+ DoCmdRemoveFontFileLocks(aSection);
+ }
+ else if (aCommand == KCmdSetSystemDefaultTypefaceName)
+ {
+ DoCmdSetSystemDefaultTypefaceName(aSection);
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DestroyData();
+ }
+ else
+ {
+ ret=CT_DataTypefaceStore::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+
+CTypefaceStore* CT_DataFbsTypefaceStore::GetTypefaceStore() const
+ {
+ return iFbsTypefaceStore;
+ }
+
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** CFbsTypefaceStore::NewL() call */
+void CT_DataFbsTypefaceStore::DoCmdNewL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("CFbsTypefaceStore::NewL() call"));
+
+ // cleanup if any
+ DestroyData();
+
+
+ // get FbsBitmapData object from parameters
+ CGraphicsDevice* device=NULL;
+ TPtrC deviceName;
+ if ( GetStringFromConfig(aSection, KGraphicsDevice(), deviceName) )
+ {
+ // check that the data object was found
+ device=static_cast<CGraphicsDevice*>(GetDataObjectL(deviceName));
+ }
+
+ // do create
+ TRAPD(err, iFbsTypefaceStore = CFbsTypefaceStore::NewL(device));
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("CFbsTypefaceStore creation error: %d"), err);
+ SetError(err);
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::GetNearestFontInPixels() */
+void CT_DataFbsTypefaceStore::DoCmdGetNearestFontInPixelsL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CFbsTypefaceStore::GetNearestFontInPixels()"));
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFont, fontSpec) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFont());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call CFbsTypefaceStore::GetNearestFontInPixels()
+ CFont* font = NULL;
+ TInt err = iFbsTypefaceStore->GetNearestFontInPixels(font, fontSpec);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ // set fbs font data object of provided
+ SetFontDataObjectIfPassedAsParameterL(font, aSection);
+ }
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::GetNearestFontToDesignHeightInPixels() */
+void CT_DataFbsTypefaceStore::DoCmdGetNearestFontToDesignHeightInPixelsL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CFbsTypefaceStore::GetNearestFontToDesignHeightInPixels()"));
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFont, fontSpec) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFont());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call CFbsTypefaceStore::GetNearestFontToDesignHeightInPixels()
+ CFont* fbsFont = NULL;
+ TInt err = iFbsTypefaceStore->GetNearestFontToDesignHeightInPixels(fbsFont, fontSpec);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ // set fbs font data object of provided
+ SetFontDataObjectIfPassedAsParameterL(fbsFont, aSection);
+ }
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::GetNearestFontToMaxHeightInPixels() */
+void CT_DataFbsTypefaceStore::DoCmdGetNearestFontToMaxHeightInPixelsL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CFbsTypefaceStore::GetNearestFontToMaxHeightInPixels()"));
+
+ TBool dataOk=ETrue;
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFont, fontSpec) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFont());
+ SetBlockResult(EFail);
+ }
+
+ TInt fontMaxHeight;
+ if ( !GetIntFromConfig(aSection, KFontMaxHeight(), fontMaxHeight) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFontMaxHeight());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // call CFbsTypefaceStore::GetNearestFontToMaxHeightInPixels()
+ CFont* fbsFont = NULL;
+ TInt err = iFbsTypefaceStore->GetNearestFontToMaxHeightInPixels(fbsFont, fontSpec, fontMaxHeight);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Get nearest font to max height in twips error: %d"), err);
+ SetError(err);
+ }
+ else
+ {
+ // set fbs font data object of provided
+ SetFontDataObjectIfPassedAsParameterL(fbsFont, aSection);
+
+ // get check against maximum parameter from parameters
+ TBool checkAgainstMaximum = EFalse;
+ GetBoolFromConfig(aSection, KCheckAgainstMaximum(), checkAgainstMaximum);
+
+ if ( checkAgainstMaximum )
+ {
+ // check that the height of the returned font is not greater that the maximum specified
+ if (fbsFont->HeightInPixels() > fontMaxHeight)
+ {
+ ERR_PRINTF3(_L("Font doesn't match in maximum specified, height: %d, maximum: %d"), fbsFont->HeightInPixels(), fontMaxHeight);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::AddFile(), remeber typeface id */
+void CT_DataFbsTypefaceStore::DoCmdAddFile(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CFbsTypefaceStore::AddFile(), remeber typeface id"));
+
+ // get font file name from parameters
+ TPtrC fileName;
+ if (!GetStringFromConfig(aSection, KFileName(), fileName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFileName());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call AddFile()
+ TInt err = iFbsTypefaceStore->AddFile(fileName, iLastTypefaceFileId);
+ INFO_PRINTF2(_L("Id %d"), iLastTypefaceFileId);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Add file error: %d"), err);
+ SetError(err);
+ }
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::InstallFile(), remeber typeface id */
+void CT_DataFbsTypefaceStore::DoCmdInstallFile(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CFbsTypefaceStore::InstallFile(), remeber typeface id"));
+
+ // get font file name from parameters
+ TPtrC fileName;
+ if (!GetStringFromConfig(aSection, KFileName(), fileName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFileName());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call InstallFile()
+ TInt err = iFbsTypefaceStore->InstallFile(fileName, iLastTypefaceFileId);
+ INFO_PRINTF2(_L("Id %d"), iLastTypefaceFileId);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Install file error: %d"), err);
+ SetError(err);
+ }
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::RemoveFile() */
+void CT_DataFbsTypefaceStore::DoCmdRemoveFile(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CFbsTypefaceStore::RemoveFile()"));
+
+ // get typeface id from parameters if provided
+ TInt typefaceId=iLastTypefaceFileId;
+ GetIntFromConfig(aSection, KTypefaceId(), typefaceId);
+ INFO_PRINTF2(_L("Typeface id provided : %d"), typefaceId);
+
+ // call RemoveFile()
+ iFbsTypefaceStore->RemoveFile(typefaceId);
+ }
+
+
+/** Call CFbsTypefaceStore::GetFontById() */
+void CT_DataFbsTypefaceStore::DoCmdGetFontByIdL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CFbsTypefaceStore::GetFontById()"));
+
+ // get font uid from parameters
+ TInt fontUid;
+ if(!GetIntFromConfig(aSection, KFontUid(), fontUid))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFontUid());
+ SetBlockResult(EFail);
+ }
+
+ // call GetFontById()
+ TAlgStyle* algStylePointer = NULL;
+ CT_GraphicsUtil::GetAlgStyleL(*this, aSection, KAlgStyle(), algStylePointer);
+
+ CFont* fbsFont = NULL;
+ TInt err = KErrNone;
+ if (algStylePointer == NULL)
+ {
+ TAlgStyle algStyle;
+ err = iFbsTypefaceStore->GetFontById(fbsFont, TUid::Uid(fontUid), algStyle);
+ }
+ else
+ {
+ err = iFbsTypefaceStore->GetFontById(fbsFont, TUid::Uid(fontUid), *algStylePointer);
+ }
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Get font by id error: %d"), err);
+ SetError(err);
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::FontHeightInPixels() */
+void CT_DataFbsTypefaceStore::DoCmdFontHeightInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CFbsTypefaceStore::FontHeightInPixels()"));
+ TBool dataOk=ETrue;
+
+ // get typeface index from parameters
+ TInt typefaceIndex;
+ if(!GetIntFromConfig(aSection, KTypefaceIndex(), typefaceIndex))
+ {
+ ERR_PRINTF2(_L("No %S"), &KTypefaceIndex());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get height index from parameters
+ TInt heightIndex;
+ if(!GetIntFromConfig(aSection, KHeightIndex(), heightIndex))
+ {
+ ERR_PRINTF2(_L("No %S"), &KHeightIndex());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ if ( dataOk )
+ {
+ TInt typefaceHeight = iFbsTypefaceStore->FontHeightInPixels(typefaceIndex, heightIndex);
+
+ // get positive height check flag from parameters
+ TBool checkHeightPositive = EFalse;
+ GetBoolFromConfig(aSection, KCheckHeightPositive(), checkHeightPositive);
+
+ // check that TTypefaceSupport fields are set
+ if ( checkHeightPositive && (typefaceHeight<=0) )
+ {
+ ERR_PRINTF2(_L("Typeface height is not greater than 0, height: %d"), typefaceHeight);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::DefaultBitmapType() and compare value with expected */
+void CT_DataFbsTypefaceStore::DoCmdDefaultBitmapType(const TDesC& aSection)
+ {
+ // get actual value of default bitmap type
+ TGlyphBitmapType actualValue = iFbsTypefaceStore->DefaultBitmapType();
+
+ INFO_PRINTF2(_L("CFbsTypefaceStore::DefaultBitmapType() %d"), actualValue);
+
+
+ // get expected value of default bitmap type from parameters
+ TGlyphBitmapType expectedType;
+ if (!CT_GraphicsUtil::ReadGlyphBitmapType(*this, aSection, KGlyphBitmapType(), expectedType))
+ {
+ ERR_PRINTF1(_L("No glyph_bitmap_type"));
+ SetBlockResult(EFail);
+ }
+
+ // compare
+ if (actualValue != expectedType)
+ {
+ ERR_PRINTF3(_L("Value of default bitmap type is not as expected, expected: %d, actual: %d"), expectedType, actualValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::SetDefaultBitmapType() */
+void CT_DataFbsTypefaceStore::DoCmdSetDefaultBitmapType(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CFbsTypefaceStore::SetDefaultBitmapType()"));
+
+ // get expected value of default bitmap type from parameters
+ TGlyphBitmapType glyphBitmapType;
+ if (!CT_GraphicsUtil::ReadGlyphBitmapType(*this, aSection, KGlyphBitmapType(), glyphBitmapType))
+ {
+ ERR_PRINTF1(_L("No glyph_bitmap_type"));
+ SetBlockResult(EFail);
+ }
+
+ // get actual value of default bitmap type
+ iFbsTypefaceStore->SetDefaultBitmapType(glyphBitmapType);
+ }
+
+
+/** Calls SetFontNameAliasL() for the given font name and alias name */
+void CT_DataFbsTypefaceStore::DoCmdSetFontNameAlias(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls SetFontNameAliasL() for the given font name and alias name"));
+ TBool dataOk=ETrue;
+
+ // get font name from parameters
+ TPtrC fontName;
+ if (!GetStringFromConfig(aSection, KFontName(), fontName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFontName());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get font name alias from parameters
+ TPtrC fontNameAlias;
+ if (!GetStringFromConfig(aSection, KFontNameAlias(), fontNameAlias))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFontNameAlias());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ if ( dataOk )
+ {
+ // set font name alias
+ TRAPD(err, iFbsTypefaceStore->SetFontNameAliasL(fontNameAlias, fontName));
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Set font name alias error: %d"), err);
+ SetError(err);
+ }
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::SetDefaultLanguageForMetrics() */
+void CT_DataFbsTypefaceStore::DoCmdSetDefaultLanguageForMetrics(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CFbsTypefaceStore::SetDefaultLanguageForMetrics()"));
+
+ // get language from parameters
+ TInt language;
+ if(!GetIntFromConfig(aSection, KLanguage(), language))
+ {
+ ERR_PRINTF2(_L("No %S"), &KLanguage());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call SetDefaultLanguageForMetrics for the given language
+ iFbsTypefaceStore->SetDefaultLanguageForMetrics((TLanguage) language);
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::RemoveFontFileLocksL() */
+void CT_DataFbsTypefaceStore::DoCmdRemoveFontFileLocks(const TDesC& aSection)
+ {
+ // get if to call by file name flag from parameters
+ TBool useFileName = EFalse;
+ GetBoolFromConfig(aSection, KUseFileName(), useFileName);
+
+ // get if to call by drive name flag from parameters
+ TBool useDriveName = EFalse;
+ GetBoolFromConfig(aSection, KUseDriveName(), useDriveName);
+
+ TInt err = KErrNone;
+
+ if (useDriveName && useFileName)
+ {
+ ERR_PRINTF1(_L("Cannot all by both file and drive name"));
+ SetBlockResult(EFail);
+ }
+ else if (useDriveName)
+ {
+ // get drive name from parameters
+ TPtrC driveName;
+ if (!GetStringFromConfig(aSection, KDriveName(), driveName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KDriveName());
+ SetBlockResult(EFail);
+ }
+
+ // get all-fonts boolean value from parameters
+ TBool allFonts = EFalse;
+ GetBoolFromConfig(aSection, KAllFonts(), allFonts);
+
+ // call RemoveFontFileLocksL()
+ TRAP(err, iFbsTypefaceStore->RemoveFontFileLocksL(driveName, allFonts));
+ }
+ else if (useFileName)
+ {
+ // get file name from parameters
+ TPtrC fileName;
+ if (!GetStringFromConfig(aSection, KFileName(), fileName))
+ {
+ ERR_PRINTF2(_L("No %S"), &KFileName());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call RemoveFontFileLocksL()
+ TRAP(err, iFbsTypefaceStore->RemoveFontFileLocksL(fileName));
+ }
+ }
+ else
+ {
+ TRAP(err, iFbsTypefaceStore->RemoveFontFileLocksL());
+ }
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Remove font file lock error: %d"), err);
+ SetError(err);
+ }
+ }
+
+
+/** Call CFbsTypefaceStore::SetSystemDefaultTypefaceNameL() */
+void CT_DataFbsTypefaceStore::DoCmdSetSystemDefaultTypefaceName(const TDesC& aSection)
+ {
+
+ TPtrC name;
+ if ( GetStringFromConfig(aSection, KFontName(), name) )
+ {
+ TRAPD(err, iFbsTypefaceStore->SetSystemDefaultTypefaceNameL(name));
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("SetSystemDefaultTypefaceNameL error: %d"), err);
+ SetError(err);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("No %S"), &KFontName());
+ SetBlockResult(EFail);
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fbserv/src/T_FBServAPIServer.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+The main entry point for the TEF Server T_FBServAPIAddr.exe
+*/
+
+// User Includes
+#include "T_FBServAPIServer.h"
+
+CT_FBServAPIServer* CT_FBServAPIServer::NewL()
+/**
+ * @return - Instance of the test server
+ * Same code for Secure and non-secure variants
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+ {
+ CT_FBServAPIServer* server = new (ELeave) CT_FBServAPIServer();
+ CleanupStack::PushL(server);
+ server->ConstructL();
+ CleanupStack::Pop(server);
+ return server;
+ }
+
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+ {
+#if (defined __DATA_CAGING__)
+ RProcess().DataCaging(RProcess::EDataCagingOn);
+ RProcess().SecureApi(RProcess::ESecureApiOn);
+#endif
+ CActiveScheduler* sched=NULL;
+ sched=new(ELeave) CActiveScheduler;
+ CActiveScheduler::Install(sched);
+ CT_FBServAPIServer* server = NULL;
+ TRAPD(err, server = CT_FBServAPIServer::NewL());
+ if(!err)
+ {
+ RProcess::Rendezvous(KErrNone);
+ sched->Start();
+ }
+ delete server;
+ delete sched;
+ }
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+ {
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ if(cleanup == NULL)
+ {
+ return KErrNoMemory;
+ }
+ TRAP_IGNORE(MainL());
+ delete cleanup;
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/inc/T_DataAlgStyle.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataAlgStyle
+*/
+
+#if (!defined __T_DATA_ALG_STYLE_H__)
+#define __T_DATA_ALG_STYLE_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <fntstore.h>
+
+class CT_DataAlgStyle : public CDataWrapperBase
+ {
+public:
+ CT_DataAlgStyle();
+ ~CT_DataAlgStyle();
+
+ static CT_DataAlgStyle* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aObject);
+ virtual void DisownObjectL();
+ void DestroyData();
+
+private:
+ void ConstructL();
+
+ void DoCmdNew();
+ void DoCmdSetWidthFactor(const TDesC& aSection);
+ void DoCmdSetHeightFactor(const TDesC& aSection);
+
+private:
+ /** TAlgStyle class instance to work with*/
+ TAlgStyle* iAlgStyle;
+ };
+
+#endif /* __T_DATA_ALG_STYLE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/inc/T_DataBitmapFont.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataBitmapFont
+*/
+
+#if (!defined __T_DATA_BITMAP_FONT_H__)
+#define __T_DATA_BITMAP_FONT_H__
+
+// User Includes
+#include "T_DataFont.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <fntstore.h>
+
+class CT_DataBitmapFont : public CT_DataFont
+ {
+public:
+ static CT_DataBitmapFont* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aObject);
+ virtual void DisownObjectL();
+
+protected:
+ CT_DataBitmapFont();
+
+ virtual CFont* GetFont() const;
+
+private:
+ void DoCmdBitmapEncoding(const TDesC& aSection);
+ void DoCmdCharacterMetrics(const TDesC& aSection);
+ void DoCmdCharacterNeedsToBeRasterized(const TDesC& aSection);
+ void DoCmdGetCharacterData(const TDesC& aSection);
+ void DoCmdGetFaceAttrib(const TDesC& aSection);
+ void DoCmdGetFontMetrics(const TDesC& aSection);
+ void DoCmdGlyphBitmapType(const TDesC& aSection);
+ void DoCmdHasCharacterL(const TDesC& aSection);
+ void DoCmdIsOpenFont(const TDesC& aSection);
+ void DoCmdOpenFont(const TDesC& aSection);
+ void DoCmdRasterize(const TDesC& aSection);
+ void DoCmdUniqueFontId(const TDesC& aSection);
+
+ static TBool GetCharacterMetricsFromConfig(CDataWrapper& aDataWrapper,const TDesC& aSectName,const TDesC& aKeyName,TCharacterMetrics& aResult);
+ static TBool GetOpenFontCharMetricsFromConfig(CDataWrapperBase& aDataWrapper,const TDesC& aSectName,const TDesC& aKeyName,TOpenFontCharMetrics& aResult);
+ static TBool GetOpenFontFaceAttribFromConfig(CDataWrapper& aDataWrapper,const TDesC& aSectName,const TDesC& aKeyName,TOpenFontFaceAttrib& aResult);
+ static TBool GetOpenFontMetricsFromConfig(CDataWrapper& aDataWrapper,const TDesC& aSectName,const TDesC& aKeyName,TOpenFontMetrics& aResult);
+
+private:
+ CBitmapFont* iBitmapFont;
+ };
+
+#endif /* __T_DATA_BITMAP_FONT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/inc/T_DataFontStore.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFontStore
+*/
+
+#if (!defined __T_DATA_FONTSTORE_H__)
+#define __T_DATA_FONTSTORE_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <fntstore.h>
+#include "T_DataTypefaceStore.h"
+
+class CT_DataFontStore : public CT_DataTypefaceStore
+ {
+public:
+
+ ~CT_DataFontStore();
+ static CT_DataFontStore* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aObject);
+ virtual void DisownObjectL();
+ void DestroyData();
+ virtual CTypefaceStore* GetTypefaceStore() const;
+
+protected:
+ CT_DataFontStore();
+ void ConstructL();
+
+private:
+ void DoCmdNewL(const TDesC& aSection);
+ void DoCmdDestructor();
+
+ void DoCmdAddFileL(const TDesC& aSection);
+ void DoCmdRemoveFile(const TDesC& aSection);
+ void DoCmdDefaultBitmapType(const TDesC& aSection);
+ void DoCmdDeleteSessionCache(const TDesC& aSection);
+ void DoCmdFontHeightInPixels(const TDesC& aSection);
+ void DoCmdFontHeightInTwips(const TDesC& aSection);
+ void DoCmdGetFontByIdL(const TDesC& aSection);
+ void DoCmdGetNearestFontToDesignHeightInPixelsL(const TDesC& aSection);
+ TBool DoCmdGetNearestFontToDesignHeightInTwipsL(const TDesC& aSection);
+ void DoCmdGetNearestFontToMaxHeightInPixelsL(const TDesC& aSection);
+ TBool DoCmdGetNearestFontToMaxHeightInTwipsL(const TDesC& aSection);
+ void DoCmdInstallRasterizerL(const TDesC& aSection);
+ void DoCmdInstallShaperFactoryL(const TDesC& aSection);
+ void DoCmdNumTypefaces(const TDesC& aSection);
+ void DoCmdSetDefaultBitmapType(const TDesC& aSection);
+ void DoCmdTypefaceSupport(const TDesC& aSection);
+
+private:
+ TBool FindIdByName(const TDesC&, TInt&);
+
+private:
+ /** CLinkedTypefaceSpecification class instance to work with*/
+ CFontStore* iFntStore;
+ RArray<TPtrC> iFile;
+ RArray<TInt> iId;
+ };
+
+#endif /* __T_DATA_FONTSTORE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/inc/T_DataLinkedTypefaceSpecification.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataLinkedTypefaceSpecification
+*/
+
+#if (!defined __T_DATA_LINKED_TYPEFACE_SPECIFICATION_H__)
+#define __T_DATA_LINKED_TYPEFACE_SPECIFICATION_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <linkedfonts.h>
+
+class CT_DataLinkedTypefaceSpecification : public CDataWrapperBase
+ {
+public:
+
+ ~CT_DataLinkedTypefaceSpecification();
+ static CT_DataLinkedTypefaceSpecification* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aObject);
+ virtual void DisownObjectL();
+ void DestroyData();
+
+protected:
+ CT_DataLinkedTypefaceSpecification();
+ void ConstructL();
+
+private:
+ void DoCmdNewL(const TDesC& aSection);
+ void DoCmdDestructor();
+
+private:
+ /** CLinkedTypefaceSpecification class instance to work with*/
+ CLinkedTypefaceSpecification* iSpec;
+ };
+
+#endif /* __T_DATA_LINKED_TYPEFACE_SPECIFICATION_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/inc/T_DataOpenFontGlyphData.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataOpenFontGlyphData
+*/
+
+#if (!defined __T_DATA_OPEN_FONT_GLYPH_DATA_H__)
+#define __T_DATA_OPEN_FONT_GLYPH_DATA_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <openfont.h>
+
+class CT_DataOpenFontGlyphData : public CDataWrapperBase
+ {
+public:
+ CT_DataOpenFontGlyphData();
+ ~CT_DataOpenFontGlyphData();
+
+ static CT_DataOpenFontGlyphData* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aObject);
+ virtual void DisownObjectL();
+ void DestroyData();
+
+private:
+ void ConstructL();
+
+ void DoCmdNew(const TDesC& aSection);
+ void DoCmdDestructor();
+
+private:
+ /** TOpenFontGlyphData class instance to work with*/
+ TOpenFontGlyphData* iGlyphData;
+ };
+
+#endif /* __T_DATA_OPEN_FONT_GLYPH_DATA_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/inc/T_DataOpenFontRasterizerContext.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataOpenFontRasterizerContext
+*/
+
+#if (!defined __T_DATA_OPEN_FONT_RASTERIZER_CONTEXT_H__)
+#define __T_DATA_OPEN_FONT_RASTERIZER_CONTEXT_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <openfont.h>
+
+class CT_DataOpenFontRasterizerContext : public CDataWrapperBase
+ {
+public:
+ CT_DataOpenFontRasterizerContext();
+ ~CT_DataOpenFontRasterizerContext();
+
+ static CT_DataOpenFontRasterizerContext* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aObject);
+ virtual void DisownObjectL();
+ void DestroyData();
+
+private:
+ void ConstructL();
+
+ void DoCmdNew();
+ void DoCmdEndGlyph();
+ void DoCmdStartGlyphL(const TDesC& aSection);
+ void DoCmdWriteGlyphBit(const TDesC& aSection);
+ void DoCmdWriteGlyphByte(const TDesC& aSection);
+ void DoCmdDestructor();
+
+private:
+ /** COpenFontRasterizerContext class instance to work with*/
+ COpenFontRasterizerContext* iRasterizerContext;
+ };
+
+#endif /* __T_DATA_OPEN_FONT_RASTERIZER_CONTEXT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/inc/T_GraphicsFntstoreAPIServer.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_FNTSTORE_API_SERVER_H__)
+#define __T_GRAPHICS_FNTSTORE_API_SERVER_H__
+
+// User Include
+#include "TestServerBase.h"
+
+class CT_GraphicsFntstoreAPIServer : public CTestServerBase
+ {
+private:
+ class CT_GraphicsFntstoreAPIBlock : public CTestBlockController
+ {
+ public:
+ inline CT_GraphicsFntstoreAPIBlock();
+ inline ~CT_GraphicsFntstoreAPIBlock();
+
+ CDataWrapper* CreateDataL(const TDesC& aData);
+ };
+
+public:
+ inline CT_GraphicsFntstoreAPIServer();
+ inline ~CT_GraphicsFntstoreAPIServer();
+
+ static CT_GraphicsFntstoreAPIServer* NewL();
+
+ inline CTestBlockController* CreateTestBlock();
+ };
+
+#include "T_GraphicsFntstoreAPIServer.inl"
+
+#endif /* __T_GRAPHICS_FNTSTORE_API_SERVER_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/inc/T_GraphicsFntstoreAPIServer.inl Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_GraphicsFntstoreAPIServer inline functions
+*/
+
+
+/*@{*/
+/*@}*/
+
+inline CT_GraphicsFntstoreAPIServer::CT_GraphicsFntstoreAPIBlock::CT_GraphicsFntstoreAPIBlock()
+ {
+ }
+
+inline CT_GraphicsFntstoreAPIServer::CT_GraphicsFntstoreAPIBlock::~CT_GraphicsFntstoreAPIBlock()
+ {
+ }
+
+inline CT_GraphicsFntstoreAPIServer::CT_GraphicsFntstoreAPIServer()
+ {
+ }
+
+inline CT_GraphicsFntstoreAPIServer::~CT_GraphicsFntstoreAPIServer()
+ {
+ }
+
+inline CTestBlockController* CT_GraphicsFntstoreAPIServer::CreateTestBlock()
+ {
+ return new CT_GraphicsFntstoreAPIBlock();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/inc/T_TestOpenFont.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,106 @@
+// Copyright (c) 2007-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Creates a dummy rasterizer and a dummy shaper for FontStore APIs testing.
+//
+//
+
+#ifndef __T_TESTOPENFONT_H__
+#define __T_TESTOPENFONT_H__
+
+#include <fntstore.h>
+#include <openfont.h>
+#include <e32base.h>
+
+_LIT(KTestFont1, "dummy");
+_LIT(KTestFont2, "dummy_2");
+
+
+class CTestRasterizer : public COpenFontRasterizer
+ {
+public:
+ static CTestRasterizer* NewL();
+ COpenFontFile* NewFontFileL(TInt aUid, const TDesC& aFileName, RFs& aFileSession);
+ };
+
+
+class CTestFontFile: public COpenFontFile
+ {
+public:
+ static CTestFontFile* NewL(TInt aUid,const TDesC& aFileName);
+
+ TBool GetNearestFontHelper(const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
+ TInt& aFaceIndex, TOpenFontSpec& aActualFontSpec) const;
+ void GetNearestFontInPixelsL(RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList,
+ const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
+ COpenFont*& aFont,TOpenFontSpec& aActualFontSpec);
+ void GetNearestFontToDesignHeightInPixelsL(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,
+ const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight,
+ COpenFont*& aFont,TOpenFontSpec& aActualFontSpec);
+ void GetNearestFontToMaxHeightInPixelsL(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,
+ const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight,
+ COpenFont*& aFont,TOpenFontSpec& aActualFontSpec, TInt aMaxHeight);
+ virtual TBool HasUnicodeCharacterL(TInt aFaceIndex,TInt aCode) const;
+
+private:
+ CTestFontFile(TInt aUid,const TDesC& aFileName);
+ void ConstructL();
+ };
+
+
+class CTestFont: public COpenFont
+ {
+public:
+ static CTestFont* NewL(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,CTestFontFile* aFontFile,TInt aSizeInPixels);
+private:
+ CTestFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,CTestFontFile* aFontFile,TInt aSizeInPixels);
+ virtual void RasterizeL(TInt aCode,TOpenFontGlyphData* aGlyphData);
+ };
+
+
+class CTestShaperFactory: public CShaperFactory
+ {
+public:
+ static CTestShaperFactory* NewL();
+ virtual ~CTestShaperFactory();
+ virtual CShaper* NewShaperL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap);
+
+private:
+ CTestShaperFactory();
+ };
+
+
+class CTestShaper : public CShaper
+ {
+public:
+
+ static CShaper* NewL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap);
+ ~CTestShaper();
+ virtual TInt ShapeText(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput);
+
+private:
+ CTestShaper();
+ TInt ConstructL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* iHeap);
+ TInt TestShapeTextL(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput);
+
+private:
+ RHeap* iClientHeap;
+ RHeap* iHeap;
+ TAny* iHeapMemory;
+ TInt32* iGlyphs;
+ TInt32* iIndices;
+ TInt32* iPositions;
+ };
+
+#endif // __T_TESTOPENFONT_H__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/src/T_DataAlgStyle.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataAlgStyle
+*/
+
+#include "T_DataAlgStyle.h"
+
+
+/*@{*/
+/// Parameters
+_LIT(KFactor, "factor");
+
+/// Commands
+_LIT(KCmdNew, "new");
+_LIT(KCmdSetWidthFactor, "SetWidthFactor");
+_LIT(KCmdSetHeightFactor, "SetHeightFactor");
+_LIT(KCleanup, "~");
+
+/*@}*/
+
+
+/**
+* Two phase constructor
+*/
+CT_DataAlgStyle* CT_DataAlgStyle::NewL()
+ {
+ CT_DataAlgStyle* ret = new (ELeave) CT_DataAlgStyle();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataAlgStyle::CT_DataAlgStyle()
+: CDataWrapperBase()
+, iAlgStyle(NULL)
+ {
+ }
+
+
+/**
+* Protected second phase construction
+*/
+void CT_DataAlgStyle::ConstructL()
+ {
+ }
+
+
+/**
+* Destructor.
+*/
+CT_DataAlgStyle::~CT_DataAlgStyle()
+ {
+ DestroyData();
+ }
+
+
+/**
+* cleanup implementation.
+*/
+void CT_DataAlgStyle::DestroyData()
+ {
+ delete iAlgStyle;
+ iAlgStyle = NULL;
+ }
+
+TAny* CT_DataAlgStyle::GetObject()
+ {
+ return iAlgStyle;
+ }
+
+void CT_DataAlgStyle::SetObjectL(TAny* aObject)
+ {
+ DestroyData();
+ iAlgStyle = static_cast<TAlgStyle*> (aObject);
+ }
+
+void CT_DataAlgStyle::DisownObjectL()
+ {
+ iAlgStyle = NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataAlgStyle::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNew)
+ {
+ DoCmdNew();
+ }
+ else if (aCommand == KCmdSetWidthFactor)
+ {
+ DoCmdSetWidthFactor(aSection);
+ }
+ else if (aCommand == KCmdSetHeightFactor)
+ {
+ DoCmdSetHeightFactor(aSection);
+ }
+ else if (aCommand == KCleanup)
+ {
+ DestroyData();
+ }
+ else
+ {
+ retVal=EFalse;
+ }
+
+ return retVal;
+ }
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** Creates an instance of TAlgSAtyle structure */
+void CT_DataAlgStyle::DoCmdNew()
+ {
+ INFO_PRINTF1(_L("Creates an instance of TAlgSAtyle structure"));
+
+ // cleanup if any
+ DestroyData();
+
+ // call new operator
+ TRAPD(err, iAlgStyle = new (ELeave) TAlgStyle());
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Error creating an instance: %d"), err);
+ SetError(err);
+ }
+ }
+
+
+/** Calls TAlgSAtyle::SetWidthFactor() */
+void CT_DataAlgStyle::DoCmdSetWidthFactor(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls TAlgSAtyle::SetWidthFactor()"));
+ // get factor from parameters
+ TInt factor;
+ if (!GetIntFromConfig(aSection, KFactor(), factor) )
+ {
+ ERR_PRINTF2(_L("No %S"), &KFactor());
+ SetBlockResult(EFail);
+ }
+
+ // call SetWidthFactor()
+ iAlgStyle->SetWidthFactor(factor);
+ }
+
+
+/** Calls TAlgSAtyle::SetWidthFactor() */
+void CT_DataAlgStyle::DoCmdSetHeightFactor(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls TAlgSAtyle::SetHeightFactor()"));
+
+ // get factor from parameters
+ TInt factor;
+ if (!GetIntFromConfig(aSection, KFactor(), factor) )
+ {
+ ERR_PRINTF2(_L("No %S"), &KFactor());
+ SetBlockResult(EFail);
+ }
+
+ // call SetHeightFactor()
+ iAlgStyle->SetHeightFactor(factor);
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/src/T_DataBitmapFont.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,911 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataBitmapFont
+*/
+
+#include "T_DataBitmapFont.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Parameters
+_LIT(KFldExpected, "expected");
+_LIT(KFldCode, "code");
+_LIT(KFldIsNull, "isnull");
+_LIT(KFldSessHandle, "handle");
+_LIT(KFldGlyphBitmapType, "glyphtype");
+
+_LIT(KFldCharMetrics, "charmetrics");
+_LIT(KFldOFCharMetrics, "ofcharmetrics");
+_LIT(KFldOFFaceAttrib, "offaceattrib");
+_LIT(KFldOFMetrics, "ofmetrics");
+
+
+/// Commands
+_LIT(KCmdBitmapEncoding, "BitmapEncoding");
+_LIT(KCmdCharacterMetrics, "CharacterMetrics");
+_LIT(KCmdCharacterNeedsToBeRasterized, "CharacterNeedsToBeRasterized");
+_LIT(KCmdGetCharacterData, "GetCharacterData");
+_LIT(KCmdGetFaceAttrib, "GetFaceAttrib");
+_LIT(KCmdGetFontMetrics, "GetFontMetrics");
+_LIT(KCmdGlyphBitmapType, "GlyphBitmapType");
+_LIT(KCmdHasCharacterL, "HasCharacterL");
+_LIT(KCmdIsOpenFont, "IsOpenFont");
+_LIT(KCmdOpenFont, "OpenFont");
+_LIT(KCmdRasterize, "Rasterize");
+//_LIT(KCmdUniqueFontId, "UniqueFontId");
+
+/// Constant Literals
+_LIT(KTagCharMetricsAscent, "ascent");
+_LIT(KTagCharMetricsHeight, "height");
+_LIT(KTagCharMetricsMove, "move");
+_LIT(KTagCharMetricsLeftAdjust, "leftadjust");
+_LIT(KTagCharMetricsRightAdjust, "rightadjust");
+
+_LIT(KTagOFCharMetricsHeight, "height");
+_LIT(KTagOFCharMetricsWidth, "width");
+
+_LIT(KTagOFFaceAttribFamilyName, "familyname");
+_LIT(KTagOFFaceAttribMinSize, "minsize");
+
+_LIT(KTagOFMetricsMaxHeight, "maxheight");
+_LIT(KTagOFMetricsSize, "size");
+
+_LIT(KFormatEntryField, "%S_%S");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogMissingExpectedValue, "Missing expected value '%S'");
+_LIT(KLogNotExpectedValueInt, "'%S' is not as expected=%d, actual=%d");
+_LIT(KLogNotExpectedValueString, "'%S' is not as expected='%S', actual='%S'");
+
+/*@}*/
+
+
+/**
+* Two phase constructor
+*/
+CT_DataBitmapFont* CT_DataBitmapFont::NewL()
+ {
+ CT_DataBitmapFont* ret = new (ELeave) CT_DataBitmapFont();
+ return ret;
+ }
+
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataBitmapFont::CT_DataBitmapFont()
+: CT_DataFont(), iBitmapFont(NULL)
+ {
+ }
+
+TAny* CT_DataBitmapFont::GetObject()
+ {
+ return iBitmapFont;
+ }
+
+void CT_DataBitmapFont::SetObjectL(TAny* aObject)
+ {
+ iBitmapFont = static_cast<CBitmapFont*> (aObject);
+ }
+
+void CT_DataBitmapFont::DisownObjectL()
+ {
+ iBitmapFont = NULL;
+ }
+
+CFont* CT_DataBitmapFont::GetFont() const
+ {
+ return iBitmapFont;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataBitmapFont::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if (aCommand == KCmdBitmapEncoding)
+ {
+ DoCmdBitmapEncoding(aSection);
+ }
+ else if (aCommand == KCmdCharacterMetrics)
+ {
+ DoCmdCharacterMetrics(aSection);
+ }
+ else if (aCommand == KCmdCharacterNeedsToBeRasterized)
+ {
+ DoCmdCharacterNeedsToBeRasterized(aSection);
+ }
+ else if (aCommand == KCmdGetCharacterData)
+ {
+ DoCmdGetCharacterData(aSection);
+ }
+ else if (aCommand == KCmdGetFaceAttrib)
+ {
+ DoCmdGetFaceAttrib(aSection);
+ }
+ else if (aCommand == KCmdGetFontMetrics)
+ {
+ DoCmdGetFontMetrics(aSection);
+ }
+ else if (aCommand == KCmdGlyphBitmapType)
+ {
+ DoCmdGlyphBitmapType(aSection);
+ }
+ else if (aCommand == KCmdHasCharacterL)
+ {
+ DoCmdHasCharacterL(aSection);
+ }
+ else if (aCommand == KCmdIsOpenFont)
+ {
+ DoCmdIsOpenFont(aSection);
+ }
+ else if (aCommand == KCmdOpenFont)
+ {
+ DoCmdOpenFont(aSection);
+ }
+ else if (aCommand == KCmdRasterize)
+ {
+ DoCmdRasterize(aSection);
+ }
+// else if (aCommand == KCmdUniqueFontId)
+// {
+// DoCmdUniqueFontId(aSection);
+// }
+ else
+ {
+ ret = CT_DataFont::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** Calls CBitmapFont::DoCmdBitmapEncoding() */
+void CT_DataBitmapFont::DoCmdBitmapEncoding(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::BitmapEncoding()"));
+ TInt ret = iBitmapFont->BitmapEncoding();
+ INFO_PRINTF2(_L("The actual bitmap encoding value is %d"), ret);
+
+ TInt expected;
+ if( GetIntFromConfig(aSection, KFldExpected, expected) )
+ {
+ if (ret != expected)
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, ret, expected);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataBitmapFont::DoCmdCharacterMetrics(const TDesC& aSection)
+ {
+ TInt code;
+ if( !GetIntFromConfig(aSection, KFldCode, code) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldCode);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::CharacterMetrics(TInt, const TUint8*&)"));
+ TCharacterMetrics metrics;
+ const TUint8* ptr;
+ metrics= iBitmapFont->CharacterMetrics(code, ptr);
+ TBool failed = EFalse;
+
+ TBool isNull;
+ if( GetBoolFromConfig(aSection, KFldIsNull, isNull) )
+ {
+ if(isNull)
+ {
+ if(ptr != NULL)
+ {
+ ERR_PRINTF1(_L("Should return a NULL pointer") );
+ failed = ETrue;
+ }
+ else
+ {
+ INFO_PRINTF1(_L("A NULL pointer is returned"));
+
+ }
+ }
+ else
+ {
+ if(ptr == NULL)
+ {
+ ERR_PRINTF1(_L("Should return a pointer to the character bitmap") );
+ failed = ETrue;
+ }
+ else
+ {
+ INFO_PRINTF1(_L("A pointer to the character bitmap is returned") );
+ }
+ }
+ }
+
+ TCharacterMetrics expected;
+ if( GetCharacterMetricsFromConfig(*this, aSection, KFldCharMetrics, expected) )
+ {
+ if(metrics.iAscentInPixels != expected.iAscentInPixels)
+ {
+
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KTagCharMetricsAscent, expected.iAscentInPixels, metrics.iAscentInPixels);
+ failed = ETrue;
+ }
+ if(metrics.iHeightInPixels != expected.iHeightInPixels)
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KTagCharMetricsHeight, expected.iHeightInPixels, metrics.iHeightInPixels);
+ failed = ETrue;
+ }
+ if(metrics.iMoveInPixels != expected.iMoveInPixels)
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KTagCharMetricsMove, expected.iMoveInPixels, metrics.iMoveInPixels);
+ failed = ETrue;
+ }
+ if(metrics.iLeftAdjustInPixels != expected.iLeftAdjustInPixels)
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KTagCharMetricsLeftAdjust, expected.iLeftAdjustInPixels, metrics.iLeftAdjustInPixels);
+ failed = ETrue;
+ }
+ if(metrics.iRightAdjustInPixels != expected.iRightAdjustInPixels)
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KTagCharMetricsRightAdjust, expected.iRightAdjustInPixels, metrics.iRightAdjustInPixels);
+ failed = ETrue;
+ }
+ }
+
+ if(failed)
+ {
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Character metrics is expected."));
+ }
+ }
+ }
+
+void CT_DataBitmapFont::CT_DataBitmapFont::DoCmdCharacterNeedsToBeRasterized(const TDesC& aSection)
+ {
+ TBool dataOK = ETrue;
+
+ TInt handle;
+ if( !GetIntFromConfig(aSection, KFldSessHandle, handle) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSessHandle);
+ dataOK = EFalse;
+ }
+
+ TInt code;
+ if( !GetIntFromConfig(aSection, KFldCode, code) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldCode);
+ dataOK = EFalse;
+ }
+
+ if(!dataOK)
+ {
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::CharacterNeedsToBeRasterized(TInt, TInt)"));
+ TBool ret = iBitmapFont->CharacterNeedsToBeRasterized(handle, code);
+
+ TBool expected;
+ if( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if(ret)
+ {
+ if(!expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: EFalse, actual: ETrue"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is ETrue"));
+ }
+ }
+ else
+ {
+ if(expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: ETrue, actual: EFalse"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is EFalse"));
+ }
+ }
+ }
+ }
+ }
+
+
+void CT_DataBitmapFont::DoCmdGetCharacterData(const TDesC& aSection)
+ {
+ TBool dataOK = ETrue;
+
+ TInt handle;
+ if( !GetIntFromConfig(aSection, KFldSessHandle, handle) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSessHandle);
+ dataOK = EFalse;
+ }
+
+ TInt code;
+ if( !GetIntFromConfig(aSection, KFldCode, code) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldCode);
+ dataOK = EFalse;
+ }
+
+ if(!dataOK)
+ {
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::GetCharacterData(TInt aSessionHandle, TInt aCode, TOpenFontCharMetrics &aMetrics, const TUint8 *&aBitmap)"));
+ TOpenFontCharMetrics metrics;
+ const TUint8* ptr;
+ TBool ret = iBitmapFont->GetCharacterData(handle, code, metrics, ptr);
+
+ TBool expected;
+ if( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if(ret)
+ {
+ if(!expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: EFalse, actual: ETrue"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is ETrue"));
+
+ TBool isNull;
+ if( GetBoolFromConfig(aSection, KFldIsNull, isNull) )
+ {
+ if(isNull)
+ {
+ if(ptr != NULL)
+ {
+ ERR_PRINTF1(_L("Should return a NULL pointer") );
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("A NULL pointer is returned") );
+ }
+ }
+ else
+ {
+ if(ptr == NULL)
+ {
+ ERR_PRINTF1(_L("Should return a pointer to the character bitmap.") );
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("a pointer to the character bitmap is returned") );
+ }
+ }
+ }
+
+ TBool failed = EFalse;
+ TOpenFontCharMetrics expectedMetrics;
+ if( GetOpenFontCharMetricsFromConfig(*this, aSection, KFldOFCharMetrics, expectedMetrics) )
+ {
+ if(metrics.Width() != expectedMetrics.Width())
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KTagOFCharMetricsWidth, metrics.Width(), expectedMetrics.Width());
+ failed = ETrue;
+ }
+ if(metrics.Height() != expectedMetrics.Height())
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KTagOFCharMetricsHeight, metrics.Height(), expectedMetrics.Height());
+ failed = ETrue;
+ }
+
+ if(failed)
+ {
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Open font character metrics is expected"));
+ }
+ }
+ }
+ }
+ else
+ {
+ if(expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: ETrue, actual: EFalse"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is EFalse"));
+ }
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapFont::DoCmdGetFaceAttrib(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::GetFaceAttrib(TOpenFontFaceAttrib&)"));
+ TOpenFontFaceAttrib attrib;
+ TBool ret = iBitmapFont->GetFaceAttrib(attrib);
+
+ TBool expected;
+ if( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if(ret)
+ {
+ if(!expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: EFalse, actual: ETrue"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is ETrue"));
+ TBool failed = EFalse;
+ TOpenFontFaceAttrib expectedAttrib;
+ if( GetOpenFontFaceAttribFromConfig(*this, aSection, KFldOFFaceAttrib, expectedAttrib) )
+ {
+ TPtrC actualName = attrib.FamilyName();
+ TPtrC expectedName = expectedAttrib.FamilyName();
+ if(actualName != expectedName)
+ {
+ ERR_PRINTF4(KLogNotExpectedValueString, &KTagOFFaceAttribFamilyName, &expectedName, &actualName);
+ failed = ETrue;
+ }
+ if(attrib.MinSizeInPixels() != expectedAttrib.MinSizeInPixels())
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KTagOFFaceAttribMinSize, expectedAttrib.MinSizeInPixels(), attrib.MinSizeInPixels());
+ failed = ETrue;
+ }
+
+ if(failed)
+ {
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Open font typeface attributes is expected"));
+ }
+ }
+ }
+ }
+ else
+ {
+ if(expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: ETrue, actual: EFalse"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is EFalse"));
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapFont::DoCmdGetFontMetrics(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::GetFontMetrics(TOpenFontMetrics&)"));
+ TOpenFontMetrics metrics;
+ iBitmapFont->GetFontMetrics(metrics);
+
+ TOpenFontMetrics expectedMetrics;
+ if( GetOpenFontMetricsFromConfig(*this, aSection, KFldOFMetrics, expectedMetrics) )
+ {
+ TBool failed = EFalse;
+ if(metrics.MaxHeight() != expectedMetrics.MaxHeight())
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KTagOFMetricsMaxHeight, expectedMetrics.MaxHeight(), metrics.MaxHeight());
+ failed = ETrue;
+ }
+ if(metrics.Size() != expectedMetrics.Size())
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KTagOFMetricsSize, expectedMetrics.Size(), metrics.Size());
+ failed = ETrue;
+ }
+
+ if(failed)
+ {
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Open font metrics is expected"));
+ }
+ }
+ }
+
+void CT_DataBitmapFont::DoCmdGlyphBitmapType(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::GlyphBitmapType()"));
+ TGlyphBitmapType ret = iBitmapFont->GlyphBitmapType();
+ INFO_PRINTF2(_L("Glyph bitmap type is %d."), (TInt)ret);
+
+ TGlyphBitmapType expected;
+ if( CT_GraphicsUtil::ReadGlyphBitmapType(*this, aSection, KFldGlyphBitmapType(), expected) )
+ {
+ if(ret != expected)
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, (TInt)ret, (TInt)expected);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataBitmapFont::DoCmdHasCharacterL(const TDesC& aSection)
+ {
+ TInt code;
+ if( !GetIntFromConfig(aSection, KFldCode, code) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldCode);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::HasCharacterL(TInt)"));
+ TBool ret = iBitmapFont->HasCharacterL(code);
+
+ TBool expected;
+ if( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if(ret)
+ {
+ if(!expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: EFalse, actual: ETrue"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is ETrue"));
+ }
+ }
+ else
+ {
+ if(expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: ETrue, actual: EFalse"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is EFalse"));
+ }
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapFont::DoCmdIsOpenFont(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::IsOpenFont()"));
+ TBool ret = iBitmapFont->IsOpenFont();
+
+ TBool expected;
+ if( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if(ret)
+ {
+ if(!expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: EFalse, actual: ETrue"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is ETrue"));
+ }
+ }
+ else
+ {
+ if(expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: ETrue, actual: EFalse"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is EFalse"));
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapFont::DoCmdOpenFont(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::OpenFont()"));
+ COpenFont* ptr = iBitmapFont->OpenFont();
+
+ TBool isNull;
+ if( GetBoolFromConfig(aSection, KFldIsNull, isNull) )
+ {
+ if(isNull)
+ {
+ if(ptr != NULL)
+ {
+ ERR_PRINTF1(_L("Should return a NULL pointer") );
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("A NULL pointer is returned") );
+ }
+ }
+ else
+ {
+ if(ptr == NULL)
+ {
+ ERR_PRINTF1(_L("Should return a pointer to COpenFont") );
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("A pointer to COpenFont is returned") );
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapFont::DoCmdRasterize(const TDesC& aSection)
+ {
+ TBool dataOK = ETrue;
+
+ TInt handle;
+ if( !GetIntFromConfig(aSection, KFldSessHandle, handle) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSessHandle);
+ dataOK = EFalse;
+ }
+
+ TInt code;
+ if( !GetIntFromConfig(aSection, KFldCode, code) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldCode);
+ dataOK = EFalse;
+ }
+
+ if(!dataOK)
+ {
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Calls CBitmapFont::Rasterize(TInt, TInt, TOpenFontGlyphData*)"));
+ TOpenFontGlyphData* ptr = NULL;
+ TBool ret = iBitmapFont->Rasterize(handle, code, ptr);
+
+ TBool expected;
+ if( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if(ret)
+ {
+ if(!expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: EFalse, actual: ETrue"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // The character was successfully rasterized.
+ INFO_PRINTF1(_L("Return value is ETrue"));
+ TBool isNull;
+ if( GetBoolFromConfig(aSection, KFldIsNull, isNull) )
+ {
+ if(isNull)
+ {
+ if(ptr != NULL)
+ {
+ ERR_PRINTF1(_L("Should return a NULL pointer") );
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("A NULL pointer is returned"));
+ }
+ }
+ else
+ {
+ if(ptr == NULL)
+ {
+ ERR_PRINTF1(_L("Should return a pointer to TOpenFontGlyphData") );
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("A pointer to TOpenFontGlyphData is returned"));
+ }
+ }
+ }
+ }
+ }
+ // ret = EFalse
+ else
+ {
+ if(expected)
+ {
+ ERR_PRINTF1(_L("Return value is not as expected: ETrue, actual: EFalse"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Return value is EFalse"));
+ }
+ }
+ }
+ }
+ }
+
+//void CT_DataBitmapFont::DoCmdUniqueFontId(const TDesC& aSection)
+// {
+// INFO_PRINTF1(_L("Calls CBitmapFont::UniqueFontId()"));
+// TUint32 ret = iBitmapFont->UniqueFontId();
+// INFO_PRINTF2(_L("Unique font id is %d"), (TInt)ret);
+//
+// TInt temp;
+// if( GetIntFromConfig(aSection, KFldExpected, temp) )
+// {
+// TUint32 expected = (TUint32)temp;
+// if(ret != expected)
+// {
+// ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, ret, expected);
+// SetBlockResult(EFail);
+// }
+// }
+// }
+
+TBool CT_DataBitmapFont::GetCharacterMetricsFromConfig(CDataWrapper& aDataWrapper, const TDesC& aSectName, const TDesC& aKeyName, TCharacterMetrics& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ TInt temp;
+ TBool ret = EFalse;
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagCharMetricsAscent);
+ if( aDataWrapper.GetIntFromConfig(aSectName, tempStore, temp) )
+ {
+ aResult.iAscentInPixels = temp;
+ ret = ETrue;
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagCharMetricsHeight);
+ if( aDataWrapper.GetIntFromConfig(aSectName, tempStore, temp) )
+ {
+ aResult.iHeightInPixels = temp;
+ ret = ETrue;
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagCharMetricsLeftAdjust);
+ if( aDataWrapper.GetIntFromConfig(aSectName, tempStore, temp) )
+ {
+ aResult.iLeftAdjustInPixels = temp;
+ ret = ETrue;
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagCharMetricsMove);
+ if( aDataWrapper.GetIntFromConfig(aSectName, tempStore, temp) )
+ {
+ aResult.iMoveInPixels = temp;
+ ret = ETrue;
+ }
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagCharMetricsRightAdjust);
+ if( aDataWrapper.GetIntFromConfig(aSectName, tempStore, temp) )
+ {
+ aResult.iRightAdjustInPixels = temp;
+ ret = ETrue;
+ }
+
+ return ret;
+ }
+
+
+TBool CT_DataBitmapFont::GetOpenFontCharMetricsFromConfig(CDataWrapperBase& aDataWrapper,const TDesC& aSectName,const TDesC& aKeyName,TOpenFontCharMetrics& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ TInt width;
+ TInt height;
+
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagOFCharMetricsWidth);
+ if( aDataWrapper.GetIntFromConfig(aSectName, tempStore, width) )
+ {
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagOFCharMetricsHeight);
+ if( aDataWrapper.GetIntFromConfig(aSectName, tempStore, height) )
+ {
+ aResult.SetHeight(height);
+ aResult.SetWidth(width);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+ }
+
+TBool CT_DataBitmapFont::GetOpenFontFaceAttribFromConfig(CDataWrapper& aDataWrapper,const TDesC& aSectName,const TDesC& aKeyName,TOpenFontFaceAttrib& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagOFFaceAttribFamilyName);
+
+ TPtrC familyname;
+ TInt minsize;
+ if( aDataWrapper.GetStringFromConfig(aSectName, tempStore, familyname) )
+ {
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagOFFaceAttribMinSize);
+ if( aDataWrapper.GetIntFromConfig(aSectName, tempStore, minsize) )
+ {
+ aResult.SetFamilyName(familyname);
+ aResult.SetMinSizeInPixels(minsize);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+ }
+
+TBool CT_DataBitmapFont::GetOpenFontMetricsFromConfig(CDataWrapper& aDataWrapper,const TDesC& aSectName, const TDesC& aKeyName, TOpenFontMetrics& aResult)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagOFMetricsMaxHeight);
+
+ TInt maxheight;
+ TInt size;
+ if( aDataWrapper.GetIntFromConfig(aSectName, tempStore, maxheight) )
+ {
+ tempStore.Format(KFormatEntryField, &aKeyName, &KTagOFMetricsSize);
+ if( aDataWrapper.GetIntFromConfig(aSectName, tempStore, size) )
+ {
+ aResult.SetMaxHeight(maxheight);
+ aResult.SetSize(size);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/src/T_DataFontStore.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,763 @@
+/*
+ * Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+/**
+ @test
+ @internalComponent
+
+ This contains CT_DataFontStore
+ */
+#include "T_DataFontStore.h"
+#include "T_GraphicsUtil.h"
+#include "T_TestOpenFont.h"
+
+/*@{*/
+/// Parameters
+_LIT(KFldTypefaceName, "typefacename");
+_LIT(KFldHeapSize, "heapsize");
+_LIT(KFldFontFile, "fontfile");
+_LIT(KFldId, "id");
+_LIT(KFldExpectedGlyphBitmapType, "expected_bmptype");
+_LIT(KFldGlyphBitmapType, "bmptype");
+_LIT(KFldSessionHandle, "sessionhandle");
+_LIT(KFldTypefaceIndex, "typeface_index");
+_LIT(KFldHeightIndex, "height_index");
+_LIT(KFldExpectedHeight, "expected_height");
+_LIT(KFldFontUid, "fontuid");
+_LIT(KFldAlgStyle, "alg_style");
+_LIT(KFldFont, "font");
+_LIT(KFldOpenFont, "openfont");
+_LIT(KFldMaxHeight, "maxheight");
+_LIT(KFldUseTestClass, "usetestclass");
+_LIT(KFldRasterizer, "rasterizer");
+_LIT(KFldShaperFactory, "shaperfactory");
+
+/// Commands
+_LIT(KCmdNewL, "NewL");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdAddFileL, "AddFileL");
+_LIT(KCmdRemoveFile, "RemoveFile");
+_LIT(KCmdDefaultBitmapType, "DefaultBitmapType");
+_LIT(KCmdDeleteSessionCache, "DeleteSessionCache");
+_LIT(KCmdFontHeightInPixels, "FontHeightInPixels");
+_LIT(KCmdGetFontById, "GetFontById");
+_LIT(KCmdGetNearestFontToDesignHeightInPixels, "GetNearestFontToDesignHeightInPixels");
+_LIT(KCmdGetNearestFontToDesignHeightInTwips, "GetNearestFontToDesignHeightInTwips");
+_LIT(KCmdGetNearestFontToMaxHeightInPixels, "GetNearestFontToMaxHeightInPixels");
+_LIT(KCmdGetNearestFontToMaxHeightInTwips, "GetNearestFontToMaxHeightInTwips");
+_LIT(KCmdInstallRasterizerL, "InstallRasterizerL");
+_LIT(KCmdInstallShaperFactoryL, "InstallShaperFactoryL");
+_LIT(KCmdSetDefaultBitmapType, "SetDefaultBitmapType");
+
+/// Logs
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingFilename, "File '%S' not found in array");
+_LIT(KLogFontSpec, "font_spec or openfont_spec");
+/*@}*/
+
+/**
+ * Two phase constructor
+ */
+CT_DataFontStore* CT_DataFontStore::NewL()
+ {
+ CT_DataFontStore* ret = new (ELeave) CT_DataFontStore();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+/**
+ * Protected second phase construction
+ */
+void CT_DataFontStore::ConstructL()
+ {
+ }
+
+/**
+ * Protected constructor. First phase construction
+ */
+CT_DataFontStore::CT_DataFontStore() :
+ CT_DataTypefaceStore(), iFntStore(NULL)
+ {
+ }
+
+/**
+ * Destructor.
+ */
+CT_DataFontStore::~CT_DataFontStore()
+ {
+ DestroyData();
+ iFile.Reset();
+ iFile.Close();
+ iId.Reset();
+ iId.Close();
+ }
+
+/**
+ * cleanup implementation.
+ */
+void CT_DataFontStore::DestroyData()
+ {
+ delete iFntStore;
+ iFntStore = NULL;
+ }
+
+TAny* CT_DataFontStore::GetObject()
+ {
+ return iFntStore;
+ }
+
+void CT_DataFontStore::SetObjectL(TAny* aObject)
+ {
+ DestroyData();
+ iFntStore = static_cast<CFontStore*> (aObject);
+ }
+
+void CT_DataFontStore::DisownObjectL()
+ {
+ iFntStore = NULL;
+ }
+
+CTypefaceStore* CT_DataFontStore::GetTypefaceStore() const
+ {
+ return iFntStore;
+ }
+
+/**
+ * Process a command read from the ini file
+ *
+ * @param aDataWrapper test step requiring command to be processed
+ * @param aCommand the command to process
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return ETrue if the command is processed
+ */
+TBool CT_DataFontStore::DoCommandL(const TTEFFunction& aCommand,
+ const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNewL)
+ {
+ DoCmdNewL(aSection);
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DoCmdDestructor();
+ }
+ else if (aCommand == KCmdAddFileL)
+ {
+ DoCmdAddFileL(aSection);
+ }
+ else if (aCommand == KCmdRemoveFile)
+ {
+ DoCmdRemoveFile(aSection);
+ }
+ else if (aCommand == KCmdDefaultBitmapType)
+ {
+ DoCmdDefaultBitmapType(aSection);
+ }
+ else if (aCommand == KCmdDeleteSessionCache)
+ {
+ DoCmdDeleteSessionCache(aSection);
+ }
+ else if (aCommand == KCmdFontHeightInPixels)
+ {
+ DoCmdFontHeightInPixels(aSection);
+ }
+ else if (aCommand == KCmdGetFontById)
+ {
+ DoCmdGetFontByIdL(aSection);
+ }
+ else if (aCommand == KCmdGetNearestFontToDesignHeightInPixels)
+ {
+ DoCmdGetNearestFontToDesignHeightInPixelsL(aSection);
+ }
+ else if (aCommand == KCmdGetNearestFontToDesignHeightInTwips)
+ {
+ if (!DoCmdGetNearestFontToDesignHeightInTwipsL(aSection))
+ {
+ retVal = CT_DataTypefaceStore::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if (aCommand == KCmdGetNearestFontToMaxHeightInPixels)
+ {
+ DoCmdGetNearestFontToMaxHeightInPixelsL(aSection);
+ }
+ else if (aCommand == KCmdGetNearestFontToMaxHeightInTwips)
+ {
+ if (!DoCmdGetNearestFontToMaxHeightInTwipsL(aSection))
+ {
+ retVal = CT_DataTypefaceStore::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ }
+ else if (aCommand == KCmdInstallRasterizerL)
+ {
+ DoCmdInstallRasterizerL(aSection);
+ }
+ else if (aCommand == KCmdInstallShaperFactoryL)
+ {
+ DoCmdInstallShaperFactoryL(aSection);
+ }
+ else if (aCommand == KCmdSetDefaultBitmapType)
+ {
+ DoCmdSetDefaultBitmapType(aSection);
+ }
+ else
+ {
+ retVal = CT_DataTypefaceStore::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return retVal;
+ }
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** Creates an instance of CT_DataFontStore class */
+void CT_DataFontStore::DoCmdNewL(const TDesC& aSection)
+ {
+ // cleanup if any
+ DestroyData();
+
+ TInt heapsize;
+ TInt err;
+
+ INFO_PRINTF1(_L("execute CFontStore::NewL(RHeap*)"));
+ if (GetIntFromConfig(aSection, KFldHeapSize, heapsize))
+ {
+ RHeap* heap = NULL;
+ if (heapsize != 0)
+ {
+ heap = UserHeap::ChunkHeap(NULL, heapsize, heapsize);
+ }
+ TRAP(err, iFntStore = CFontStore::NewL(heap));
+ }
+ else
+ {
+ // Use heap of the thread.
+ TRAP(err, iFntStore = CFontStore::NewL(&User::Heap()));
+ }
+
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataFontStore::DoCmdDestructor()
+ {
+ // cleanup if any
+ DestroyData();
+ }
+
+void CT_DataFontStore::DoCmdAddFileL(const TDesC& aSection)
+ {
+ TPtrC name;
+
+ if (!GetStringFromConfig(aSection, KFldFontFile, name))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFontFile());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TUid id;
+
+ INFO_PRINTF1(_L("execute CFontStore::AddFileL(const TDesC&)"));
+ TRAPD(err, id = iFntStore->AddFileL(name));
+
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ iFile.AppendL(name);
+ iId.AppendL(id.iUid);
+ }
+ }
+ }
+
+TBool CT_DataFontStore::FindIdByName(const TDesC& aName, TInt& aId)
+ {
+ TBool found = EFalse;
+ for (TInt index = 0; index < iFile.Count(); ++index)
+ {
+ if (iFile[index] == aName)
+ {
+ aId = iId[index];
+ iFile.Remove(index);
+ iId.Remove(index);
+ found = ETrue;
+ break;
+ }
+ }
+ return found;
+ }
+
+void CT_DataFontStore::DoCmdRemoveFile(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+ TInt id;
+
+ // Get the uid
+ if (!GetIntFromConfig(aSection, KFldId(), id))
+ {
+ TPtrC file;
+
+ // No uid provided. Get file name instead.
+ if (!GetStringFromConfig(aSection, KFldFontFile(), file))
+ {
+ dataOk = EFalse;
+ }
+ else
+ {
+ // Get uid by file name.
+ if (!FindIdByName(file, id))
+ {
+ dataOk = EFalse;
+ }
+ }
+ }
+
+ if (dataOk)
+ {
+ INFO_PRINTF1(_L("execute CFontStore::RemoveFile(TUid)"));
+ iFntStore->RemoveFile(TUid::Uid(id));
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CFontStore::RemoveFile(TUid::Null())"));
+ iFntStore->RemoveFile(TUid::Null());
+ }
+ }
+
+void CT_DataFontStore::DoCmdDefaultBitmapType(const TDesC& aSection)
+ {
+ TGlyphBitmapType actual = iFntStore->DefaultBitmapType();
+ INFO_PRINTF2(_L("execute CFontStore::DefaultBitmapType() = %d"), actual);
+
+ TGlyphBitmapType expected;
+ if(CT_GraphicsUtil::ReadGlyphBitmapType(*this, aSection, KFldExpectedGlyphBitmapType(), expected))
+ {
+ if (actual != expected)
+ {
+ ERR_PRINTF3(_L("The expected result %d is not equal to the actual result %d!"), expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataFontStore::DoCmdDeleteSessionCache(const TDesC& aSection)
+ {
+ TInt handle;
+
+ if (!GetIntFromConfig(aSection, KFldSessionHandle, handle))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSessionHandle());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CFontStore::DeleteSessionCache(TInt)"));
+ iFntStore->DeleteSessionCache(handle);
+ }
+ }
+
+void CT_DataFontStore::DoCmdFontHeightInPixels(const TDesC& aSection)
+ {
+ TInt tfindex;
+ TInt heightindex;
+ TBool dataOk = ETrue;
+
+ if (!GetIntFromConfig(aSection, KFldTypefaceIndex, tfindex))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldTypefaceIndex());
+ SetBlockResult(EFail);
+ }
+
+ if (!GetIntFromConfig(aSection, KFldHeightIndex, heightindex))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldHeightIndex());
+ SetBlockResult(EFail);
+ }
+
+ if (dataOk)
+ {
+ TInt actual = iFntStore->FontHeightInPixels(tfindex, heightindex);
+ INFO_PRINTF2(_L("execute CFontStore::FontHeightInPixels(TInt, TInt) = %d"), actual);
+
+ TInt expected;
+ if (GetIntFromConfig(aSection, KFldExpectedHeight, expected))
+ {
+ if (expected != actual)
+ {
+ ERR_PRINTF3(_L("The expected result %d is not equal to the actual result %d!"), expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataFontStore::DoCmdGetFontByIdL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+ TAlgStyle* algStyle = NULL;
+ TPtrC wrapperName;
+ TInt fontUid;
+
+ // get font uid
+ if (!GetIntFromConfig(aSection, KFldFontUid(), fontUid))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFontUid());
+ SetBlockResult(EFail);
+ }
+ // get algorithmic style
+ if (!CT_GraphicsUtil::GetAlgStyleL(*this, aSection, KFldAlgStyle(), algStyle) && NULL == algStyle)
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldAlgStyle());
+ SetBlockResult(EFail);
+ }
+ if (!GetStringFromConfig(aSection, KFldFont, wrapperName))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ if (dataOk)
+ {
+ CFont* font = NULL;
+ INFO_PRINTF1(_L("execute CFontStore::GetFontById(CFont *&, TUid, const TAlgStyle&)"));
+ TInt err = iFntStore->GetFontById(font, TUid::Uid(fontUid), *algStyle);
+
+ if (KErrNone != err)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, font);
+ }
+ }
+ }
+
+void CT_DataFontStore::DoCmdGetNearestFontToDesignHeightInPixelsL(
+ const TDesC& aSection)
+ {
+ TPtrC wrapperName;
+
+ if (!GetStringFromConfig(aSection, KFldFont, wrapperName))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TFontSpec fontSpec;
+ TInt err;
+ CFont* font;
+ TBool fxnCalled = EFalse;
+
+ if (GetFontSpecFromConfig(aSection, KFldFont, fontSpec))
+ {
+ fxnCalled = ETrue;
+ INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToDesignHeightInPixels(CFont*&, const TFontSpec&)"));
+ err = iFntStore->GetNearestFontToDesignHeightInPixels(font, fontSpec);
+ }
+ else if (GetFontSpecFromConfig(aSection, KFldOpenFont, fontSpec))
+ {
+ fxnCalled = ETrue;
+ INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToDesignHeightInPixels(CFont*&, const TOpenFontSpec&)"));
+ err = iFntStore->GetNearestFontToDesignHeightInPixels(font, TOpenFontSpec(fontSpec));
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KLogFontSpec());
+ SetBlockResult(EFail);
+ }
+
+ if (fxnCalled)
+ {
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, font);
+ }
+ }
+ }
+ }
+
+TBool CT_DataFontStore::DoCmdGetNearestFontToDesignHeightInTwipsL(
+ const TDesC& aSection)
+ {
+ TPtrC wrapperName;
+
+ if (!GetStringFromConfig(aSection, KFldFont, wrapperName))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TFontSpec fontSpec;
+ TInt err;
+ CFont* font;
+
+ if (!GetFontSpecFromConfig(aSection, KFldOpenFont, fontSpec))
+ {
+ return EFalse;
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToDesignHeightInTwips(CFont*&, const TOpenFontSpec&)"));
+ err = iFntStore->GetNearestFontToDesignHeightInTwips(font, TOpenFontSpec(fontSpec));
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, font);
+ }
+ }
+ }
+ return ETrue;
+ }
+
+void CT_DataFontStore::DoCmdGetNearestFontToMaxHeightInPixelsL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+
+ TPtrC wrapperName;
+ if (!GetStringFromConfig(aSection, KFldFont, wrapperName))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TInt maxHeight;
+ if (!GetIntFromConfig(aSection, KFldMaxHeight, maxHeight))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldMaxHeight());
+ SetBlockResult(EFail);
+ }
+
+ if (dataOk)
+ {
+ TFontSpec fontSpec;
+ TInt err;
+ CFont* font;
+ TBool fxnCalled = EFalse;
+
+ if (GetFontSpecFromConfig(aSection, KFldFont, fontSpec))
+ {
+ fxnCalled = ETrue;
+ INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToMaxHeightInPixels(CFont*&, const TFontSpec&, TInt)"));
+ err = iFntStore->GetNearestFontToMaxHeightInPixels(font, fontSpec, maxHeight);
+ }
+ else if (GetFontSpecFromConfig(aSection, KFldOpenFont, fontSpec))
+ {
+ fxnCalled = ETrue;
+ INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToMaxHeightInPixels(CFont*&, const TOpenFontSpec&, TInt)"));
+ err = iFntStore->GetNearestFontToMaxHeightInPixels(font, TOpenFontSpec(fontSpec), maxHeight);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KLogFontSpec());
+ SetBlockResult(EFail);
+ }
+
+ if (fxnCalled)
+ {
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, font);
+ }
+ }
+ }
+ }
+
+TBool CT_DataFontStore::DoCmdGetNearestFontToMaxHeightInTwipsL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+ TPtrC wrapperName;
+ if (!GetStringFromConfig(aSection, KFldFont, wrapperName))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TInt maxHeight;
+ if (!GetIntFromConfig(aSection, KFldMaxHeight, maxHeight))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldMaxHeight());
+ SetBlockResult(EFail);
+ }
+
+ TFontSpec fontSpec;
+ if (!GetFontSpecFromConfig(aSection, KFldOpenFont, fontSpec))
+ {
+ return EFalse;
+ }
+
+ if (dataOk)
+ {
+ TInt err;
+ CFont* font;
+
+ INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToMaxHeightInTwips(CFont*&, const TOpenFontSpec&, TInt)"));
+ err = iFntStore->GetNearestFontToMaxHeightInTwips(font, TOpenFontSpec(fontSpec), maxHeight);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(wrapperName, font);
+ }
+ }
+ return ETrue;
+ }
+
+void CT_DataFontStore::DoCmdInstallRasterizerL(const TDesC& aSection)
+ {
+ COpenFontRasterizer* rasterizer = NULL;
+ TInt err;
+ TBool useDummy;
+
+ if (!GetBoolFromConfig(aSection, KFldUseTestClass, useDummy))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldUseTestClass());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if (useDummy)
+ {
+ TRAP(err, rasterizer = CTestRasterizer::NewL());
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ return;
+ }
+ }
+ else
+ {
+ CT_GraphicsUtil::GetRasterizerL(*this, aSection, KFldRasterizer, rasterizer);
+ }
+
+ if (rasterizer == NULL)
+ {
+ INFO_PRINTF1(_L("execute CFontStore::InstallRasterizerL(NULL)"));
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CFontStore::InstallRasterizerL(COpenFontRasterizer*)"));
+ }
+ TRAP(err, iFntStore->InstallRasterizerL(rasterizer));
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataFontStore::DoCmdInstallShaperFactoryL(const TDesC& aSection)
+ {
+ CShaperFactory* shaper = NULL;
+ TInt err;
+ TBool useDummy;
+
+ if (!GetBoolFromConfig(aSection, KFldUseTestClass, useDummy))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldUseTestClass());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if (useDummy)
+ {
+ TRAP(err, shaper = CTestShaperFactory::NewL());
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ return;
+ }
+ }
+ else
+ {
+ CT_GraphicsUtil::GetShaperFactoryL(*this, aSection, KFldShaperFactory, shaper);
+ }
+
+ if (shaper == NULL)
+ {
+ INFO_PRINTF1(_L("execute CFontStore::InstallShaperFactoryL(NULL)"));
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CFontStore::InstallShaperFactoryL(CShaperFactory*)"));
+ }
+ TRAP(err, iFntStore->InstallShaperFactoryL(shaper));
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataFontStore::DoCmdSetDefaultBitmapType(const TDesC& aSection)
+ {
+ TGlyphBitmapType bmptype;
+
+ if (!CT_GraphicsUtil::ReadGlyphBitmapType(*this, aSection, KFldGlyphBitmapType(), bmptype))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldGlyphBitmapType());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CFontStore::SetDefaultBitmapType(TGlyphBitmapType)"));
+ iFntStore->SetDefaultBitmapType(bmptype);
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/src/T_DataLinkedTypefaceSpecification.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataLinkedTypefaceSpecification
+*/
+
+#include "T_DataLinkedTypefaceSpecification.h"
+
+
+/*@{*/
+/// Parameters
+_LIT(KFldTypefaceName, "typefacename");
+
+/// Commands
+_LIT(KCmdNewL, "NewL");
+_LIT(KCmdDestructor, "~");
+
+/// Logs
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogError, "Error=%d");
+/*@}*/
+
+
+/**
+* Two phase constructor
+*/
+CT_DataLinkedTypefaceSpecification* CT_DataLinkedTypefaceSpecification::NewL()
+ {
+ CT_DataLinkedTypefaceSpecification* ret = new (ELeave) CT_DataLinkedTypefaceSpecification();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+/**
+* Protected second phase construction
+*/
+void CT_DataLinkedTypefaceSpecification::ConstructL()
+ {
+ }
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataLinkedTypefaceSpecification::CT_DataLinkedTypefaceSpecification()
+: CDataWrapperBase()
+, iSpec(NULL)
+ {
+ }
+
+/**
+* Destructor.
+*/
+CT_DataLinkedTypefaceSpecification::~CT_DataLinkedTypefaceSpecification()
+ {
+ DestroyData();
+ }
+
+
+/**
+* cleanup implementation.
+*/
+void CT_DataLinkedTypefaceSpecification::DestroyData()
+ {
+ delete iSpec;
+ iSpec = NULL;
+ }
+
+TAny* CT_DataLinkedTypefaceSpecification::GetObject()
+ {
+ return iSpec;
+ }
+
+void CT_DataLinkedTypefaceSpecification::SetObjectL(TAny* aObject)
+ {
+ DestroyData();
+ iSpec = static_cast<CLinkedTypefaceSpecification*> (aObject);
+ }
+
+void CT_DataLinkedTypefaceSpecification::DisownObjectL()
+ {
+ iSpec = NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataLinkedTypefaceSpecification::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNewL)
+ {
+ DoCmdNewL(aSection);
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DoCmdDestructor();
+ }
+ else
+ {
+ retVal=EFalse;
+ }
+
+ return retVal;
+ }
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** Creates an instance of CT_DataLinkedTypefaceSpecification class */
+void CT_DataLinkedTypefaceSpecification::DoCmdNewL(const TDesC& aSection)
+ {
+ // cleanup if any
+ DestroyData();
+
+ // call new operator
+ TPtrC name;
+ if (!GetStringFromConfig(aSection, KFldTypefaceName, name))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldTypefaceName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CLinkedTypefaceSpecification::NewLC"));
+ TRAPD(err, iSpec = CLinkedTypefaceSpecification::NewLC(name); CleanupStack::Pop(iSpec));
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataLinkedTypefaceSpecification::DoCmdDestructor()
+ {
+ // cleanup if any
+ DestroyData();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/src/T_DataOpenFontGlyphData.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataOpenFontGlyphData
+*/
+
+#include "T_DataOpenFontGlyphData.h"
+
+
+/*@{*/
+/// Parameters
+_LIT(KFldBufferSize, "buffer_size");
+
+/// Commands
+_LIT(KCmdNew, "New");
+_LIT(KCmdDestructor, "~");
+
+/// Logs
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+
+/*@}*/
+
+/**
+* Two phase constructor
+*/
+CT_DataOpenFontGlyphData* CT_DataOpenFontGlyphData::NewL()
+ {
+ CT_DataOpenFontGlyphData* ret = new (ELeave) CT_DataOpenFontGlyphData();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataOpenFontGlyphData::CT_DataOpenFontGlyphData()
+: CDataWrapperBase()
+, iGlyphData(NULL)
+ {
+ }
+
+
+/**
+* Protected second phase construction
+*/
+void CT_DataOpenFontGlyphData::ConstructL()
+ {
+ }
+
+
+/**
+* Destructor.
+*/
+CT_DataOpenFontGlyphData::~CT_DataOpenFontGlyphData()
+ {
+ if (iGlyphData != NULL)
+ DestroyData();
+ }
+
+
+/**
+* cleanup implementation.
+*/
+void CT_DataOpenFontGlyphData::DestroyData()
+ {
+ User::Heap().Free(iGlyphData);
+ iGlyphData = NULL;
+ }
+
+TAny* CT_DataOpenFontGlyphData::GetObject()
+ {
+ return iGlyphData;
+ }
+
+void CT_DataOpenFontGlyphData::SetObjectL(TAny* aObject)
+ {
+ DestroyData();
+ iGlyphData = static_cast<TOpenFontGlyphData*> (aObject);
+ }
+
+void CT_DataOpenFontGlyphData::DisownObjectL()
+ {
+ iGlyphData = NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataOpenFontGlyphData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNew)
+ {
+ DoCmdNew(aSection);
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DoCmdDestructor();
+ }
+ else
+ {
+ retVal=EFalse;
+ }
+
+ return retVal;
+ }
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** Creates an instance of TOpenFontGlyphData structure */
+void CT_DataOpenFontGlyphData::DoCmdNew(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Creates an object of TOpenFontGlyphData"));
+
+ // cleanup if any
+ DestroyData();
+
+ TInt bufsize;
+ if (!GetIntFromConfig(aSection, KFldBufferSize, bufsize))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldBufferSize());
+ SetBlockResult(EFail);
+ }
+
+ // call TOpenFontGlyphData::New()
+ INFO_PRINTF1(_L("execute TOpenFontGlyphData::New(RHeap*, TInt)"));
+ iGlyphData = TOpenFontGlyphData::New(&(User::Heap()), bufsize);
+
+ if (iGlyphData == NULL)
+ {
+ ERR_PRINTF1(_L("No enough memory"));
+ SetError(KErrNoMemory);
+ }
+ }
+
+void CT_DataOpenFontGlyphData::DoCmdDestructor()
+ {
+ DestroyData();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/src/T_DataOpenFontRasterizerContext.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,238 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataOpenFontRasterizerContext
+*/
+
+#include "T_DataOpenFontRasterizerContext.h"
+#include "T_GraphicsUtil.h"
+
+
+/*@{*/
+/// Parameters
+_LIT(KFldGlyphData, "glyphdata");
+_LIT(KFldBit, "bit");
+_LIT(KFldByte, "byte");
+
+/// Commands
+_LIT(KCmdNew, "new");
+_LIT(KCmdEndGlyph, "EndGlyph");
+_LIT(KCmdStartGlyph, "StartGlyph");
+_LIT(KCmdWriteGlyphBit, "WriteGlyphBit");
+_LIT(KCmdWriteGlyphByte, "WriteGlyphByte");
+_LIT(KCmdDestructor, "~");
+
+/// Logs
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+
+/*@}*/
+
+
+/**
+* Two phase constructor
+*/
+CT_DataOpenFontRasterizerContext* CT_DataOpenFontRasterizerContext::NewL()
+ {
+ CT_DataOpenFontRasterizerContext* ret = new (ELeave) CT_DataOpenFontRasterizerContext();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataOpenFontRasterizerContext::CT_DataOpenFontRasterizerContext()
+: CDataWrapperBase()
+, iRasterizerContext(NULL)
+ {
+ }
+
+
+/**
+* Protected second phase construction
+*/
+void CT_DataOpenFontRasterizerContext::ConstructL()
+ {
+ }
+
+
+/**
+* Destructor.
+*/
+CT_DataOpenFontRasterizerContext::~CT_DataOpenFontRasterizerContext()
+ {
+ DestroyData();
+ }
+
+
+/**
+* cleanup implementation.
+*/
+void CT_DataOpenFontRasterizerContext::DestroyData()
+ {
+ delete iRasterizerContext;
+ iRasterizerContext = NULL;
+ }
+
+TAny* CT_DataOpenFontRasterizerContext::GetObject()
+ {
+ return iRasterizerContext;
+ }
+
+void CT_DataOpenFontRasterizerContext::SetObjectL(TAny* aObject)
+ {
+ DestroyData();
+ iRasterizerContext = static_cast<COpenFontRasterizerContext*> (aObject);
+ }
+
+void CT_DataOpenFontRasterizerContext::DisownObjectL()
+ {
+ iRasterizerContext = NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataOpenFontRasterizerContext::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNew)
+ {
+ DoCmdNew();
+ }
+ else if (aCommand == KCmdEndGlyph)
+ {
+ DoCmdEndGlyph();
+ }
+ else if (aCommand == KCmdStartGlyph)
+ {
+ DoCmdStartGlyphL(aSection);
+ }
+ else if (aCommand == KCmdWriteGlyphBit)
+ {
+ DoCmdWriteGlyphBit(aSection);
+ }
+ else if (aCommand == KCmdWriteGlyphByte)
+ {
+ DoCmdWriteGlyphByte(aSection);
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DoCmdDestructor();
+ }
+ else
+ {
+ retVal=EFalse;
+ }
+
+ return retVal;
+ }
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** Creates an instance of COpenFontRasterizerContext structure */
+void CT_DataOpenFontRasterizerContext::DoCmdNew()
+ {
+ INFO_PRINTF1(_L("Creates an instance of COpenFontRasterizerContext"));
+
+ // cleanup if any
+ DestroyData();
+
+ // call new operator
+ TRAPD(err, iRasterizerContext = new (ELeave) COpenFontRasterizerContext());
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Error creating an instance: %d"), err);
+ SetError(err);
+ }
+ }
+
+void CT_DataOpenFontRasterizerContext::DoCmdEndGlyph()
+ {
+ INFO_PRINTF1(_L("execute COpenFontRasterizerContext::EndGlyph()"));
+ iRasterizerContext->EndGlyph();
+ }
+
+void CT_DataOpenFontRasterizerContext::DoCmdStartGlyphL(const TDesC& aSection)
+ {
+ TOpenFontGlyphData* glyphData= NULL;
+
+ if (!CT_GraphicsUtil::GetOpenFontGlyphDataL(*this, aSection, KFldGlyphData, glyphData))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldGlyphData());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute COpenFontRasterizerContext::StartGlyph(TOpenFontGlyphData*)"));
+ iRasterizerContext->StartGlyph(glyphData);
+ }
+ }
+
+void CT_DataOpenFontRasterizerContext::DoCmdWriteGlyphBit(const TDesC& aSection)
+ {
+ TInt bit;
+
+ if (!GetIntFromConfig(aSection, KFldBit, bit))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldBit());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute COpenFontRasterizerContext::WriteGlyphBit(TInt)"));
+ iRasterizerContext->WriteGlyphBit(bit);
+ }
+ }
+
+void CT_DataOpenFontRasterizerContext::DoCmdWriteGlyphByte(const TDesC& aSection)
+ {
+ TInt byte;
+
+ if (!GetIntFromConfig(aSection, KFldByte, byte))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldByte());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute COpenFontRasterizerContext::WriteGlyphByte(TInt)"));
+ iRasterizerContext->WriteGlyphByte(byte);
+ }
+ }
+
+void CT_DataOpenFontRasterizerContext::DoCmdDestructor()
+ {
+ DestroyData();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/src/T_GraphicsFntstoreAPIServer.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_GraphicsFntstoreAPIServer.h"
+#include "T_DataAlgStyle.h"
+#include "T_DataFontStore.h"
+#include "T_DataBitmapFont.h"
+#include "T_DataOpenFontGlyphData.h"
+#include "T_DataOpenFontRasterizerContext.h"
+
+// EPOC Includes
+#include <rsshared.h>
+
+/**
+ * @enum Constant Literals used.
+ */
+/*@{*/
+// Graphics Fntstore API
+
+_LIT(KTAlgStyle, "TAlgStyle");
+_LIT(KCFontStore, "CFontStore");
+_LIT(KCBitmapFont, "CBitmapFont");
+_LIT(KTOpenFontGlyphData, "TOpenFontGlyphData");
+_LIT(KCOpenFontRasterizerContext, "COpenFontRasterizerContext");
+/*@}*/
+
+
+inline CDataWrapper* CT_GraphicsFntstoreAPIServer::CT_GraphicsFntstoreAPIBlock::CreateDataL( const TDesC& aData )
+ {
+ CDataWrapper* wrapper = NULL;
+
+ if (aData == KCFontStore)
+ {
+ wrapper = CT_DataFontStore::NewL();
+ }
+ else if (aData == KCBitmapFont)
+ {
+ wrapper = CT_DataBitmapFont::NewL();
+ }
+ else if (aData == KTAlgStyle)
+ {
+ wrapper = CT_DataAlgStyle::NewL();
+ }
+ else if (aData == KTOpenFontGlyphData)
+ {
+ wrapper = CT_DataOpenFontGlyphData::NewL();
+ }
+ else if (aData == KCOpenFontRasterizerContext)
+ {
+ wrapper = CT_DataOpenFontRasterizerContext::NewL();
+ }
+
+ return wrapper;
+ }
+
+CT_GraphicsFntstoreAPIServer* CT_GraphicsFntstoreAPIServer::NewL()
+/**
+ * @return - Instance of the test server
+ * Same code for Secure and non-secure variants
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+ {
+ CT_GraphicsFntstoreAPIServer* server = new (ELeave) CT_GraphicsFntstoreAPIServer();
+ CleanupStack::PushL(server);
+ // CServer base class call
+ server->ConstructL(); /*Parsing the server name from the file name*/
+ CleanupStack::Pop(server);
+ return server;
+ }
+
+
+TInt LoadDrivers()
+ {
+#ifdef __WINS__
+ #define KPDDName _L("ECDRV")
+ #define KLDDName _L("ECOMM")
+#else
+ #define KPDDName _L("EUART1")
+ #define KLDDName _L("ECOMM")
+#endif
+ TInt rerr = KErrNone;
+
+ rerr = StartC32();
+ if( rerr!=KErrNone && rerr!=KErrAlreadyExists )
+ {
+ return rerr;
+ }
+
+ rerr = User::LoadPhysicalDevice(KPDDName);
+ if(rerr != KErrNone && rerr != KErrAlreadyExists)
+ {
+ return rerr;
+ }
+ rerr = User::LoadLogicalDevice(KLDDName);
+ if(rerr != KErrNone && rerr != KErrAlreadyExists)
+ {
+ return rerr;
+ }
+ return KErrNone;
+ }
+
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+ {
+#if (defined __DATA_CAGING__)
+ RProcess().DataCaging(RProcess::EDataCagingOn);
+ RProcess().SecureApi(RProcess::ESecureApiOn);
+#endif
+ CActiveScheduler* sched=NULL;
+ sched=new(ELeave) CActiveScheduler;
+ CActiveScheduler::Install(sched);
+ CT_GraphicsFntstoreAPIServer* server = NULL;
+ // Create the CTestServer derived server
+ TRAPD(err,server = CT_GraphicsFntstoreAPIServer::NewL());
+ if(!err)
+ {
+ // Sync with the client and enter the active scheduler
+ RProcess::Rendezvous(KErrNone);
+ sched->Start();
+ }
+ delete server;
+ delete sched;
+ }
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+ {
+ TInt rerr = LoadDrivers();
+ if( rerr != KErrNone )
+ {
+ return rerr;
+ }
+
+ __UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ if(cleanup == NULL)
+ {
+ return KErrNoMemory;
+ }
+#if (defined TRAP_IGNORE)
+ TRAP_IGNORE(MainL());
+#else
+ TRAPD(err,MainL());
+#endif
+ delete cleanup;
+ __UHEAP_MARKEND;
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/fntstore/src/T_TestOpenFont.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,211 @@
+// Copyright (c) 2007-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Creates a dummy rasterizer and a dummy shaper for FontStore APIs testing.
+//
+//
+
+#include <e32std.h>
+#include <f32file.h>
+#include "T_TestOpenFont.h"
+
+CTestRasterizer* CTestRasterizer::NewL()
+ {
+ return new(ELeave) CTestRasterizer;
+ }
+
+COpenFontFile* CTestRasterizer::NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& /*aFileSession*/)
+ {
+ TParse parse;
+ parse.Set(aFileName, NULL, NULL);
+
+ if (parse.Name().CompareF(KTestFont1) == 0 || parse.Name().CompareF(KTestFont2) == 0)
+ {
+ // create a dummy font.
+ return CTestFontFile::NewL(aUid,aFileName);
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+CTestFontFile::CTestFontFile(TInt aUid, const TDesC& aFileName)
+: COpenFontFile(aUid, aFileName)
+ {
+ }
+
+CTestFontFile* CTestFontFile::NewL(TInt aUid, const TDesC& aFileName)
+ {
+ CTestFontFile* self = new(ELeave)CTestFontFile(aUid,aFileName);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+TBool CTestFontFile::GetNearestFontHelper(const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
+ TInt& aFaceIndex, TOpenFontSpec& aActualFontSpec) const
+ {
+ return COpenFontFile::GetNearestFontHelper(aDesiredFontSpec, aPixelWidth, aPixelHeight, aFaceIndex, aActualFontSpec);
+ }
+
+void CTestFontFile::ConstructL()
+ {
+ const TDesC& filename = FileName();
+ TOpenFontFaceAttrib attrib;
+
+ if (filename.CompareF(KTestFont1) == 0)
+ attrib.SetFullName(_L("Test Font1"));
+ else if (filename.CompareF(KTestFont2) == 0)
+ {
+ attrib.SetFullName(_L("Test Font2"));
+ attrib.SetBold(TRUE);
+ attrib.SetItalic(TRUE);
+ }
+ attrib.SetFamilyName(_L("Test"));
+ attrib.SetLocalFullName(attrib.FullName());
+ attrib.SetCoverage(TOpenFontFaceAttrib::ELatinSet);
+ attrib.SetMinSizeInPixels(8);
+ AddFaceL(attrib);
+ }
+
+void CTestFontFile::GetNearestFontInPixelsL(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,
+ const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight,
+ COpenFont*& aFont,TOpenFontSpec& aActualFontSpec)
+ {
+ aFont = NULL;
+ TInt face_index = 0;
+ if (GetNearestFontHelper(aDesiredFontSpec,aPixelWidth,aPixelHeight,face_index,aActualFontSpec))
+ {
+ aFont = CTestFont::NewL(aHeap,aSessionCacheList,this,aActualFontSpec.Height());
+ }
+ }
+
+void CTestFontFile::GetNearestFontToDesignHeightInPixelsL(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,
+ const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight,
+ COpenFont*& aFont,TOpenFontSpec& aActualFontSpec)
+ {
+ aFont = NULL;
+ TInt face_index = 0;
+ if (GetNearestFontHelper(aDesiredFontSpec,aPixelWidth,aPixelHeight,face_index,aActualFontSpec))
+ {
+ aFont = CTestFont::NewL(aHeap,aSessionCacheList,this,aActualFontSpec.Height());
+ }
+ }
+
+void CTestFontFile::GetNearestFontToMaxHeightInPixelsL(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,
+ const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight,
+ COpenFont*& aFont,TOpenFontSpec& aActualFontSpec,TInt /*aMaxHeight*/)
+ {
+ aFont = NULL;
+ TInt face_index = 0;
+ if (GetNearestFontHelper(aDesiredFontSpec,aPixelWidth,aPixelHeight,face_index,aActualFontSpec))
+ {
+ aFont = CTestFont::NewL(aHeap,aSessionCacheList,this,aActualFontSpec.Height());
+ }
+ }
+
+TBool CTestFontFile::HasUnicodeCharacterL(TInt /*aFaceIndex*/,TInt /*aCode*/) const
+ {
+ // has no characters
+ return EFalse;
+ }
+
+CTestFont* CTestFont::NewL(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,
+ CTestFontFile* aFontFile,TInt aSizeInPixels)
+ {
+ CTestFont* f = (CTestFont*)aHeap->AllocL(sizeof(CTestFont));
+ new(f) CTestFont(aHeap,aSessionCacheList,aFontFile,aSizeInPixels);
+ return f;
+ }
+
+CTestFont::CTestFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,CTestFontFile* aFontFile,
+ TInt aSizeInPixels):
+ COpenFont(aHeap,aSessionCacheList,aFontFile)
+ {
+ iMetrics.SetSize(aSizeInPixels);
+ iMetrics.SetAscent(aSizeInPixels * 3 / 4);
+ iMetrics.SetDescent(aSizeInPixels - iMetrics.Ascent());
+ iMetrics.SetMaxHeight(iMetrics.Ascent());
+ iMetrics.SetMaxDepth(iMetrics.Descent());
+ iMetrics.SetMaxWidth(aSizeInPixels * 2);
+ }
+
+void CTestFont::RasterizeL(TInt /*aCode*/,TOpenFontGlyphData* /*aGlyphData*/)
+ {
+ // has no glyphs
+ User::Leave(KErrNotSupported);
+ }
+
+
+CTestShaperFactory* CTestShaperFactory::NewL()
+ {
+ return new(ELeave) CTestShaperFactory;
+ }
+
+CTestShaperFactory::CTestShaperFactory()
+ {
+ }
+
+CTestShaperFactory::~CTestShaperFactory()
+ {
+ }
+
+
+CShaper* CTestShaperFactory::NewShaperL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap)
+ {
+ return CTestShaper::NewL(aBitmapfont, aScript, aLanguage, aHeap);
+ }
+
+void* CShaperFactory::ExtendedInterface(TUid /*aInterfaceId*/)
+ {
+ return 0;
+ }
+
+
+CShaper * CTestShaper::NewL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap)
+ {
+ CTestShaper* self = new(ELeave) CTestShaper();
+ CleanupStack::PushL(self);
+ TInt error = self->ConstructL(aBitmapfont, aScript, aLanguage, aHeap);
+ if (KErrNone == error)
+ {
+ CleanupStack::Pop();
+ return self;
+ }
+ else
+ {
+ CleanupStack::PopAndDestroy();
+ return NULL;
+ }
+ }
+
+ TInt CTestShaper::ConstructL(CBitmapFont* /*aBitmapfont*/, TInt /*aScript*/, TInt /*aLanguage*/, RHeap* /*aHeap*/ )
+ {
+ return KErrNone;
+ }
+
+CTestShaper::CTestShaper()
+ {
+ }
+
+ CTestShaper::~CTestShaper()
+ {
+ }
+
+TInt CTestShaper::ShapeText(TShapeHeader*& /*aOutput*/, const TInput& /*aInput*/, RHeap* /*aHeapForOutput*/)
+ {
+ return KErrNotSupported;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataBitmapContext.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataBitmapContext
+*/
+
+#if (!defined __T_DATA_BITMAP_CONTEXT_H__)
+#define __T_DATA_BITMAP_CONTEXT_H__
+
+// User includes
+#include "T_DataGraphicsContext.h"
+
+class CT_DataBitmapContext : public CT_DataGraphicsContext
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataBitmapContext();
+ virtual CBitmapContext* GetBitmapContext() const = 0;
+
+ void DoCmdAlphaBlendBitmapsL(const TDesC& aSection);
+ void DoCmdBitBltL(const TDesC& aSection);
+ void DoCmdBitBltMaskedL(const TDesC& aSection);
+ void DoCmdClear(const TDesC& aSection);
+ void DoCmdCopyRect(const TDesC& aSection);
+ void DoCmdSetFaded(const TDesC& aSection);
+ void DoCmdSetFadingParameters(const TDesC& aSection);
+ };
+
+#endif /* __T_DATA_BITMAP_CONTEXT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataBitmapDevice.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataBitmapDevice
+*/
+
+#if (!defined __T_DATA_BITMAP_DEVICE_H__)
+#define __T_DATA_BITMAP_DEVICE_H__
+
+// User includes
+#include "T_DataGraphicsDevice.h"
+
+class CT_DataBitmapDevice : public CT_DataGraphicsDevice
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataBitmapDevice();
+ ~CT_DataBitmapDevice();
+
+ virtual CBitmapDevice* GetBitmapDevice() const = 0;
+
+ void DoCmdAddFileL(const TDesC& aSection);
+ void DoCmdCreateBitmapContextL(const TDesC& aSection);
+ void DoCmdFontHeightInPixels(const TDesC& aSection);
+ void DoCmdGetNearestFontInPixelsL(const TDesC& aSection);
+ void DoCmdGetNearestFontToDesignHeightInPixelsL(const TDesC& aSection);
+ void DoCmdGetNearestFontToMaxHeightInPixelsL(const TDesC& aSection);
+ void DoCmdGetPixel(const TDesC& aSection);
+ void DoCmdGetScanLineL(const TDesC& aSection);
+ void DoCmdRemoveFile(const TDesC& aSection);
+
+ void CheckScanLine(const TDesC& aSection,TDes8 &aBuf);
+
+private:
+ RArray<TPtrC> iFile;
+ RArray<TInt> iId;
+ };
+
+#endif /* __T_DATA_BITMAP_DEVICE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataDrawTextExtendedParam.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataDrawTextExtendedParam
+*/
+
+#if (!defined __T_DATA_DRAW_TEXT_EXTENDED_PARAM_H__)
+#define __T_DATA_DRAW_TEXT_EXTENDED_PARAM_H__
+
+// User Includes
+#include "T_DataDrawTextParam.h"
+
+class CT_DataDrawTextExtendedParam : public CT_DataDrawTextParam
+ {
+public:
+ CT_DataDrawTextExtendedParam();
+ ~CT_DataDrawTextExtendedParam();
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ virtual CGraphicsContext::TDrawTextParam* GetDrawTextParam() const;
+
+ void DoCmd_new();
+ void DoCmd_destructor();
+ void DoCmd_iParRightToLeft(const TDesC& aSection);
+
+private:
+ void DestroyData();
+
+private:
+ CGraphicsContext::TDrawTextExtendedParam* iDrawTextExtendedParam;
+ };
+
+#endif /* __T_DATA_DRAW_TEXT_EXTENDED_PARAM_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataDrawTextParam.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataDrawTextParam
+*/
+
+#if (!defined __T_DATA_DRAW_TEXT_PARAM_H__)
+#define __T_DATA_DRAW_TEXT_PARAM_H__
+
+// epoc32 includes
+#include <gdi.h>
+
+// User Includes
+#include "DataWrapperBase.h"
+
+class CT_DataDrawTextParam : public CDataWrapperBase
+ {
+public:
+ CT_DataDrawTextParam();
+ ~CT_DataDrawTextParam();
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ virtual CGraphicsContext::TDrawTextParam* GetDrawTextParam() const;
+
+ void DoCmd_new();
+ void DoCmd_destructor();
+ void DoCmd_iDirection(const TDesC& aSection);
+ void DoCmd_iCharJustNum(const TDesC& aSection);
+ void DoCmd_iCharJustExcess(const TDesC& aSection);
+ void DoCmd_iWordJustNum(const TDesC& aSection);
+ void DoCmd_iWordJustExcess(const TDesC& aSection);
+
+private:
+ void DestroyData();
+
+private:
+ CGraphicsContext::TDrawTextParam* iDrawTextParam;
+ };
+
+#endif /* __T_DATA_DRAW_TEXT_PARAM_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataFont.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFont
+*/
+
+#if (!defined __T_DATA_FONT_H__)
+#define __T_DATA_FONT_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// epoc32 includes
+#include <gdi.h>
+#include <openfont.h>
+
+class CT_DataFont : public CDataWrapperBase
+ {
+public:
+ CT_DataFont();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+ virtual CFont* GetFont() const = 0;
+
+private:
+ void DoCmdTextCount(const TDesC& aSection);
+ void DoCmdTextWidthInPixels(const TDesC& aSection);
+ void DoCmdCharWidthInPixels(const TDesC& aSection);
+ void DoCmdFontCapitalAscent(const TDesC& aSection);
+ void DoCmdFontMaxAscent(const TDesC& aSection);
+ void DoCmdFontStandardDescent(const TDesC& aSection);
+ void DoCmdFontMaxDescent(const TDesC& aSection);
+ void DoCmdFontLineGap(const TDesC& aSection);
+ void DoCmdFontMaxHeight(const TDesC& aSection);
+ void DoCmdTypeUid(const TDesC& aSection);
+ void DoCmdHeightInPixels(const TDesC& aSection);
+ void DoCmdAscentInPixels(const TDesC& aSection);
+ void DoCmdDescentInPixels(const TDesC& aSection);
+ void DoCmdMaxCharWidthInPixels(const TDesC& aSection);
+ void DoCmdMaxNormalCharWidthInPixels(const TDesC& aSection);
+ void DoCmdFontSpecInTwips(const TDesC& aSection);
+ void DoCmdWidthZeroInPixels(const TDesC& aSection);
+ void DoCmdBaselineOffsetInPixels(const TDesC& aSection);
+ void DoCmdGetCharacterData(const TDesC& aSection);
+ void DoCmdExtendedFunction(const TDesC& aSection);
+ void DoCmdMeasureTextL(const TDesC& aSection);
+
+ // Helpers
+ static TBool GetMeasureTextInputL(CDataWrapper& aDataWrapper, const TDesC& aParameterName, const TDesC& aSection, CFont::TMeasureTextInput*& aMeasureTextInput);
+ static TBool GetMeasureTextOutputL(CDataWrapper& aDataWrapper, const TDesC& aParameterName, const TDesC& aSection, CFont::TMeasureTextOutput*& aMeasureTextOutput);
+ };
+
+#endif /* __T_DATA_FONT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataGraphicsContext.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataGraphicsContext
+*/
+
+#if (!defined __T_DATA_GRAPHICS_CONTEXT_H__)
+#define __T_DATA_GRAPHICS_CONTEXT_H__
+
+// epoc32 includes
+#include <gdi.h>
+
+// User Includes
+#include "DataWrapperBase.h"
+
+class CT_DataGraphicsContext : public CDataWrapperBase
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataGraphicsContext();
+ virtual CGraphicsContext* GetGraphicsContext() const = 0;
+
+ void DoCmdCancelClippingRect();
+ void DoCmdCancelClippingRegion();
+ void DoCmdDeviceL(const TDesC& aSection);
+ void DoCmdDiscardBrushPattern();
+ void DoCmdDiscardFont();
+ void DoCmdDrawArc(const TDesC& aSection);
+ void DoCmdDrawBitmapL(const TDesC& aSection);
+ void DoCmdDrawBitmapMaskedL(const TDesC& aSection);
+ void DoCmdDrawEllipse(const TDesC& aSection);
+ void DoCmdDrawLine(const TDesC& aSection);
+ void DoCmdDrawLineBy(const TDesC& aSection);
+ void DoCmdDrawLineTo(const TDesC& aSection);
+ void DoCmdDrawPie(const TDesC& aSection);
+ void DoCmdDrawPolygonL(const TDesC& aSection);
+ void DoCmdDrawPolyLineL(const TDesC& aSection);
+ void DoCmdDrawRect(const TDesC& aSection);
+ void DoCmdDrawRoundRect(const TDesC& aSection);
+ void DoCmdDrawText(const TDesC& aSection);
+ void DoCmdDrawTextExtendedL(const TDesC& aSection);
+ void DoCmdDrawTextVertical(const TDesC& aSection);
+ void DoCmdGetShadowColor(const TDesC& aSection);
+ void DoCmdGetUnderlineMetrics(const TDesC& aSection);
+ void DoCmdJustificationInPixels(const TDesC& aSection);
+ void DoCmdMapColorsL(const TDesC& aSection);
+ void DoCmdMoveBy(const TDesC& aSection);
+ void DoCmdMoveTo(const TDesC& aSection);
+ void DoCmdPlot(const TDesC& aSection);
+ void DoCmdReserved();
+ void DoCmdReset();
+ void DoCmdSetBrushColor(const TDesC& aSection);
+ void DoCmdSetBrushOrigin(const TDesC& aSection);
+ void DoCmdSetBrushStyle(const TDesC& aSection);
+ void DoCmdSetClippingRegion(const TDesC& aSection);
+ void DoCmdSetCharJustification(const TDesC& aSection);
+ void DoCmdSetClippingRect(const TDesC& aSection);
+ void DoCmdSetDrawMode(const TDesC& aSection);
+ void DoCmdSetOrigin(const TDesC& aSection);
+ void DoCmdSetPenColor(const TDesC& aSection);
+ void DoCmdSetPenSize(const TDesC& aSection);
+ void DoCmdSetPenStyle(const TDesC& aSection);
+ void DoCmdSetShadowColor(const TDesC& aSection);
+ void DoCmdSetStrikethroughStyle(const TDesC& aSection);
+ void DoCmdSetUnderlineStyle(const TDesC& aSection);
+ void DoCmdSetWordJustification(const TDesC& aSection);
+ void DoCmdUseBrushPatternL(const TDesC& aSection);
+ void DoCmdUseFontL(const TDesC& aSection);
+ };
+
+#endif /* __T_DATA_GRAPHICS_CONTEXT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataGraphicsDevice.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataGraphicsDevice
+*/
+
+#if (!defined __T_DATA_GRAPHICS_DEVICE_H__)
+#define __T_DATA_GRAPHICS_DEVICE_H__
+
+// User Includes
+#include "T_DataGraphicsDeviceMap.h"
+
+class CT_DataGraphicsDevice : public CT_DataGraphicsDeviceMap
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataGraphicsDevice();
+
+ virtual CGraphicsDevice* GetGraphicsDevice() const = 0;
+
+ void DoCmdCreateContextL(const TDesC& aSection);
+ void DoCmdDisplayMode(const TDesC& aSection);
+ void DoCmdFontHeightInTwips(const TDesC& aSection);
+ void DoCmdGetPaletteL(const TDesC& aSection);
+ void DoCmdNumTypefaces(const TDesC& aSection);
+ void DoCmdPaletteAttributes(const TDesC& aSection);
+ void DoCmdSetPaletteL(const TDesC& aSection);
+ void DoCmdSizeInPixels(const TDesC& aSection);
+ void DoCmdSizeInTwips(const TDesC& aSection);
+ void DoCmdTypefaceSupport(const TDesC& aSection);
+
+ // helpers
+ inline TDisplayMode GetDisplayMode() const;
+
+private:
+ TDisplayMode iDisplayMode;
+ TSize iSizeInPixels;
+ TSize iSizeInTwips;
+ TTypefaceSupport iTypefaceSupport;
+ };
+
+#include "T_DataGraphicsDevice.inl"
+
+#endif /* __T_DATA_GRAPHICS_DEVICE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataGraphicsDevice.inl Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataGraphicsDevice inline functions
+*/
+
+TDisplayMode CT_DataGraphicsDevice::GetDisplayMode() const
+ {
+ return iDisplayMode;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataGraphicsDeviceMap.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataGraphicsDeviceMap
+*/
+
+#if (!defined __T_DATA_GRAPHICS_DEVICE_MAP_H__)
+#define __T_DATA_GRAPHICS_DEVICE_MAP_H__
+
+// epoc32 includes
+#include <bitdev.h>
+
+// User Includes
+#include "DataWrapperBase.h"
+
+class CT_DataGraphicsDeviceMap : public CDataWrapperBase
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataGraphicsDeviceMap();
+
+ virtual MGraphicsDeviceMap* GetGraphicsDeviceMap() const = 0;
+
+ void DoCmdGetNearestFontInTwipsL(const TDesC& aSection);
+ void DoCmdGetNearestFontToDesignHeightInTwipsL(const TDesC& aSection);
+ void DoCmdGetNearestFontToMaxHeightInTwipsL(const TDesC& aSection);
+ void DoCmdHorizontalPixelsToTwips(const TDesC& aSection);
+ void DoCmdHorizontalTwipsToPixels(const TDesC& aSection);
+ void DoCmdPixelsToTwips(const TDesC& aSection);
+ void DoCmdReleaseFontL(const TDesC& aSection);
+ void DoCmdTwipsToPixels(const TDesC& aSection);
+ void DoCmdVerticalPixelsToTwips(const TDesC& aSection);
+ void DoCmdVerticalTwipsToPixels(const TDesC& aSection);
+
+private:
+ TPoint iTwipsToPixelsPoint;
+ TRect iTwipsToPixelsRect;
+ TPoint iPixelsToTwipsPoint;
+ TRect iPixelsToTwipsRect;
+ };
+
+#endif /* __T_DATA_GRAPHICS_DEVICE_MAP_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataMeasureTextInput.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataMeasureTextInput
+*/
+
+#if (!defined __T_DATA_MEASURE_TEXT_INPUT_H__)
+#define __T_DATA_MEASURE_TEXT_INPUT_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+// EPOC includes
+#include <e32std.h>
+#include <gdi.h>
+
+class CT_DataMeasureTextInput : public CDataWrapperBase
+ {
+public:
+ static CT_DataMeasureTextInput* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+
+ ~CT_DataMeasureTextInput();
+
+ virtual TAny* GetObject();
+
+protected:
+ CT_DataMeasureTextInput();
+ void ConstructL();
+
+private:
+ void DoCmdNew();
+ void DoCmdDestructor();
+ void DoCmdSetCharJustExcess(const TDesC& aSection);
+ void DoCmdSetCharJustNum(const TDesC& aSection);
+ void DoCmdSetDirection(const TDesC& aSection);
+ void DoCmdSetEndInputChar(const TDesC& aSection);
+ void DoCmdSetFlags(const TDesC& aSection);
+ void DoCmdSetMaxAdvance(const TDesC& aSection);
+ void DoCmdSetMaxBounds(const TDesC& aSection);
+ void DoCmdSetStartInputChar(const TDesC& aSection);
+ void DoCmdSetWordJustExcess(const TDesC& aSection);
+ void DoCmdSetWordJustNum(const TDesC& aSection);
+
+ /// Helpers
+ TBool GetValueFromConfig(const TDesC& aSection, TInt& aValue);
+ TBool ReadFlags(const TDesC& aSection, TUint16& aFlags);
+ void DestroyData();
+
+private:
+
+ /** TMeasureTextInput class instance to work with*/
+ CFont::TMeasureTextInput* iMeasureTextInput;
+ };
+
+#endif /* __T_DATA_MEASURE_TEXT_INPUT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataMeasureTextOutput.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataMeasureTextOutput
+*/
+
+#if (!defined __T_DATA_MEASURE_TEXT_OUTPUT_H__)
+#define __T_DATA_MEASURE_TEXT_OUTPUT_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+// EPOC includes
+#include <e32std.h>
+#include <gdi.h>
+
+class CT_DataMeasureTextOutput : public CDataWrapperBase
+ {
+public:
+
+ static CT_DataMeasureTextOutput* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+
+ ~CT_DataMeasureTextOutput();
+
+ virtual TAny* GetObject();
+
+protected:
+ CT_DataMeasureTextOutput();
+ void ConstructL();
+
+private:
+ void DestroyData();
+ void DoCmdNew();
+ void DoCmdSetBounds(const TDesC& aSection);
+ void DoCmdSetChars(const TDesC& aSection);
+ void DoCmdSetGlyphs(const TDesC& aSection);
+ void DoCmdSetGroups(const TDesC& aSection);
+ void DoCmdSetMaxGlyphSize(const TDesC& aSection);
+ void DoCmdSetSpaces(const TDesC& aSection);
+
+ static TBool CT_DataMeasureTextOutput::GetValueFromConfig(CDataWrapper& iInputStep, const TDesC& aSection, TInt& aValue);
+
+private:
+ /** TMeasureTextOutput class instance to work with*/
+ CFont::TMeasureTextOutput* iMeasureTextOutput;
+ };
+
+#endif /* __T_DATA_MEASURE_TEXT_OUTPUT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataPalette.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataPalette
+*/
+
+#if (!defined __T_DATA_PALETTE_H__)
+#define __T_DATA_PALETTE_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC includes
+#include <e32std.h>
+#include <gdi.h>
+
+class CT_DataPalette : public CDataWrapperBase
+ {
+public:
+
+ static CT_DataPalette* NewL();
+
+ ~CT_DataPalette();
+
+ virtual TAny* GetObject();
+
+ void DestroyData();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataPalette();
+ void ConstructL();
+
+private:
+ void DoCmdNew(const TDesC& aSection);
+ void DoCmdNewDefault(const TDesC& aSection);
+
+private:
+ /** CPalette class instance to work with*/
+ CPalette* iPalette;
+ };
+
+#endif /* __T_DATA_PALETTE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/inc/T_DataTypefaceStore.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataTypefaceStore
+*/
+
+#if (!defined __T_DATA_TYPEFACE_STORE_H__)
+#define __T_DATA_TYPEFACE_STORE_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+#include "T_DataFont.h"
+
+// epoc32 includes
+#include <gdi.h>
+
+class CT_DataTypefaceStore : public CDataWrapperBase
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ CT_DataTypefaceStore();
+
+protected:
+
+ virtual CTypefaceStore* GetTypefaceStore() const = 0;
+ CT_DataFont* GetFontDataObjectFromParameterL(const TDesC& aParameterName, const TDesC& aSection);
+ void SetFontDataObjectIfPassedAsParameterL(CFont* font, const TDesC& aSection);
+
+private:
+ void DoCmdGetNearestFontInTwipsL(const TDesC& aSection);
+ void DoCmdGetNearestFontToDesignHeightInTwipsL(const TDesC& aSection);
+ void DoCmdGetNearestFontToMaxHeightInTwipsL(const TDesC& aSection);
+ void DoCmdNumTypefaces(const TDesC& aSection);
+ void DoCmdTypefaceSupport(const TDesC& aSection);
+ void DoCmdFontHeightInTwips(const TDesC& aSection);
+ void DoCmdReleaseFontL(const TDesC& aSection);
+ };
+
+#endif /* __T_DATA_TYPEFACE_STORE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataBitmapContext.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,384 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataGraphicsContext
+*/
+
+#include "T_DataBitmapContext.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdAlphaBlendBitmaps, "AlphaBlendBitmaps");
+_LIT(KCmdBitBlt, "BitBlt");
+_LIT(KCmdBitBltMasked, "BitBltMasked");
+_LIT(KCmdClear, "Clear");
+_LIT(KCmdCopyRect, "CopyRect");
+_LIT(KCmdSetFaded, "SetFaded");
+_LIT(KCmdSetFadingParameters, "SetFadingParameters");
+
+/// Fields
+_LIT(KFldAlphaBmp, "alphabmp");
+_LIT(KFldAlphaPt, "alphapt");
+_LIT(KFldBitmap, "bitmap");
+_LIT(KFldBlackMap, "blackmap");
+_LIT(KFldDestination, "destination");
+_LIT(KFldDestPt, "destpt");
+_LIT(KFldFaded, "faded");
+_LIT(KFldInvertMask, "invertmask");
+_LIT(KFldMaskBitmap, "maskbitmap");
+_LIT(KFldOffset, "offset");
+_LIT(KFldPoint, "point");
+_LIT(KFldRect, "rect");
+_LIT(KFldSource, "source");
+_LIT(KFldSourceRect, "sourcerect");
+_LIT(KFldSrcBmp, "srcbmp");
+_LIT(KFldSrcRect, "srcrect");
+_LIT(KFldSrcWsBmp, "srcwsbmp");
+_LIT(KFldWhiteMap, "whitemap");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+/*@}*/
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataBitmapContext::CT_DataBitmapContext()
+: CT_DataGraphicsContext()
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataBitmapContext::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret=ETrue;
+ if ( aCommand==KCmdAlphaBlendBitmaps )
+ {
+ DoCmdAlphaBlendBitmapsL(aSection);
+ }
+ else if ( aCommand==KCmdBitBlt )
+ {
+ DoCmdBitBltL(aSection);
+ }
+ else if ( aCommand==KCmdBitBltMasked )
+ {
+ DoCmdBitBltMaskedL(aSection);
+ }
+ else if ( aCommand==KCmdClear )
+ {
+ DoCmdClear(aSection);
+ }
+ else if ( aCommand==KCmdCopyRect )
+ {
+ DoCmdCopyRect(aSection);
+ }
+ else if ( aCommand==KCmdSetFaded )
+ {
+ DoCmdSetFaded(aSection);
+ }
+ else if ( aCommand==KCmdSetFadingParameters )
+ {
+ DoCmdSetFadingParameters(aSection);
+ }
+ else
+ {
+ ret=CT_DataGraphicsContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+void CT_DataBitmapContext::DoCmdAlphaBlendBitmapsL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TPoint destinationPoint;
+ if ( !GetPointFromConfig(aSection, KFldDestPt, destinationPoint) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDestPt());
+ SetBlockResult(EFail);
+ }
+
+ TRect sourceRect;
+ if ( !GetRectFromConfig(aSection, KFldSrcRect, sourceRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSrcRect());
+ SetBlockResult(EFail);
+ }
+
+ TPoint alphaPoint;
+ if ( !GetPointFromConfig(aSection, KFldAlphaPt, alphaPoint) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldAlphaPt());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ TInt err=KErrNone;
+
+ CWsBitmap* wsBitmap=NULL;
+ if ( CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldSrcWsBmp, wsBitmap) )
+ {
+ CWsBitmap* alphaBitmap=NULL;
+ if ( !CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldAlphaBmp, alphaBitmap) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldAlphaBmp());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute AlphaBlendBitmaps(TPoint, CWsBitmap*, TRect, CWsBitmap*, TPoint)"));
+ err=GetBitmapContext()->AlphaBlendBitmaps(destinationPoint, wsBitmap, sourceRect, alphaBitmap, alphaPoint);
+ }
+ }
+ else
+ {
+ CFbsBitmap* fbsBitmap=NULL;
+ if ( CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldSrcBmp, fbsBitmap) )
+ {
+ CFbsBitmap* alphaBitmap=NULL;
+ if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldAlphaBmp, alphaBitmap) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldAlphaBmp());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute AlphaBlendBitmaps(TPoint, CFbsBitmap*, TRect, CFbsBitmap*, TPoint)"));
+ err=GetBitmapContext()->AlphaBlendBitmaps(destinationPoint, fbsBitmap, sourceRect, alphaBitmap, alphaPoint);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSrcWsBmp());
+ ERR_PRINTF2(KLogMissingParameter, &KFldSrcBmp());
+ SetBlockResult(EFail);
+ }
+ }
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataBitmapContext::DoCmdBitBltL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ CFbsBitmap* bitmap=NULL;
+ if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldBitmap());
+ SetBlockResult(EFail);
+ }
+
+ TPoint point;
+ if ( GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute BitBlt(TPoint, CFbsBitmap*)"));
+ GetBitmapContext()->BitBlt(point, bitmap);
+ }
+ }
+ else
+ {
+ TPoint destination;
+ if ( !GetPointFromConfig(aSection, KFldDestination, destination) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDestination());
+ SetBlockResult(EFail);
+ }
+
+ TRect source;
+ if ( !GetRectFromConfig(aSection, KFldSource, source) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSource());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute BitBlt(TRect, CFbsBitmap*, TRect)"));
+ GetBitmapContext()->BitBlt(destination, bitmap, source);
+ }
+ }
+ }
+
+void CT_DataBitmapContext::DoCmdBitBltMaskedL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+
+ TRect sourceRect;
+ if ( !GetRectFromConfig(aSection, KFldSourceRect, sourceRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSourceRect());
+ SetBlockResult(EFail);
+ }
+
+ TBool invertMask;
+ if ( !GetBoolFromConfig(aSection, KFldInvertMask, invertMask) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldInvertMask());
+ SetBlockResult(EFail);
+ }
+
+ CFbsBitmap* bitmap=NULL;
+ if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldBitmap());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ CFbsBitmap* maskBitmap=NULL;
+ CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldMaskBitmap, maskBitmap);
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute BitBltMasked(TPoint, CFbsBitmap*, TRect, CFbsBitmap*, TBool)"));
+ GetBitmapContext()->BitBltMasked(point, bitmap, sourceRect, maskBitmap, invertMask);
+ }
+ }
+
+void CT_DataBitmapContext::DoCmdClear(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRect rect;
+ if ( GetRectFromConfig(aSection, KFldRect, rect) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Clear(TRect)"));
+ GetBitmapContext()->Clear(rect);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Clear()"));
+ GetBitmapContext()->Clear();
+ }
+ }
+
+void CT_DataBitmapContext::DoCmdCopyRect(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPoint offset;
+ if ( !GetPointFromConfig(aSection, KFldOffset, offset) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldOffset());
+ SetBlockResult(EFail);
+ }
+
+ TRect rect;
+ if ( !GetRectFromConfig(aSection, KFldRect, rect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute CopyRect(TPoint, TRect)"));
+ GetBitmapContext()->CopyRect(offset, rect);
+ }
+ }
+
+void CT_DataBitmapContext::DoCmdSetFaded(const TDesC& aSection)
+ {
+ TBool faded=ETrue;
+ if( !GetBoolFromConfig(aSection, KFldFaded(), faded))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFaded());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetFaded(TBool)"));
+ GetBitmapContext()->SetFaded(faded);
+ }
+ }
+
+void CT_DataBitmapContext::DoCmdSetFadingParameters(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TInt blackMap=0;
+ if( !GetIntFromConfig(aSection, KFldBlackMap(), blackMap) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldBlackMap());
+ SetBlockResult(EFail);
+ }
+
+ TInt whiteMap=255;
+ if( !GetIntFromConfig(aSection, KFldWhiteMap(), whiteMap) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldWhiteMap());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetFadingParameters(TUint8, TUint8)"));
+ GetBitmapContext()->SetFadingParameters((TUint8)blackMap, (TUint8)whiteMap);
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataBitmapDevice.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,641 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataGraphicsDevice
+*/
+
+#include "T_DataBitmapDevice.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdAddFile, "AddFile");
+_LIT(KCmdCreateBitmapContext, "CreateBitmapContext");
+_LIT(KCmdFontHeightInPixels, "FontHeightInPixels");
+_LIT(KCmdGetNearestFontInPixels, "GetNearestFontInPixels");
+_LIT(KCmdGetNearestFontToDesignHeightInPixels, "GetNearestFontToDesignHeightInPixels");
+_LIT(KCmdGetNearestFontToMaxHeightInPixels, "GetNearestFontToMaxHeightInPixels");
+_LIT(KCmdGetPixel, "GetPixel");
+_LIT(KCmdGetScanLine, "GetScanLine");
+_LIT(KCmdRemoveFile, "RemoveFile");
+
+/// Fields
+_LIT(KFldBitmapContext, "bitmap_context");
+_LIT(KFldBuffLength, "buff_length");
+_LIT(KFldCheckScanLine, "checkScanLine");
+_LIT(KFldScanLineBufferLength, "scanLineBufferLength");
+_LIT(KFldDisplayMode, "displaymode");
+_LIT(KFldExpected, "expected");
+_LIT(KFldFile, "file");
+_LIT(KFldFont, "font");
+_LIT(KFldHeightIndex, "height_index");
+_LIT(KFldId, "id");
+_LIT(KFldLength, "length");
+_LIT(KFldMaxHeight, "maxheight");
+_LIT(KFldPoint, "point");
+_LIT(KFldSize, "size");
+_LIT(KFldTypefaceIndex, "typeface_index");
+_LIT(KFldPointNum, "checkPointNum");
+_LIT(KFldPointXN, "point%d_x");
+_LIT(KFldPointRGBN, "expected_point%d");
+_LIT(KFldScanlineY, "scanline_y");
+
+/// Logging
+_LIT(KLogColor, "Color Red=%d Green=%d Blue=%d Alpha=%d");
+_LIT(KLogError, "Error=%d");
+_LIT(KLogHeight, "Height=%d");
+_LIT(KLogMissingFilename, "File '%S' not found in array");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogMissingWrapper, "Missing wrapper for '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+_LIT(KLogDoNotCheckScanLine, "Will not check scanline.");
+_LIT(KLogDoCheckScanLine, "Will check scanline is correct.");
+_LIT(KLogCheckScanLineResult, "ScanLine checked, expected length is %d, actual length is %d.");
+_LIT(KLogColorExpected, "Expected Color Red=%d Green=%d Blue=%d Alpha=%d");
+_LIT(KLogColorActual, "Actual Color Red=%d Green=%d Blue=%d Alpha=%d");
+_LIT(KLogPoint, "Point X=%d Y=%d");
+/*@}*/
+
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataBitmapDevice::CT_DataBitmapDevice()
+: CT_DataGraphicsDevice()
+ {
+ }
+
+CT_DataBitmapDevice::~CT_DataBitmapDevice()
+ {
+ iFile.Reset();
+ iFile.Close();
+ iId.Reset();
+ iId.Close();
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataBitmapDevice::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret=ETrue;
+ if ( aCommand==KCmdAddFile )
+ {
+ DoCmdAddFileL(aSection);
+ }
+ else if ( aCommand==KCmdCreateBitmapContext )
+ {
+ DoCmdCreateBitmapContextL(aSection);
+ }
+ else if ( aCommand==KCmdFontHeightInPixels )
+ {
+ DoCmdFontHeightInPixels(aSection);
+ }
+ else if ( aCommand==KCmdGetNearestFontInPixels )
+ {
+ DoCmdGetNearestFontInPixelsL(aSection);
+ }
+ else if ( aCommand==KCmdGetNearestFontToDesignHeightInPixels )
+ {
+ DoCmdGetNearestFontToDesignHeightInPixelsL(aSection);
+ }
+ else if ( aCommand==KCmdGetNearestFontToMaxHeightInPixels )
+ {
+ DoCmdGetNearestFontToMaxHeightInPixelsL(aSection);
+ }
+ else if ( aCommand==KCmdGetPixel )
+ {
+ DoCmdGetPixel(aSection);
+ }
+ else if ( aCommand==KCmdGetScanLine )
+ {
+ DoCmdGetScanLineL(aSection);
+ }
+ else if ( aCommand==KCmdRemoveFile )
+ {
+ DoCmdRemoveFile(aSection);
+ }
+ else
+ {
+ ret=CT_DataGraphicsDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ /* Another work package will implement this */
+ return ret;
+ }
+
+void CT_DataBitmapDevice::DoCmdAddFileL(const TDesC& aSection)
+ {
+ // get typeface index from parameters
+ TPtrC file;
+ if ( !GetStringFromConfig(aSection, KFldFile(), file) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFile());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TInt id;
+ INFO_PRINTF1(_L("execute AddFile(const TDesC&, TInt&)"));
+ TInt err=GetBitmapDevice()->AddFile(file, id);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ // Append filename and id
+ iFile.AppendL(file);
+ iId.AppendL(id);
+ }
+ }
+ }
+
+void CT_DataBitmapDevice::DoCmdCreateBitmapContextL(const TDesC& aSection)
+ {
+ TPtrC wrapperName;
+ if ( !GetStringFromConfig(aSection, KFldBitmapContext, wrapperName) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldBitmapContext());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CDataWrapper* wrapper=GetDataWrapperL(wrapperName);
+ if ( wrapper==NULL )
+ {
+ ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CBitmapContext* bitmapContext=NULL;
+ INFO_PRINTF1(_L("execute CreateBitmapContext(CBitmapContext*&)"));
+ TInt err=GetBitmapDevice()->CreateBitmapContext(bitmapContext);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ wrapper->SetObjectL(bitmapContext);
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapDevice::DoCmdFontHeightInPixels(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // get typeface index from parameters
+ TInt typefaceIndex;
+ if ( !GetIntFromConfig(aSection, KFldTypefaceIndex(), typefaceIndex) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldTypefaceIndex());
+ SetBlockResult(EFail);
+ }
+
+ // get height index from parameters
+ TInt heightIndex;
+ if ( !GetIntFromConfig(aSection, KFldHeightIndex(), heightIndex) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldHeightIndex());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute FontHeightInPixels(TInt, TInt)"));
+ TInt height=GetBitmapDevice()->FontHeightInPixels(typefaceIndex, heightIndex);
+ INFO_PRINTF2(KLogHeight, height);
+
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( expected!=height )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapDevice::DoCmdGetNearestFontInPixelsL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ if ( !GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ CDataWrapper* wrapper=GetDataWrapperL(wrapperName);
+ if ( wrapper==NULL )
+ {
+ ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CFont* font=NULL;
+ INFO_PRINTF1(_L("execute GetNearestFontInPixels(CFont*&, TFontSpec)"));
+ TInt err=GetBitmapDevice()->GetNearestFontInPixels(font, fontSpec);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ wrapper->SetObjectL(font);
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapDevice::DoCmdGetNearestFontToDesignHeightInPixelsL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ // get BitmapUtilData object from parameters
+ if ( !GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ CDataWrapper* wrapper=GetDataWrapperL(wrapperName);
+ if ( wrapper==NULL )
+ {
+ ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CFont* font=NULL;
+ INFO_PRINTF1(_L("execute GetNearestFontToDesignHeightInPixels(CFont*&, TFontSpec)"));
+ TInt err=GetBitmapDevice()->GetNearestFontToDesignHeightInPixels(font, fontSpec);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ wrapper->SetObjectL(font);
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapDevice::DoCmdGetNearestFontToMaxHeightInPixelsL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TInt maxHeight;
+ if ( !GetIntFromConfig(aSection, KFldMaxHeight, maxHeight) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldMaxHeight());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ // get BitmapUtilData object from parameters
+ if ( !GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ CDataWrapper* wrapper=GetDataWrapperL(wrapperName);
+ if ( wrapper==NULL )
+ {
+ ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CFont* font=NULL;
+ INFO_PRINTF1(_L("execute GetNearestFontToMaxHeightInPixels(CFont*&, TFontSpec, TInt)"));
+ TInt err=GetBitmapDevice()->GetNearestFontToMaxHeightInPixels(font, fontSpec, maxHeight);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ wrapper->SetObjectL(font);
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapDevice::DoCmdGetPixel(const TDesC& aSection)
+ {
+ // get typeface index from parameters
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, KFldPoint(), point) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TRgb color;
+ INFO_PRINTF1(_L("execute GetPixel(TRgb&, const TPoint&)"));
+ GetBitmapDevice()->GetPixel(color, point);
+ INFO_PRINTF5(KLogColor, color.Red(), color.Green(), color.Blue(), color.Alpha());
+
+ TRgb expected;
+ if ( GetRgbFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( expected!=color )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataBitmapDevice::DoCmdGetScanLineL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // get point x coordinate from parameters
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, KFldPoint(), point) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+
+ // get length from parameters
+ TInt length = 0;
+ if ( !GetIntFromConfig(aSection, KFldLength(), length) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldLength());
+ SetBlockResult(EFail);
+ }
+
+ // get buffer length from parameters
+ TInt buffLength = 0;
+ if ( !GetIntFromConfig(aSection, KFldBuffLength(), buffLength) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldBuffLength());
+ SetBlockResult(EFail);
+ }
+
+ // get display mode from parameters
+ TDisplayMode displayMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldDisplayMode(), displayMode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldDisplayMode());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ if ( dataOk )
+ {
+ // call GetScanLine()
+ TUint8* buffer = new (ELeave) TUint8[buffLength];
+ TPtr8 scanline(buffer, buffLength, buffLength);
+
+ INFO_PRINTF1(_L("execute GetScanLine(TDes8&, const TPoint&, TInt, TDisplayMode)"));
+ GetBitmapDevice()->GetScanLine(scanline, point, length, displayMode);
+
+ // Check ScanLine.
+ TBool checkScanLine = EFalse;
+ if ( !GetBoolFromConfig(aSection, KFldCheckScanLine(), checkScanLine) )
+ {
+ INFO_PRINTF1(KLogDoNotCheckScanLine);
+ }
+ else
+ {
+ if(!checkScanLine)
+ {
+ INFO_PRINTF1(KLogDoNotCheckScanLine);
+ }
+ else
+ {
+ INFO_PRINTF1(KLogDoCheckScanLine);
+
+ // get length of returned scanline
+ TInt expectedscanLineBufferLength = 0;
+ if ( GetIntFromConfig(aSection, KFldScanLineBufferLength, expectedscanLineBufferLength) )
+ {
+ TInt scanlineLen = scanline.Length();
+ INFO_PRINTF3(KLogCheckScanLineResult,expectedscanLineBufferLength,scanlineLen);
+ if(expectedscanLineBufferLength != scanlineLen)
+ {
+ ERR_PRINTF3(KLogCheckScanLineResult,expectedscanLineBufferLength,scanlineLen);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ //check the scanline got correctlly.
+ CheckScanLine(aSection,scanline);
+ }
+
+ }
+ }
+ delete [] buffer;
+ }
+ }
+
+void CT_DataBitmapDevice::DoCmdRemoveFile(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+ TInt id;
+ if ( !GetIntFromConfig(aSection, KFldId(), id) )
+ {
+ TPtrC file;
+ if ( !GetStringFromConfig(aSection, KFldFile(), file) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldId());
+ ERR_PRINTF2(KLogMissingParameter, &KFldFile());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TBool found=EFalse; // Filename found in array
+ for ( TInt index=iFile.Count(); (index>0) && (!found); )
+ {
+ if ( iFile[--index]==file )
+ {
+ id=iId[index];
+ iFile.Remove(index);
+ iId.Remove(index);
+ found=ETrue;
+ }
+ }
+ if ( !found )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingFilename, &file);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute RemoveFile(TInt)"));
+ GetBitmapDevice()->RemoveFile(id);
+ }
+ }
+
+void CT_DataBitmapDevice::CheckScanLine(const TDesC& aSection,TDes8 &aBuf)
+ {
+ INFO_PRINTF1(KLogDoCheckScanLine);
+
+ TBool appendCheckDataOK = ETrue;
+ TSize bitmapSize;
+ if ( !GetSizeFromConfig(aSection, KFldSize, bitmapSize) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSize);
+ SetBlockResult(EFail);
+ appendCheckDataOK = EFalse;
+ }
+
+ TDisplayMode displayMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldDisplayMode(), displayMode) )
+ {
+ ERR_PRINTF1(_L("No display mode"));
+ SetBlockResult(EFail);
+ appendCheckDataOK = EFalse;
+ }
+
+ TInt pointNum;
+ if ( !GetIntFromConfig(aSection, KFldPointNum(), pointNum) )
+ {
+ ERR_PRINTF1(_L("No check point num"));
+ SetBlockResult(EFail);
+ appendCheckDataOK = EFalse;
+ }
+
+ TInt scanlineY;
+ if ( !GetIntFromConfig(aSection, KFldScanlineY, scanlineY) )
+ {
+ ERR_PRINTF1(_L("No check scan line Y"));
+ SetBlockResult(EFail);
+ appendCheckDataOK = EFalse;
+ }
+
+ if (appendCheckDataOK)
+ {
+ CFbsBitmap* fbsbitmap = new(ELeave) CFbsBitmap();
+ fbsbitmap->Create(bitmapSize,displayMode);
+ fbsbitmap->SetScanLine(aBuf,scanlineY);
+
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ for (TInt i=1;i<=pointNum;i++)
+ {
+ TInt x;
+ tempStore.Format(KFldPointXN, i);
+ if ( !GetIntFromConfig(aSection, tempStore, x) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &tempStore);
+ SetBlockResult(EFail);
+ appendCheckDataOK=EFalse;
+ }
+ TRgb expected;
+ tempStore.Format(KFldPointRGBN, i);
+ if ( !GetRgbFromConfig(aSection, tempStore, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
+ SetBlockResult(EFail);
+ appendCheckDataOK=EFalse;
+ }
+ if(appendCheckDataOK)
+ {
+ TRgb actual;
+ TPoint pixelPoint(x,scanlineY);
+ fbsbitmap->GetPixel(actual,pixelPoint);
+ if(actual != expected)
+ {
+ ERR_PRINTF3(KLogPoint, x,scanlineY);
+ ERR_PRINTF5(KLogColorActual, actual.Red(), actual.Green(), actual.Blue(), actual.Alpha());
+ ERR_PRINTF5(KLogColorExpected, expected.Red(), expected.Green(), expected.Blue(), expected.Alpha());
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+ delete fbsbitmap;
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataDrawTextExtendedParam.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataDrawTextExtendedParam
+*/
+
+// User includes
+#include "T_DataDrawTextExtendedParam.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmd_new, "new");
+_LIT(KCmd_destructor, "~");
+_LIT(KCmd_iParRightToLeft, "iParRightToLeft");
+
+/// Parameters
+_LIT(KFldValue, "value");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+/*@}*/
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataDrawTextExtendedParam::CT_DataDrawTextExtendedParam()
+: CT_DataDrawTextParam()
+, iDrawTextExtendedParam(NULL)
+ {
+ }
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataDrawTextExtendedParam::~CT_DataDrawTextExtendedParam()
+ {
+ DestroyData();
+ }
+
+void CT_DataDrawTextExtendedParam::DestroyData()
+ {
+ delete iDrawTextExtendedParam;
+ iDrawTextExtendedParam=NULL;
+ }
+
+TAny* CT_DataDrawTextExtendedParam::GetObject()
+ {
+ return iDrawTextExtendedParam;
+ }
+
+void CT_DataDrawTextExtendedParam::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iDrawTextExtendedParam=static_cast<CGraphicsContext::TDrawTextExtendedParam*>(aAny);
+ }
+
+void CT_DataDrawTextExtendedParam::DisownObjectL()
+ {
+ iDrawTextExtendedParam=NULL;
+ }
+
+CGraphicsContext::TDrawTextParam* CT_DataDrawTextExtendedParam::GetDrawTextParam() const
+ {
+ return iDrawTextExtendedParam;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataDrawTextExtendedParam::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret=ETrue;
+ if ( aCommand==KCmd_new )
+ {
+ DoCmd_new();
+ }
+ else if ( aCommand==KCmd_destructor )
+ {
+ DoCmd_destructor();
+ }
+ else if ( aCommand==KCmd_iParRightToLeft )
+ {
+ DoCmd_iParRightToLeft(aSection);
+ }
+ else
+ {
+ ret=CT_DataDrawTextParam::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+void CT_DataDrawTextExtendedParam::DoCmd_new()
+ {
+ DestroyData();
+ TRAPD(err, iDrawTextExtendedParam = new (ELeave) CGraphicsContext::TDrawTextExtendedParam());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataDrawTextExtendedParam::DoCmd_destructor()
+ {
+ DestroyData();
+ CT_DataDrawTextParam::DoCmd_destructor();
+ }
+
+void CT_DataDrawTextExtendedParam::DoCmd_iParRightToLeft(const TDesC& aSection)
+ {
+ if ( !GetBoolFromConfig(aSection, KFldValue(), iDrawTextExtendedParam->iParRightToLeft) )
+ {
+ INFO_PRINTF2(_L("iParRightToLeft=%d"), iDrawTextExtendedParam->iParRightToLeft);
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataDrawTextParam.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataDrawTextParam
+*/
+
+// User includes
+#include "T_DataDrawTextParam.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmd_new, "new");
+_LIT(KCmd_destructor, "~");
+_LIT(KCmd_iDirection, "iDirection");
+_LIT(KCmd_iCharJustNum, "iCharJustNum");
+_LIT(KCmd_iCharJustExcess, "iCharJustExcess");
+_LIT(KCmd_iWordJustNum, "iWordJustNum");
+_LIT(KCmd_iWordJustExcess, "iWordJustExcess");
+
+/// Parameters
+_LIT(KFldValue, "value");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+/*@}*/
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataDrawTextParam::CT_DataDrawTextParam()
+: CDataWrapperBase()
+, iDrawTextParam(NULL)
+ {
+ }
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataDrawTextParam::~CT_DataDrawTextParam()
+ {
+ DestroyData();
+ }
+
+void CT_DataDrawTextParam::DestroyData()
+ {
+ delete iDrawTextParam;
+ iDrawTextParam=NULL;
+ }
+
+TAny* CT_DataDrawTextParam::GetObject()
+ {
+ return iDrawTextParam;
+ }
+
+void CT_DataDrawTextParam::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iDrawTextParam=static_cast<CGraphicsContext::TDrawTextParam*>(aAny);
+ }
+
+void CT_DataDrawTextParam::DisownObjectL()
+ {
+ iDrawTextParam=NULL;
+ }
+
+CGraphicsContext::TDrawTextParam* CT_DataDrawTextParam::GetDrawTextParam() const
+ {
+ return iDrawTextParam;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataDrawTextParam::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret=ETrue;
+ if ( aCommand==KCmd_new )
+ {
+ DoCmd_new();
+ }
+ else if ( aCommand==KCmd_destructor )
+ {
+ DoCmd_destructor();
+ }
+ else if ( aCommand==KCmd_iDirection )
+ {
+ DoCmd_iDirection(aSection);
+ }
+ else if ( aCommand==KCmd_iCharJustNum )
+ {
+ DoCmd_iCharJustNum(aSection);
+ }
+ else if ( aCommand==KCmd_iCharJustExcess )
+ {
+ DoCmd_iCharJustExcess(aSection);
+ }
+ else if ( aCommand==KCmd_iWordJustNum )
+ {
+ DoCmd_iWordJustNum(aSection);
+ }
+ else if ( aCommand==KCmd_iWordJustExcess )
+ {
+ DoCmd_iWordJustExcess(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+void CT_DataDrawTextParam::DoCmd_new()
+ {
+ DestroyData();
+ TRAPD(err, iDrawTextParam = new (ELeave) CGraphicsContext::TDrawTextParam());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataDrawTextParam::DoCmd_destructor()
+ {
+ DestroyData();
+ }
+
+void CT_DataDrawTextParam::DoCmd_iDirection(const TDesC& aSection)
+ {
+ CGraphicsContext::TDrawTextParam* textParam=GetDrawTextParam();
+ TPtrC deviceName;
+ if ( !CT_GraphicsUtil::ReadTextDirection(*this, aSection, KFldValue(), textParam->iDirection) )
+ {
+ INFO_PRINTF2(_L("iDirection=%d"), textParam->iDirection);
+ }
+ }
+
+void CT_DataDrawTextParam::DoCmd_iCharJustNum(const TDesC& aSection)
+ {
+ CGraphicsContext::TDrawTextParam* textParam=GetDrawTextParam();
+ TPtrC deviceName;
+ if ( !GetIntFromConfig(aSection, KFldValue(), textParam->iCharJustNum) )
+ {
+ INFO_PRINTF2(_L("iCharJustNum=%d"), textParam->iCharJustNum);
+ }
+ }
+
+void CT_DataDrawTextParam::DoCmd_iCharJustExcess(const TDesC& aSection)
+ {
+ CGraphicsContext::TDrawTextParam* textParam=GetDrawTextParam();
+ TPtrC deviceName;
+ if ( !GetIntFromConfig(aSection, KFldValue(), textParam->iCharJustExcess) )
+ {
+ INFO_PRINTF2(_L("iCharJustExcess=%d"), textParam->iCharJustExcess);
+ }
+ }
+
+void CT_DataDrawTextParam::DoCmd_iWordJustNum(const TDesC& aSection)
+ {
+ CGraphicsContext::TDrawTextParam* textParam=GetDrawTextParam();
+ TPtrC deviceName;
+ if ( !GetIntFromConfig(aSection, KFldValue(), textParam->iWordJustNum) )
+ {
+ INFO_PRINTF2(_L("iWordJustNum=%d"), textParam->iWordJustNum);
+ }
+ }
+
+void CT_DataDrawTextParam::DoCmd_iWordJustExcess(const TDesC& aSection)
+ {
+ CGraphicsContext::TDrawTextParam* textParam=GetDrawTextParam();
+ TPtrC deviceName;
+ if ( !GetIntFromConfig(aSection, KFldValue(), textParam->iWordJustExcess) )
+ {
+ INFO_PRINTF2(_L("iWordJustExcess=%d"), textParam->iWordJustExcess);
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataFont.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,721 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataFont
+*/
+
+// User includes
+#include "T_DataFont.h"
+
+// Epoc includes
+#include <gdi.h>
+
+/*@{*/
+/// Parameters
+_LIT(KText, "text");
+_LIT(KWidthAvailable, "width_available");
+_LIT(KCalculateExcess, "calculate_excess");
+_LIT(KExpectedExcess, "expected_excess");
+_LIT(KExpectedResult, "expected_result");
+_LIT(KExpectedFont, "expected_font");
+_LIT(KCharCode, "char_code");
+_LIT(KUid, "uid");
+_LIT(KMeasureTextOutput, "measure_text_output");
+_LIT(KMeasureTextInput, "measure_text_input");
+
+/// Commands
+_LIT(KCmdFontCapitalAscent, "FontCapitalAscent");
+_LIT(KCmdFontMaxAscent, "FontMaxAscent");
+_LIT(KCmdFontStandardDescent, "FontStandardDescent");
+_LIT(KCmdFontMaxDescent, "FontMaxDescent");
+_LIT(KCmdFontLineGap, "FontLineGap");
+_LIT(KCmdFontMaxHeight, "FontMaxHeight");
+_LIT(KCmdTypeUid, "TypeUid");
+_LIT(KCmdHeightInPixels, "HeightInPixels");
+_LIT(KCmdAscentInPixels, "AscentInPixels");
+_LIT(KCmdDescentInPixels, "DescentInPixels");
+_LIT(KCmdCharWidthInPixels, "CharWidthInPixels");
+_LIT(KCmdTextCount, "TextCount");
+_LIT(KCmdMaxCharWidthInPixels, "MaxCharWidthInPixels");
+_LIT(KCmdMaxNormalCharWidthInPixels, "MaxNormalCharWidthInPixels");
+_LIT(KCmdFontSpecInTwips, "FontSpecInTwips");
+_LIT(KCmdWidthZeroInPixels, "WidthZeroInPixels");
+_LIT(KCmdBaselineOffsetInPixels, "BaselineOffsetInPixels");
+_LIT(KCmdGetCharacterData, "GetCharacterData");
+_LIT(KCmdMeasureText, "MeasureText");
+_LIT(KCmdExtendedFunction, "ExtendedFunction");
+_LIT(KCmdTextWidthInPixels, "TextWidthInPixels");
+/*@}*/
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataFont::CT_DataFont()
+: CDataWrapperBase()
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFont::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret=ETrue;
+
+ if (aCommand == KCmdFontCapitalAscent)
+ {
+ DoCmdFontCapitalAscent(aSection);
+ }
+ else if (aCommand == KCmdFontMaxAscent)
+ {
+ DoCmdFontMaxAscent(aSection);
+ }
+ else if (aCommand == KCmdFontStandardDescent)
+ {
+ DoCmdFontStandardDescent(aSection);
+ }
+ else if (aCommand == KCmdFontMaxDescent)
+ {
+ DoCmdFontMaxDescent(aSection);
+ }
+ else if (aCommand == KCmdFontLineGap)
+ {
+ DoCmdFontLineGap(aSection);
+ }
+ else if (aCommand == KCmdFontMaxHeight)
+ {
+ DoCmdFontMaxHeight(aSection);
+ }
+ else if (aCommand == KCmdTypeUid)
+ {
+ DoCmdTypeUid(aSection);
+ }
+ else if (aCommand == KCmdHeightInPixels)
+ {
+ DoCmdHeightInPixels(aSection);
+ }
+ else if (aCommand == KCmdAscentInPixels)
+ {
+ DoCmdAscentInPixels(aSection);
+ }
+ else if (aCommand == KCmdDescentInPixels)
+ {
+ DoCmdDescentInPixels(aSection);
+ }
+ else if (aCommand == KCmdCharWidthInPixels)
+ {
+ DoCmdCharWidthInPixels(aSection);
+ }
+ else if (aCommand == KCmdTextCount)
+ {
+ DoCmdTextCount(aSection);
+ }
+ else if (aCommand == KCmdMaxCharWidthInPixels)
+ {
+ DoCmdMaxCharWidthInPixels(aSection);
+ }
+ else if (aCommand == KCmdMaxNormalCharWidthInPixels)
+ {
+ DoCmdMaxNormalCharWidthInPixels(aSection);
+ }
+ else if (aCommand == KCmdFontSpecInTwips)
+ {
+ DoCmdFontSpecInTwips(aSection);
+ }
+ else if (aCommand == KCmdWidthZeroInPixels)
+ {
+ DoCmdWidthZeroInPixels(aSection);
+ }
+ else if (aCommand == KCmdBaselineOffsetInPixels)
+ {
+ DoCmdBaselineOffsetInPixels(aSection);
+ }
+ else if (aCommand == KCmdGetCharacterData)
+ {
+ DoCmdGetCharacterData(aSection);
+ }
+ else if (aCommand == KCmdMeasureText)
+ {
+ DoCmdMeasureTextL(aSection);
+ }
+ else if (aCommand == KCmdExtendedFunction)
+ {
+ DoCmdExtendedFunction(aSection);
+ }
+ else if (aCommand == KCmdTextWidthInPixels)
+ {
+ DoCmdTextWidthInPixels(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+
+/** Calls CFont::TextCount() */
+void CT_DataFont::DoCmdTextCount(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::TextCount()"));
+ // get text from parameters
+ TPtrC text;
+ if ( !GetStringFromConfig(aSection, KText(), text) )
+ {
+ ERR_PRINTF2(_L("No %S"), &KText());
+ SetBlockResult(EFail);
+ }
+
+ // get available width from parameters
+ TInt widthAvailable = 0;
+ if(!GetIntFromConfig(aSection, KWidthAvailable(), widthAvailable))
+ {
+ ERR_PRINTF2(_L("No %S"), &KWidthAvailable());
+ SetBlockResult(EFail);
+ }
+
+ // get if to use version of TextCount() that calculates excess from parameters
+ TBool calculateExcess = EFalse;
+ GetBoolFromConfig(aSection, KCalculateExcess(), calculateExcess);
+
+ // call TextCount()
+ TInt result = KErrNone;
+ if ( calculateExcess )
+ {
+ TInt excess = 0;
+ result = GetFont()->TextCount(text, widthAvailable, excess);
+
+ // get expected excess from parameters
+ TInt expectedExcess = 0;
+ if ( GetIntFromConfig(aSection, KExpectedExcess(), expectedExcess) )
+ {
+ ERR_PRINTF1(_L("An expected excess should not be provided if calculate excess is set to false."));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ result = GetFont()->TextCount(text, widthAvailable);
+ }
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if ( GetIntFromConfig(aSection, KExpectedResult(), expectedResult) )
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::TextWidthInPixels() */
+void CT_DataFont::DoCmdTextWidthInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::TextWidthInPixels()"));
+ // get text from parameters
+ TPtrC text;
+ if (!GetStringFromConfig(aSection, KText(), text))
+ {
+ ERR_PRINTF2(_L("No %S"), &KText());
+ SetBlockResult(EFail);
+ }
+
+ // call TextWidthInPixels()
+ TInt result = GetFont()->TextWidthInPixels(text);
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::CharWidthInPixels() */
+void CT_DataFont::DoCmdCharWidthInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::CharWidthInPixels()"));
+ // get character code from parameters
+ TInt charCode = 0;
+ if(!GetIntFromConfig(aSection, KCharCode(), charCode))
+ {
+ ERR_PRINTF2(_L("No %S"), &KCharCode());
+ SetBlockResult(EFail);
+ }
+
+ // call CharWidthInPixels()
+ TInt result = GetFont()->CharWidthInPixels(charCode);
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if ( GetIntFromConfig(aSection, KExpectedResult(), expectedResult) )
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::FontCapitalAscent() */
+void CT_DataFont::DoCmdFontCapitalAscent(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::FontCapitalAscent()"));
+ // call FontCapitalAscent()
+ TInt result = GetFont()->FontCapitalAscent();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if ( GetIntFromConfig(aSection, KExpectedResult(), expectedResult) )
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::FontMaxAscent() */
+void CT_DataFont::DoCmdFontMaxAscent(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::FontMaxAscent()"));
+ // call FontMaxAscent()
+ TInt result = GetFont()->FontMaxAscent();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if ( GetIntFromConfig(aSection, KExpectedResult(), expectedResult) )
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::FontStandardDescent() */
+void CT_DataFont::DoCmdFontStandardDescent(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::FontStandardDescent()"));
+ // call FontStandardDescent()
+ TInt result = GetFont()->FontStandardDescent();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::FontMaxDescent() */
+void CT_DataFont::DoCmdFontMaxDescent(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::FontMaxDescent()"));
+ // call FontMaxDescent()
+ TInt result = GetFont()->FontMaxDescent();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::FontLineGap() */
+void CT_DataFont::DoCmdFontLineGap(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::FontLineGap()"));
+ // call FontLineGap()
+ TInt result = GetFont()->FontLineGap();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::FontMaxHeight() */
+void CT_DataFont::DoCmdFontMaxHeight(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::FontMaxHeight()"));
+ // call FontMaxHeight()
+ TInt result = GetFont()->FontMaxHeight();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::TypeUid() */
+void CT_DataFont::DoCmdTypeUid(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::TypeUid()"));
+ // call TypeUid()
+ TUid result = GetFont()->TypeUid();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != TUid::Uid(expectedResult))
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result.iUid);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::HeightInPixels() */
+void CT_DataFont::DoCmdHeightInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::HeightInPixels()"));
+ // call HeightInPixels()
+ TInt result = GetFont()->HeightInPixels();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::AscentInPixels() */
+void CT_DataFont::DoCmdAscentInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::AscentInPixels()"));
+ // call AscentInPixels()
+ TInt result = GetFont()->AscentInPixels();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::DescentInPixels() */
+void CT_DataFont::DoCmdDescentInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::DescentInPixels()"));
+ // call DescentInPixels()
+ TInt result = GetFont()->DescentInPixels();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::MaxCharWidthInPixels() */
+void CT_DataFont::DoCmdMaxCharWidthInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::MaxCharWidthInPixels()"));
+ // call MaxCharWidthInPixels()
+ TInt result = GetFont()->MaxCharWidthInPixels();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::MaxNormalCharWidthInPixels() */
+void CT_DataFont::DoCmdMaxNormalCharWidthInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::MaxNormalCharWidthInPixels()"));
+ // call MaxNormalCharWidthInPixels()
+ TInt result = GetFont()->MaxNormalCharWidthInPixels();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::FontSpecInTwips() */
+void CT_DataFont::DoCmdFontSpecInTwips(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::FontSpecInTwips()"));
+
+ // call FontSpecInTwips()
+ TFontSpec fontSpec=GetFont()->FontSpecInTwips();
+ INFO_PRINTF3(_L("iName %S, iHeight %d"), &fontSpec.iTypeface.iName,fontSpec.iHeight);
+
+ TFontSpec expectedFontSpec;
+ if(GetFontSpecFromConfig(aSection, KExpectedFont(), expectedFontSpec))
+ {
+ // just check font name
+ if( fontSpec.iTypeface.iName!=expectedFontSpec.iTypeface.iName)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected font: %S, actual font: %S"),
+ &expectedFontSpec.iTypeface.iName, &fontSpec.iTypeface.iName);
+ SetError(-1);
+ }
+ }
+ }
+
+
+/** Calls CFont::WidthZeroInPixels() */
+void CT_DataFont::DoCmdWidthZeroInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::WidthZeroInPixels()"));
+ // call WidthZeroInPixels()
+ TInt result = GetFont()->WidthZeroInPixels();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::BaselineOffsetInPixels() */
+void CT_DataFont::DoCmdBaselineOffsetInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::BaselineOffsetInPixels()"));
+ // call BaselineOffsetInPixels()
+ TInt result = GetFont()->BaselineOffsetInPixels();
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if(GetIntFromConfig(aSection, KExpectedResult(), expectedResult))
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFont::GetCharacterData() */
+void CT_DataFont::DoCmdGetCharacterData(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::GetCharacterData()"));
+ // get character code from parameters
+ TInt charCode = 0;
+ if(!GetIntFromConfig(aSection, KCharCode(), charCode))
+ {
+ ERR_PRINTF2(_L("No %S"), &KCharCode());
+ SetBlockResult(EFail);
+ }
+
+ // call GetCharacterData()
+ TUint code = charCode;
+ TOpenFontCharMetrics metrics;
+ const TUint8* bitmapPointer;
+ TSize bitmapSize;
+ CFont::TCharacterDataAvailability ret=GetFont()->GetCharacterData(code, metrics, bitmapPointer, bitmapSize);
+ INFO_PRINTF2(_L("CharacterDataAvailability %d"), ret);
+ INFO_PRINTF2(_L("Height %d"), bitmapSize.iHeight);
+ INFO_PRINTF2(_L("Width %d"), bitmapSize.iWidth);
+ }
+
+
+/** Calls CFont::ExtendedFunction() */
+void CT_DataFont::DoCmdExtendedFunction(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFont::ExtendedFunction()"));
+ // get function UID from parameters
+ TInt uidInt = 0;
+ if(!GetHexFromConfig(aSection, KUid(), uidInt))
+ {
+ ERR_PRINTF2(_L("No %S"), &KUid());
+ SetBlockResult(EFail);
+ }
+
+ // call ExtendedFunction()
+ TInt result=GetFont()->ExtendedFunction(TUid::Uid(uidInt), NULL);
+
+ // get expected result from parameters
+ TInt expectedResult = 0;
+ if ( GetIntFromConfig(aSection, KExpectedResult(), expectedResult) )
+ {
+ if (result != expectedResult)
+ {
+ ERR_PRINTF3(_L("The result is not as expected! expected: %d, actual: %d"), expectedResult, result);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Calls CFbsFont::MeasureText() */
+void CT_DataFont::DoCmdMeasureTextL(const TDesC& aSection)
+ {
+ CFont::TMeasureTextInput* measureTextInputPointer = NULL;
+ GetMeasureTextInputL(*this, KMeasureTextInput(), aSection, measureTextInputPointer);
+ if ( measureTextInputPointer==NULL )
+ {
+ INFO_PRINTF1(_L("measureTextInputPointer NULL"));
+ }
+
+ CFont::TMeasureTextOutput* measureTextOutputPointer = NULL;
+ GetMeasureTextOutputL(*this, KMeasureTextOutput(), aSection, measureTextOutputPointer);
+ if ( measureTextOutputPointer==NULL )
+ {
+ INFO_PRINTF1(_L("measureTextOutputPointer NULL"));
+ }
+
+ // get text from parameters
+ TPtrC text;
+ if (!GetStringFromConfig(aSection, KText(), text))
+ {
+ ERR_PRINTF2(_L("No %S"), &KText());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TInt width=GetFont()->MeasureText(text, measureTextInputPointer, measureTextOutputPointer);
+ INFO_PRINTF2(_L("MeasureText %d"), width);
+ }
+ }
+
+
+////////////////// UTIL METHODS ////////////////////////
+
+
+/**
+* Utility method that fetches TMeasureTextInput pointer by command parameter name from INI-file.
+*/
+TBool CT_DataFont::GetMeasureTextInputL(CDataWrapper& aDataWrapper, const TDesC& aParameterName, const TDesC& aSection, CFont::TMeasureTextInput*& aMeasureTextInput)
+ {
+ // get MeasureTextInputData object from parameters
+ TPtrC measureTextInputDataObjectName;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSection, aParameterName, measureTextInputDataObjectName);
+ if ( ret )
+ {
+ // check that the data object was found
+ aMeasureTextInput=static_cast<CFont::TMeasureTextInput*>(aDataWrapper.GetDataObjectL(measureTextInputDataObjectName));
+ }
+
+ return ret;
+ }
+
+
+/**
+* Utility method that fetches TMeasureTextOutput pointer by command parameter name from INI-file.
+*/
+TBool CT_DataFont::GetMeasureTextOutputL(CDataWrapper& aDataWrapper, const TDesC& aParameterName, const TDesC& aSection, CFont::TMeasureTextOutput*& aMeasureTextOutput)
+ {
+ // get MeasureTextOutputData object from parameters
+ TPtrC measureTextOutputDataObjectName;
+ TBool ret=aDataWrapper.GetStringFromConfig(aSection, aParameterName, measureTextOutputDataObjectName);
+ if ( ret )
+ {
+ // check that the data object was found
+ aMeasureTextOutput=static_cast<CFont::TMeasureTextOutput*>(aDataWrapper.GetDataObjectL(measureTextOutputDataObjectName));
+ }
+
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataGraphicsContext.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,1463 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataGraphicsContext
+*/
+
+// User includes
+#include "T_DataGraphicsContext.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdCancelClippingRect, "CancelClippingRect");
+_LIT(KCmdCancelClippingRegion, "CancelClippingRegion");
+_LIT(KCmdDevice, "Device");
+_LIT(KCmdDiscardBrushPattern, "DiscardBrushPattern");
+_LIT(KCmdDiscardFont, "DiscardFont");
+_LIT(KCmdDrawArc, "DrawArc");
+_LIT(KCmdDrawBitmap, "DrawBitmap");
+_LIT(KCmdDrawBitmapMasked, "DrawBitmapMasked");
+_LIT(KCmdDrawEllipse, "DrawEllipse");
+_LIT(KCmdDrawLine, "DrawLine");
+_LIT(KCmdDrawLineBy, "DrawLineBy");
+_LIT(KCmdDrawLineTo, "DrawLineTo");
+_LIT(KCmdDrawPie, "DrawPie");
+_LIT(KCmdDrawPolygon, "DrawPolygon");
+_LIT(KCmdDrawPolyLine, "DrawPolyLine");
+_LIT(KCmdDrawRect, "DrawRect");
+_LIT(KCmdDrawRoundRect, "DrawRoundRect");
+_LIT(KCmdDrawText, "DrawText");
+_LIT(KCmdDrawTextExtended, "DrawTextExtended");
+_LIT(KCmdDrawTextVertical, "DrawTextVertical");
+_LIT(KCmdGetShadowColor, "GetShadowColor");
+_LIT(KCmdGetUnderlineMetrics, "GetUnderlineMetrics");
+_LIT(KCmdJustificationInPixels, "JustificationInPixels");
+_LIT(KCmdMapColors, "MapColors");
+_LIT(KCmdMoveBy, "MoveBy");
+_LIT(KCmdMoveTo, "MoveTo");
+_LIT(KCmdPlot, "Plot");
+_LIT(KCmdReserved, "Reserved");
+_LIT(KCmdReset, "Reset");
+_LIT(KCmdSetBrushColor, "SetBrushColor");
+_LIT(KCmdSetBrushOrigin, "SetBrushOrigin");
+_LIT(KCmdSetBrushStyle, "SetBrushStyle");
+_LIT(KCmdSetClippingRegion, "SetClippingRegion");
+_LIT(KCmdSetCharJustification, "SetCharJustification");
+_LIT(KCmdSetClippingRect, "SetClippingRect");
+_LIT(KCmdSetDrawMode, "SetDrawMode");
+_LIT(KCmdSetOrigin, "SetOrigin");
+_LIT(KCmdSetPenColor, "SetPenColor");
+_LIT(KCmdSetPenSize, "SetPenSize");
+_LIT(KCmdSetPenStyle, "SetPenStyle");
+_LIT(KCmdSetShadowColor, "SetShadowColor");
+_LIT(KCmdSetStrikethroughStyle, "SetStrikethroughStyle");
+_LIT(KCmdSetUnderlineStyle, "SetUnderlineStyle");
+_LIT(KCmdSetWordJustification, "SetWordJustification");
+_LIT(KCmdUseBrushPattern, "UseBrushPattern");
+_LIT(KCmdUseFont, "UseFont");
+
+/// Parameters
+_LIT(KFldBaselineOffset, "baselineoffset");
+_LIT(KFldBitmap, "bitmap");
+_LIT(KFldBottom, "bottom");
+_LIT(KFldBrushStyle, "brushstyle");
+_LIT(KFldColor, "color");
+_LIT(KFldDestRect, "destrect");
+_LIT(KFldDevice, "device");
+_LIT(KFldDrawMode, "drawmode");
+_LIT(KFldExcessPixels, "excessPixels");
+_LIT(KFldExcessWidth, "excesswidth");
+_LIT(KFldExpected, "expected");
+_LIT(KFldFillRule, "fillrule");
+_LIT(KFldFirstUnit, "firstUnit");
+_LIT(KFldFont, "font");
+_LIT(KFldFontStrikethrough, "fontstrikethrough");
+_LIT(KFldFontUnderline, "fontunderline");
+_LIT(KFldEnd, "end");
+_LIT(KFldInvertMask, "invertmask");
+_LIT(KFldLeftMargin, "leftmargin");
+_LIT(KFldMapForwards, "mapforwards");
+_LIT(KFldMaskBitmap, "maskbitmap");
+_LIT(KFldNumChars, "numchars");
+_LIT(KFldNumColors, "numcolors");
+_LIT(KFldNumGaps, "numgaps");
+_LIT(KFldNumPoints, "numpoints");
+_LIT(KFldNumUnits, "numunits");
+_LIT(KFldPenStyle, "penstyle");
+_LIT(KFldPoint, "point");
+_LIT(KFldPoint1, "point1");
+_LIT(KFldPoint2, "point2");
+_LIT(KFldPointList, "pointlist");
+_LIT(KFldRect, "rect");
+_LIT(KFldRegion, "region");
+_LIT(KFldRgb, "rgb");
+_LIT(KFldRgbList, "rgblist");
+_LIT(KFldSourceRect, "sourcerect");
+_LIT(KFldSize, "size");
+_LIT(KFldStart, "start");
+_LIT(KFldText, "text");
+_LIT(KFldTextAlign, "textalign");
+_LIT(KFldTextExtendedParam, "textextendedparam");
+_LIT(KFldTop, "top");
+_LIT(KFldTopLeft, "topleft");
+_LIT(KFldTotalUnits, "totalUnits");
+_LIT(KFldUp, "up");
+_LIT(KFldWsBitmap, "wsbitmap");
+
+/// Logging
+_LIT(KLogColor, "Color Red=%d Green=%d Blue=%d Alpha=%d");
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMetrics, "Top=%d Bottom=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+/*@}*/
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataGraphicsContext::CT_DataGraphicsContext()
+: CDataWrapperBase()
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataGraphicsContext::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret=ETrue;
+ if ( aCommand==KCmdCancelClippingRect )
+ {
+ DoCmdCancelClippingRect();
+ }
+ else if ( aCommand==KCmdCancelClippingRegion )
+ {
+ DoCmdCancelClippingRegion();
+ }
+ else if ( aCommand==KCmdDevice )
+ {
+ DoCmdDeviceL(aSection);
+ }
+ else if ( aCommand==KCmdDiscardBrushPattern )
+ {
+ DoCmdDiscardBrushPattern();
+ }
+ else if ( aCommand==KCmdDiscardFont )
+ {
+ DoCmdDiscardFont();
+ }
+ else if ( aCommand==KCmdDrawArc )
+ {
+ DoCmdDrawArc(aSection);
+ }
+ else if ( aCommand==KCmdDrawBitmap )
+ {
+ DoCmdDrawBitmapL(aSection);
+ }
+ else if ( aCommand==KCmdDrawBitmapMasked )
+ {
+ DoCmdDrawBitmapMaskedL(aSection);
+ }
+ else if ( aCommand==KCmdDrawEllipse )
+ {
+ DoCmdDrawEllipse(aSection);
+ }
+ else if ( aCommand==KCmdDrawLine )
+ {
+ DoCmdDrawLine(aSection);
+ }
+ else if ( aCommand==KCmdDrawLineBy )
+ {
+ DoCmdDrawLineBy(aSection);
+ }
+ else if ( aCommand==KCmdDrawLineTo )
+ {
+ DoCmdDrawLineTo(aSection);
+ }
+ else if ( aCommand==KCmdDrawPie )
+ {
+ DoCmdDrawPie(aSection);
+ }
+ else if ( aCommand==KCmdDrawPolygon )
+ {
+ DoCmdDrawPolygonL(aSection);
+ }
+ else if ( aCommand==KCmdDrawPolyLine )
+ {
+ DoCmdDrawPolyLineL(aSection);
+ }
+ else if ( aCommand==KCmdDrawRect )
+ {
+ DoCmdDrawRect(aSection);
+ }
+ else if ( aCommand==KCmdDrawRoundRect )
+ {
+ DoCmdDrawRoundRect(aSection);
+ }
+ else if ( aCommand==KCmdDrawText )
+ {
+ DoCmdDrawText(aSection);
+ }
+ else if ( aCommand==KCmdDrawTextExtended )
+ {
+ DoCmdDrawTextExtendedL(aSection);
+ }
+ else if ( aCommand==KCmdDrawTextVertical )
+ {
+ DoCmdDrawTextVertical(aSection);
+ }
+ else if ( aCommand==KCmdGetShadowColor )
+ {
+ DoCmdGetShadowColor(aSection);
+ }
+ else if ( aCommand==KCmdGetUnderlineMetrics )
+ {
+ DoCmdGetUnderlineMetrics(aSection);
+ }
+ else if ( aCommand==KCmdJustificationInPixels )
+ {
+ DoCmdJustificationInPixels(aSection);
+ }
+ else if ( aCommand==KCmdMapColors )
+ {
+ DoCmdMapColorsL(aSection);
+ }
+ else if ( aCommand==KCmdMoveBy )
+ {
+ DoCmdMoveBy(aSection);
+ }
+ else if ( aCommand==KCmdMoveTo )
+ {
+ DoCmdMoveTo(aSection);
+ }
+ else if ( aCommand==KCmdPlot )
+ {
+ DoCmdPlot(aSection);
+ }
+ else if ( aCommand==KCmdReserved )
+ {
+ DoCmdReserved();
+ }
+ else if ( aCommand==KCmdReset )
+ {
+ DoCmdReset();
+ }
+ else if ( aCommand==KCmdSetBrushColor )
+ {
+ DoCmdSetBrushColor(aSection);
+ }
+ else if ( aCommand==KCmdSetBrushOrigin )
+ {
+ DoCmdSetBrushOrigin(aSection);
+ }
+ else if ( aCommand==KCmdSetBrushStyle )
+ {
+ DoCmdSetBrushStyle(aSection);
+ }
+ else if ( aCommand==KCmdSetClippingRegion )
+ {
+ DoCmdSetClippingRegion(aSection);
+ }
+ else if ( aCommand==KCmdSetCharJustification )
+ {
+ DoCmdSetCharJustification(aSection);
+ }
+ else if ( aCommand==KCmdSetClippingRect )
+ {
+ DoCmdSetClippingRect(aSection);
+ }
+ else if ( aCommand==KCmdSetDrawMode )
+ {
+ DoCmdSetDrawMode(aSection);
+ }
+ else if ( aCommand==KCmdSetOrigin )
+ {
+ DoCmdSetOrigin(aSection);
+ }
+ else if ( aCommand==KCmdSetPenColor )
+ {
+ DoCmdSetPenColor(aSection);
+ }
+ else if ( aCommand==KCmdSetPenSize )
+ {
+ DoCmdSetPenSize(aSection);
+ }
+ else if ( aCommand==KCmdSetPenStyle )
+ {
+ DoCmdSetPenStyle(aSection);
+ }
+ else if ( aCommand==KCmdSetShadowColor )
+ {
+ DoCmdSetShadowColor(aSection);
+ }
+ else if ( aCommand==KCmdSetStrikethroughStyle )
+ {
+ DoCmdSetStrikethroughStyle(aSection);
+ }
+ else if ( aCommand==KCmdSetUnderlineStyle )
+ {
+ DoCmdSetUnderlineStyle(aSection);
+ }
+ else if ( aCommand==KCmdSetWordJustification )
+ {
+ DoCmdSetWordJustification(aSection);
+ }
+ else if ( aCommand==KCmdUseBrushPattern )
+ {
+ DoCmdUseBrushPatternL(aSection);
+ }
+ else if ( aCommand==KCmdUseFont )
+ {
+ DoCmdUseFontL(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+void CT_DataGraphicsContext::DoCmdCancelClippingRect()
+ {
+ INFO_PRINTF1(_L("execute CancelClippingRect()"));
+ GetGraphicsContext()->CancelClippingRect();
+ }
+
+void CT_DataGraphicsContext::DoCmdCancelClippingRegion()
+ {
+ INFO_PRINTF1(_L("execute CancelClippingRegion()"));
+ GetGraphicsContext()->CancelClippingRegion();
+ }
+
+void CT_DataGraphicsContext::DoCmdDeviceL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute Device()"));
+ CGraphicsDevice* device = GetGraphicsContext()->Device();
+ TPtrC deviceName;
+ if ( GetStringFromConfig(aSection, KFldDevice(), deviceName) )
+ {
+ // check that the data object was found
+ CDataWrapper* dataWrapper=GetDataWrapperL(deviceName);
+ dataWrapper->SetObjectL(device);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDiscardBrushPattern()
+ {
+ INFO_PRINTF1(_L("execute DiscardBrushPattern()"));
+ GetGraphicsContext()->DiscardBrushPattern();
+ }
+
+void CT_DataGraphicsContext::DoCmdDiscardFont()
+ {
+ INFO_PRINTF1(_L("execute DiscardFont()"));
+ GetGraphicsContext()->DiscardFont();
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawArc(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TRect datRect;
+ if ( !GetRectFromConfig(aSection, KFldRect, datRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect());
+ SetBlockResult(EFail);
+ }
+
+ TPoint datStart;
+ if ( !GetPointFromConfig(aSection, KFldStart, datStart) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldStart());
+ SetBlockResult(EFail);
+ }
+
+ TPoint datEnd;
+ if ( !GetPointFromConfig(aSection, KFldEnd, datEnd) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldEnd());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute DrawArc(TRect, TPoint, TPoint)"));
+ GetGraphicsContext()->DrawArc(datRect, datStart, datEnd);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawBitmapL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ CFbsBitmap* bitmap=NULL;
+ if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldBitmap());
+ SetBlockResult(EFail);
+ }
+
+ TPoint datTopLeft;
+ if ( GetPointFromConfig(aSection, KFldTopLeft, datTopLeft) )
+ {
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawBitmap(TPoint, CFbsBitmap*)"));
+ GetGraphicsContext()->DrawBitmap(datTopLeft, bitmap);
+ }
+ }
+ else
+ {
+ TRect datDestRect;
+ if ( !GetRectFromConfig(aSection, KFldDestRect, datDestRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDestRect());
+ SetBlockResult(EFail);
+ }
+
+ TRect datSourceRect;
+ if ( GetRectFromConfig(aSection, KFldSourceRect, datSourceRect) )
+ {
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawBitmap(TRect, CFbsBitmap*, TRect)"));
+ GetGraphicsContext()->DrawBitmap(datDestRect, bitmap, datSourceRect);
+ }
+ }
+ else
+ {
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawBitmap(TRect, CFbsBitmap*)"));
+ GetGraphicsContext()->DrawBitmap(datDestRect, bitmap);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawBitmapMaskedL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TRect datDestRect;
+ if ( !GetRectFromConfig(aSection, KFldDestRect, datDestRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDestRect());
+ SetBlockResult(EFail);
+ }
+
+ TRect datSourceRect;
+ if ( !GetRectFromConfig(aSection, KFldSourceRect, datSourceRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSourceRect());
+ SetBlockResult(EFail);
+ }
+
+ TBool datInvertMask;
+ if ( !GetBoolFromConfig(aSection, KFldInvertMask, datInvertMask) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldInvertMask());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ CWsBitmap* wsBitmap = NULL;
+ if ( CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldWsBitmap, wsBitmap) )
+ {
+ CWsBitmap* mask=NULL;
+ CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldMaskBitmap, mask);
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawBitmapMasked(TRect, CWsBitmap*, TRect, CWsBitmap*, TBool)"));
+ GetGraphicsContext()->DrawBitmapMasked(datDestRect, wsBitmap, datSourceRect, mask, datInvertMask);
+ }
+ else
+ {
+ CFbsBitmap* fbsBitmap = NULL;
+ if ( CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, fbsBitmap) )
+ {
+ CFbsBitmap* mask=NULL;
+ CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldMaskBitmap, mask);
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawBitmapMasked(TRect, CFbsBitmap*, TRect, CFbsBitmap*, TBool)"));
+ GetGraphicsContext()->DrawBitmapMasked(datDestRect, fbsBitmap, datSourceRect, mask, datInvertMask);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldWsBitmap());
+ ERR_PRINTF2(KLogMissingParameter, &KFldBitmap());
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawEllipse(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRect datRect;
+ if ( !GetRectFromConfig(aSection, KFldRect, datRect) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute DrawEllipse(TRect)"));
+ GetGraphicsContext()->DrawEllipse(datRect);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawLine(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPoint datPoint1;
+ if ( !GetPointFromConfig(aSection, KFldPoint1, datPoint1) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint1());
+ SetBlockResult(EFail);
+ }
+
+ TPoint datPoint2;
+ if ( !GetPointFromConfig(aSection, KFldPoint2, datPoint2) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint2());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawLine(TPoint, TPoint)"));
+ GetGraphicsContext()->DrawLine(datPoint1, datPoint2);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawLineBy(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPoint datPoint;
+ if ( !GetPointFromConfig(aSection, KFldPoint, datPoint) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawLineBy(TPoint)"));
+ GetGraphicsContext()->DrawLineBy(datPoint);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawLineTo(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPoint datPoint;
+ if ( !GetPointFromConfig(aSection, KFldPoint, datPoint) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawLineTo(TPoint)"));
+ GetGraphicsContext()->DrawLineTo(datPoint);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawPie(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TRect datRect;
+ if ( !GetRectFromConfig(aSection, KFldRect, datRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect());
+ SetBlockResult(EFail);
+ }
+
+ TPoint datStart;
+ if ( !GetPointFromConfig(aSection, KFldStart, datStart) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldStart());
+ SetBlockResult(EFail);
+ }
+
+ TPoint datEnd;
+ if ( !GetPointFromConfig(aSection, KFldEnd, datEnd) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldEnd());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawPie(TRect, TPoint, TPoint)"));
+ GetGraphicsContext()->DrawPie(datRect, datStart, datEnd);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawPolygonL(const TDesC& aSection)
+ {
+ TInt err=KErrNone;
+
+ // Get test data for command input parameter(s)
+ CGraphicsContext::TFillRule datFillRule=CGraphicsContext::EAlternate;
+ CT_GraphicsUtil::ReadFillRule(*this, aSection, KFldFillRule, datFillRule);
+
+ TInt datNumPoints;
+ if ( GetIntFromConfig(aSection, KFldNumPoints, datNumPoints) )
+ {
+ TPoint* points=new (ELeave) TPoint[datNumPoints];
+ CleanupArrayDeletePushL(points);
+
+ if ( !GetPointListFromConfig(aSection, KFldPointList, datNumPoints, points) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawPolygon(TPoint*, TInt, TFillRule)"));
+ err=GetGraphicsContext()->DrawPolygon(points, datNumPoints, datFillRule);
+ }
+ CleanupStack::PopAndDestroy(points);
+ }
+ else
+ {
+ CArrayFix<TPoint>* points=new (ELeave) CArrayFixFlat<TPoint>(1);
+ CleanupStack::PushL(points);
+ TBool hasPointList=GetPointListFromConfigL(aSection, KFldPointList, *points);
+
+ if ( !hasPointList )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawPolygon(CArrayFix<TPoint>*, TFillRule)"));
+ err=GetGraphicsContext()->DrawPolygon(points, datFillRule);
+ }
+ CleanupStack::PopAndDestroy(points);
+ }
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawPolyLineL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt numPoints;
+ if ( GetIntFromConfig(aSection, KFldNumPoints, numPoints) )
+ {
+ TPoint* points=new (ELeave) TPoint[numPoints];
+ CleanupArrayDeletePushL(points);
+
+ if ( !GetPointListFromConfig(aSection, KFldPointList, numPoints, points) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawPolyLine(TPoint*, TInt)"));
+ GetGraphicsContext()->DrawPolyLine(points, numPoints);
+ }
+ CleanupStack::PopAndDestroy(points);
+ }
+ else
+ {
+ CArrayFix<TPoint>* points=new (ELeave) CArrayFixFlat<TPoint>(1);
+ CleanupStack::PushL(points);
+ TBool hasPointList=GetPointListFromConfigL(aSection, KFldPointList, *points);
+
+ if ( !hasPointList )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawPolyLine(CArrayFix<TPoint>*)"));
+ GetGraphicsContext()->DrawPolyLine(points);
+ }
+ CleanupStack::PopAndDestroy(points);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawRect(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRect rect;
+ if ( !GetRectFromConfig(aSection, KFldRect, rect) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawRect(TRect)"));
+ GetGraphicsContext()->DrawRect(rect);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawRoundRect(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TRect rect;
+ if ( !GetRectFromConfig(aSection, KFldRect, rect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect());
+ SetBlockResult(EFail);
+ }
+
+ TSize size;
+ if ( !GetSizeFromConfig(aSection, KFldSize, size) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSize());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawRoundRect(TRect, TSize)"));
+ GetGraphicsContext()->DrawRoundRect(rect, size);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawText(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TPtrC text;
+ if( !GetStringFromConfig(aSection, KFldText(), text) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
+ SetBlockResult(EFail);
+ }
+
+ TPoint point;
+ if( GetPointFromConfig(aSection, KFldPoint(), point))
+ {
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawText(const TDesC&, const TPoint &)"));
+ GetGraphicsContext()->DrawText(text, point);
+ }
+ }
+ else
+ {
+ TRect rect;
+ if ( GetRectFromConfig(aSection, KFldRect(), rect) )
+ {
+ TInt baselineOffset=0;
+ if ( !GetIntFromConfig(aSection, KFldBaselineOffset(), baselineOffset))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldBaselineOffset());
+ SetBlockResult(EFail);
+ }
+
+ CGraphicsContext::TTextAlign textAlign=CGraphicsContext::ELeft;
+ CT_GraphicsUtil::ReadTextAlign(*this, aSection, KFldTextAlign, textAlign);
+
+ TInt leftMargin=0;
+ GetIntFromConfig(aSection, KFldLeftMargin(), leftMargin);
+ if( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawText(const TDesC&, const TRect&, TInt, TTextAlign, TInt)"));
+ GetGraphicsContext()->DrawText(text, rect, baselineOffset, textAlign, leftMargin);
+ }
+ }
+ else
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldRect());
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawTextExtendedL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TPtrC text;
+ if( !GetStringFromConfig(aSection, KFldText(), text) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
+ SetBlockResult(EFail);
+ }
+
+ TPoint point;
+ if( !GetPointFromConfig(aSection, KFldPoint(), point))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldPoint());
+ SetBlockResult(EFail);
+ }
+
+ CGraphicsContext::TDrawTextExtendedParam* drawTextExtendedParam=NULL;
+ if ( !CT_GraphicsUtil::GetDrawTextExtendedParamL(*this, aSection, KFldTextExtendedParam(), drawTextExtendedParam) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldTextExtendedParam());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute DrawTextExtended(const TDesC&, TPoint, CGraphicsContext::TDrawTextExtendedParam)"));
+ TInt err=GetGraphicsContext()->DrawTextExtended(text, point, *drawTextExtendedParam);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdDrawTextVertical(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TPtrC text;
+ if( !GetStringFromConfig(aSection, KFldText(), text) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
+ SetBlockResult(EFail);
+ }
+
+ TBool up=EFalse;
+ if( !GetBoolFromConfig(aSection, KFldUp(), up))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldUp());
+ SetBlockResult(EFail);
+ }
+
+ TPoint point;
+ if( GetPointFromConfig(aSection, KFldPoint(), point))
+ {
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC&, const TPoint &, TBool)"));
+ GetGraphicsContext()->DrawTextVertical(text, point, up);
+ }
+ }
+ else
+ {
+ // Another overload DrawTextVertical function
+ TRect rect;
+ if( !GetRectFromConfig(aSection, KFldRect(), rect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldRect());
+ SetBlockResult(EFail);
+ }
+
+ TInt baselineOffset=0;
+ if ( !GetIntFromConfig(aSection, KFldBaselineOffset(), baselineOffset))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldBaselineOffset());
+ SetBlockResult(EFail);
+ }
+
+ CGraphicsContext::TTextAlign textAlign=CGraphicsContext::ELeft;
+ CT_GraphicsUtil::ReadTextAlign(*this, aSection, KFldTextAlign, textAlign);
+
+ TInt leftMargin=0;
+ GetIntFromConfig(aSection, KFldLeftMargin(), leftMargin);
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC&, const TRect&, TInt, TBool, TTextAlign, TInt)"));
+ GetGraphicsContext()->DrawTextVertical(text, rect, baselineOffset, up, textAlign, leftMargin);
+ }
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdGetShadowColor(const TDesC& aSection)
+ {
+ TRgb color;
+ INFO_PRINTF1(_L("execute GetShadowColor(TRgb)"));
+ TInt err=GetGraphicsContext()->GetShadowColor(color);
+ INFO_PRINTF5(KLogColor, color.Red(), color.Green(), color.Blue(), color.Alpha());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ TRgb expected;
+ if ( GetRgbFromConfig(aSection, KFldRgb(), expected) )
+ {
+ if ( color!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdGetUnderlineMetrics(const TDesC& aSection)
+ {
+ TInt top;
+ TInt bottom;
+ INFO_PRINTF1(_L("execute GetUnderlineMetrics(TInt, TInt)"));
+ TInt err=GetGraphicsContext()->GetUnderlineMetrics(top, bottom);
+ INFO_PRINTF3(KLogMetrics, top, bottom);
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldTop(), expected) )
+ {
+ if ( top!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ if ( GetIntFromConfig(aSection, KFldBottom(), expected) )
+ {
+ if ( bottom!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdJustificationInPixels(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TInt excessPixels;
+ if( !GetIntFromConfig(aSection, KFldExcessPixels(), excessPixels) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldExcessPixels());
+ SetBlockResult(EFail);
+ }
+
+ TInt totalUnits;
+ if( !GetIntFromConfig(aSection, KFldTotalUnits(), totalUnits) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldTotalUnits());
+ SetBlockResult(EFail);
+ }
+
+ TInt firstUnit;
+ if( !GetIntFromConfig(aSection, KFldFirstUnit(), firstUnit) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFirstUnit());
+ SetBlockResult(EFail);
+ }
+
+ TInt numUnits;
+ if( !GetIntFromConfig(aSection, KFldNumUnits(), numUnits) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldNumUnits());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute JustificationInPixels(TInt, TInt, TInt, TInt)"));
+ TInt actual=GetGraphicsContext()->JustificationInPixels(excessPixels, totalUnits, firstUnit, numUnits);
+ INFO_PRINTF2(_L("JustificationInPixels=%d"), actual);
+
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdMapColorsL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TRect rect;
+ if( !GetRectFromConfig(aSection, KFldRect(), rect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect());
+ SetBlockResult(EFail);
+ }
+
+ TInt numColors;
+ if ( !GetIntFromConfig(aSection, KFldNumColors, numColors) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldNumColors());
+ SetBlockResult(EFail);
+ }
+
+ TBool mapForwards=EFalse;
+ if( !GetBoolFromConfig(aSection, KFldMapForwards(), mapForwards))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldMapForwards());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ TRgb* colors=new (ELeave) TRgb[numColors];
+ CleanupArrayDeletePushL(colors);
+
+ if ( !GetRgbListFromConfig(aSection, KFldRgbList, numColors, colors) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRgbList());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute MapColors(const TRect&, const TRgb*, TInt, TBool)"));
+ GetGraphicsContext()->MapColors(rect, colors, numColors, mapForwards);
+ }
+ CleanupStack::PopAndDestroy(colors);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdMoveBy(const TDesC& aSection)
+ {
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute MoveBy(TPoint)"));
+ GetGraphicsContext()->MoveBy(point);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdMoveTo(const TDesC& aSection)
+ {
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute MoveTo(TPoint)"));
+ GetGraphicsContext()->MoveTo(point);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdPlot(const TDesC& aSection)
+ {
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Plot(TPoint)"));
+ GetGraphicsContext()->Plot(point);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdReserved()
+ {
+ INFO_PRINTF1(_L("execute Reserved()"));
+ GetGraphicsContext()->Reserved();
+ }
+
+void CT_DataGraphicsContext::DoCmdReset()
+ {
+ INFO_PRINTF1(_L("execute Reset()"));
+ GetGraphicsContext()->Reset();
+ }
+
+void CT_DataGraphicsContext::DoCmdSetBrushColor(const TDesC& aSection)
+ {
+ TRgb rgb;
+ if( !GetRgbFromConfig(aSection, KFldColor(), rgb))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldColor());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetBrushColor(TRgb)"));
+ GetGraphicsContext()->SetBrushColor(rgb);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetBrushOrigin(const TDesC& aSection)
+ {
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetBrushOrigin(TPoint)"));
+ GetGraphicsContext()->SetBrushOrigin(point);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetBrushStyle(const TDesC& aSection)
+ {
+ CGraphicsContext::TBrushStyle brushStyle;
+ if( !CT_GraphicsUtil::ReadBrushStyle(*this, aSection, KFldBrushStyle(), brushStyle))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldBrushStyle());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetBrushStyle(CGraphicsContext::TBrushStyle)"));
+ GetGraphicsContext()->SetBrushStyle(brushStyle);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetClippingRegion(const TDesC& aSection)
+ {
+ RRegion region;
+ CleanupClosePushL(region);
+ if ( !GetRegionFromConfig(aSection, KFldRegion, region) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRegion());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetClippingRegion(TRegion)"));
+ TInt err=GetGraphicsContext()->SetClippingRegion(region);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ CleanupStack::PopAndDestroy(®ion);
+ }
+
+void CT_DataGraphicsContext::DoCmdSetCharJustification(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TInt excessWidth=0;
+ if( !GetIntFromConfig(aSection, KFldExcessWidth(), excessWidth) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldExcessWidth());
+ SetBlockResult(EFail);
+ }
+
+ TInt numChars=0;
+ if( !GetIntFromConfig(aSection, KFldNumChars(), numChars) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldNumChars());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute SetCharJustification(TInt, TInt)"));
+ GetGraphicsContext()->SetCharJustification(excessWidth, numChars);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetClippingRect(const TDesC& aSection)
+ {
+ TRect rect;
+ if ( !GetRectFromConfig(aSection, KFldRect, rect) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetClippingRect(TRect)"));
+ GetGraphicsContext()->SetClippingRect(rect);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetDrawMode(const TDesC& aSection)
+ {
+ CGraphicsContext::TDrawMode drawMode;
+ if( !CT_GraphicsUtil::ReadDrawMode(*this, aSection, KFldDrawMode(), drawMode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldDrawMode());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetDrawMode(CGraphicsContext::TDrawMode)"));
+ GetGraphicsContext()->SetDrawMode(drawMode);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetOrigin(const TDesC& aSection)
+ {
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetOrigin(TPoint)"));
+ GetGraphicsContext()->SetOrigin(point);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetPenColor(const TDesC& aSection)
+ {
+ TRgb rgb;
+ if( !GetRgbFromConfig(aSection, KFldColor(), rgb))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldColor());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetPenColor(TRgb)"));
+ GetGraphicsContext()->SetPenColor(rgb);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetPenSize(const TDesC& aSection)
+ {
+ TSize size;
+ if( !GetSizeFromConfig(aSection, KFldSize(), size))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSize());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetPenSize(TSize)"));
+ GetGraphicsContext()->SetPenSize(size);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetPenStyle(const TDesC& aSection)
+ {
+ CGraphicsContext::TPenStyle penStyle;
+ if( !CT_GraphicsUtil::ReadPenStyle(*this, aSection, KFldPenStyle(), penStyle))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPenStyle());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetPenStyle(CGraphicsContext::TPenStyle)"));
+ GetGraphicsContext()->SetPenStyle(penStyle);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetShadowColor(const TDesC& aSection)
+ {
+ TRgb color;
+ if ( !GetRgbFromConfig(aSection, KFldRgb(), color) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRgb());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetShadowColor(TRgb)"));
+ TInt err=GetGraphicsContext()->SetShadowColor(color);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetStrikethroughStyle(const TDesC& aSection)
+ {
+ TFontStrikethrough fontStrikethrough;
+ if( !CT_GraphicsUtil::ReadFontStrikethrough(*this, aSection, KFldFontStrikethrough(), fontStrikethrough) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFontStrikethrough());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetStrikethroughStyle(TFontStrikethrough)"));
+ GetGraphicsContext()->SetStrikethroughStyle(fontStrikethrough);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetUnderlineStyle(const TDesC& aSection)
+ {
+ TFontUnderline fontUnderline;
+ if( !CT_GraphicsUtil::ReadFontUnderline(*this, aSection, KFldFontUnderline(), fontUnderline) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFontUnderline());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetUnderlineStyle(TFontUnderline)"));
+ GetGraphicsContext()->SetUnderlineStyle(fontUnderline);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdSetWordJustification(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TInt excessWidth=0;
+ if( !GetIntFromConfig(aSection, KFldExcessWidth(), excessWidth))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldExcessWidth());
+ SetBlockResult(EFail);
+ }
+
+ TInt numGaps=0;
+ if( !GetIntFromConfig(aSection, KFldNumGaps(), numGaps))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldNumGaps());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute SetWordJustification(TInt, TInt)"));
+ GetGraphicsContext()->SetWordJustification(excessWidth, numGaps);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdUseBrushPatternL(const TDesC& aSection)
+ {
+ CFbsBitmap* bitmap=NULL;
+ if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldBitmap());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute UseBrushPattern(CFbsBitmap*)"));
+ GetGraphicsContext()->UseBrushPattern(bitmap);
+ }
+ }
+
+void CT_DataGraphicsContext::DoCmdUseFontL(const TDesC& aSection)
+ {
+ CFont* font=NULL;
+
+ CT_GraphicsUtil::GetFontL(*this, aSection, KFldFont, font);
+ INFO_PRINTF1(_L("execute UseFont(CFont*)"));
+ GetGraphicsContext()->UseFont(font);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataGraphicsDevice.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,380 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataGraphicsDevice
+*/
+
+#include "T_DataGraphicsDevice.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdCreateContext, "CreateContext");
+_LIT(KCmdDisplayMode, "DisplayMode");
+_LIT(KCmdFontHeightInTwips, "FontHeightInTwips");
+_LIT(KCmdGetPalette, "GetPalette");
+_LIT(KCmdNumTypefaces, "NumTypefaces");
+_LIT(KCmdPaletteAttributes, "PaletteAttributes");
+_LIT(KCmdSetPalette, "SetPalette");
+_LIT(KCmdSizeInPixels, "SizeInPixels");
+_LIT(KCmdSizeInTwips, "SizeInTwips");
+_LIT(KCmdTypefaceSupport, "TypefaceSupport");
+
+/// Fields
+_LIT(KFldContext, "context");
+_LIT(KFldDisplayMode, "displaymode");
+_LIT(KFldExpected, "expected");
+_LIT(KFldExpectedEntries, "expected_entries");
+_LIT(KFldExpectedModifiable, "expected_modifiable");
+_LIT(KFldHeightIndex, "height_index");
+_LIT(KFldIndex, "index");
+_LIT(KFldPalette, "palette");
+_LIT(KFldTypefaceIndex, "typeface_index");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogMissingWrapper, "Missing wrapper for '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+/*@}*/
+
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataGraphicsDevice::CT_DataGraphicsDevice()
+: CT_DataGraphicsDeviceMap()
+, iDisplayMode(ENone)
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataGraphicsDevice::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret=ETrue;
+ if ( aCommand==KCmdCreateContext )
+ {
+ DoCmdCreateContextL(aSection);
+ }
+ else if ( aCommand==KCmdDisplayMode )
+ {
+ DoCmdDisplayMode(aSection);
+ }
+ else if ( aCommand==KCmdFontHeightInTwips )
+ {
+ DoCmdFontHeightInTwips(aSection);
+ }
+ else if ( aCommand==KCmdGetPalette )
+ {
+ DoCmdGetPaletteL(aSection);
+ }
+ else if ( aCommand==KCmdNumTypefaces )
+ {
+ DoCmdNumTypefaces(aSection);
+ }
+ else if ( aCommand==KCmdPaletteAttributes )
+ {
+ DoCmdPaletteAttributes(aSection);
+ }
+ else if ( aCommand==KCmdSetPalette )
+ {
+ DoCmdSetPaletteL(aSection);
+ }
+ else if ( aCommand==KCmdSizeInPixels )
+ {
+ DoCmdSizeInPixels(aSection);
+ }
+ else if ( aCommand==KCmdSizeInTwips )
+ {
+ DoCmdSizeInTwips(aSection);
+ }
+ else if ( aCommand==KCmdTypefaceSupport )
+ {
+ DoCmdTypefaceSupport(aSection);
+ }
+ else
+ {
+ ret=CT_DataGraphicsDeviceMap::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+void CT_DataGraphicsDevice::DoCmdCreateContextL(const TDesC& aSection)
+ {
+ TPtrC wrapperName;
+ // get BitmapUtilData object from parameters
+ if ( !GetStringFromConfig(aSection, KFldContext, wrapperName) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldContext());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CDataWrapper* wrapper=GetDataWrapperL(wrapperName);
+ if ( wrapper==NULL )
+ {
+ ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CGraphicsContext* context=NULL;
+ INFO_PRINTF1(_L("execute CreateContext(CGraphicsContext*&)"));
+ TInt err=GetGraphicsDevice()->CreateContext(context);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ wrapper->SetObjectL(context);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsDevice::DoCmdDisplayMode(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute DisplayMode()"));
+ iDisplayMode=GetGraphicsDevice()->DisplayMode();
+ INFO_PRINTF2(_L("Display Mode %d"), iDisplayMode);
+
+ // get display mode from parameters
+ TDisplayMode expectedValue;
+ if ( CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldDisplayMode(), expectedValue) )
+ {
+ // check value against NULL
+ if ( iDisplayMode!=expectedValue )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataGraphicsDevice::DoCmdFontHeightInTwips(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // get typeface index from parameters
+ TInt typefaceIndex;
+ if ( !GetIntFromConfig(aSection, KFldTypefaceIndex(), typefaceIndex) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldTypefaceIndex());
+ SetBlockResult(EFail);
+ }
+
+ // get height index from parameters
+ TInt heightIndex;
+ if ( !GetIntFromConfig(aSection, KFldHeightIndex(), heightIndex) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldHeightIndex());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute FontHeightInTwips(TInt, TInt)"));
+ TInt height=GetGraphicsDevice()->FontHeightInTwips(typefaceIndex, heightIndex);
+ INFO_PRINTF2(_L("Height %d"), height);
+
+ // get positive height check flag from parameters
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ if ( height!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsDevice::DoCmdGetPaletteL(const TDesC& aSection)
+ {
+ CPalette* pallet=NULL;
+ INFO_PRINTF1(_L("execute GetPalette(CPalette*&)"));
+ TInt err=GetGraphicsDevice()->GetPalette(pallet);
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ CPalette* expected=NULL;
+ if ( CT_GraphicsUtil::GetPaletteL(*this, aSection, KFldPalette(), expected) )
+ {
+ if ( pallet!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsDevice::DoCmdNumTypefaces(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute NumTypefaces()"));
+ TInt actual=GetGraphicsDevice()->NumTypefaces();
+ INFO_PRINTF2(_L("NumTypefaces=%d"), actual);
+
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataGraphicsDevice::DoCmdPaletteAttributes(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute PaletteAttributes(TBool&, TInt&)"));
+ TBool modifiable;
+ TInt entries;
+ GetGraphicsDevice()->PaletteAttributes(modifiable, entries);
+ INFO_PRINTF2(_L("modifiable %d"), modifiable);
+ INFO_PRINTF2(_L("entries %d"), entries);
+
+ TBool expectedModifiable;
+ if ( GetBoolFromConfig(aSection, KFldExpectedModifiable(), expectedModifiable) )
+ {
+ if ( modifiable!=expectedModifiable )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TInt expectedEntries;
+ if ( GetIntFromConfig(aSection, KFldExpectedEntries(), expectedEntries) )
+ {
+ if ( entries!=expectedEntries )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataGraphicsDevice::DoCmdSetPaletteL(const TDesC& aSection)
+ {
+ CPalette* pallet=NULL;
+ if ( !CT_GraphicsUtil::GetPaletteL(*this, aSection, KFldPalette(), pallet) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPalette());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetPalette(CPalette*)"));
+ GetGraphicsDevice()->SetPalette(pallet);
+ }
+ }
+
+void CT_DataGraphicsDevice::DoCmdSizeInPixels(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute SizeInPixels()"));
+ iSizeInPixels=GetGraphicsDevice()->SizeInPixels();
+ INFO_PRINTF3(_L("CGraphicsDevice::SizeInPixels() height %d, width %d"), iSizeInPixels.iHeight, iSizeInPixels.iWidth);
+
+ TSize expected;
+ if ( GetSizeFromConfig(aSection, KFldExpected(), expected) )
+ {
+ if ( iSizeInPixels!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataGraphicsDevice::DoCmdSizeInTwips(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute SizeInTwips()"));
+ iSizeInTwips=GetGraphicsDevice()->SizeInTwips();
+ INFO_PRINTF3(_L("CGraphicsDevice::SizeInTwips() height %d, width %d"), iSizeInTwips.iHeight, iSizeInTwips.iWidth);
+
+ TSize expected;
+ if ( GetSizeFromConfig(aSection, KFldExpected(), expected) )
+ {
+ if ( iSizeInTwips!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataGraphicsDevice::DoCmdTypefaceSupport(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // get typeface index from parameters
+ TInt index;
+ if ( !GetIntFromConfig(aSection, KFldIndex(), index) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldIndex());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute TypefaceSupport(TTypefaceSupport&, TInt)"));
+ GetGraphicsDevice()->TypefaceSupport(iTypefaceSupport, index);
+ INFO_PRINTF2(_L("iIsScalable %d"), iTypefaceSupport.iIsScalable);
+ INFO_PRINTF2(_L("iMaxHeightInTwips %d"), iTypefaceSupport.iMaxHeightInTwips);
+ INFO_PRINTF2(_L("iMinHeightInTwips %d"), iTypefaceSupport.iMinHeightInTwips);
+ INFO_PRINTF2(_L("iNumHeights %d"), iTypefaceSupport.iNumHeights);
+
+ TTypefaceSupport expectedTypeface;
+ if (CT_GraphicsUtil::ReadTypefaceSupport(*this, aSection, KFldExpected(),expectedTypeface ))
+ {
+ // just check font name
+ if (expectedTypeface.iTypeface.iName!=iTypefaceSupport.iTypeface.iName )
+ {
+ ERR_PRINTF3(_L("DoCmdTypefaceSupport expected=%S actual=%S"),
+ &expectedTypeface.iTypeface.iName,&iTypefaceSupport.iTypeface.iName);
+ SetBlockResult(EFail);
+ }
+
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataGraphicsDeviceMap.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,493 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataGraphicsDeviceMap
+*/
+
+#include "T_DataGraphicsDeviceMap.h"
+#include "T_DataFont.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdGetNearestFontInTwips, "GetNearestFontInTwips");
+_LIT(KCmdGetNearestFontToDesignHeightInTwips, "GetNearestFontToDesignHeightInTwips");
+_LIT(KCmdGetNearestFontToMaxHeightInTwips, "GetNearestFontToMaxHeightInTwips");
+_LIT(KCmdHorizontalPixelsToTwips, "HorizontalPixelsToTwips");
+_LIT(KCmdHorizontalTwipsToPixels, "HorizontalTwipsToPixels");
+_LIT(KCmdPixelsToTwips, "PixelsToTwips");
+_LIT(KCmdReleaseFont, "ReleaseFont");
+_LIT(KCmdTwipsToPixels, "TwipsToPixels");
+_LIT(KCmdVerticalPixelsToTwips, "VerticalPixelsToTwips");
+_LIT(KCmdVerticalTwipsToPixels, "VerticalTwipsToPixels");
+
+/// Fields
+_LIT(KFldExpected, "expected");
+_LIT(KFldFont, "font");
+_LIT(KFldMaxHeight, "maxheight");
+_LIT(KFldPixels, "pixels");
+_LIT(KFldPoint, "point");
+_LIT(KFldRect, "rect");
+_LIT(KFldTwips, "twips");
+_LIT(KFldDisown, "disown");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogMissingWrapper, "Missing wrapper for '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+/*@}*/
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataGraphicsDeviceMap::CT_DataGraphicsDeviceMap()
+: CDataWrapperBase()
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataGraphicsDeviceMap::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret=ETrue;
+ if ( aCommand==KCmdGetNearestFontInTwips )
+ {
+ DoCmdGetNearestFontInTwipsL(aSection);
+ }
+ else if ( aCommand==KCmdGetNearestFontToDesignHeightInTwips )
+ {
+ DoCmdGetNearestFontToDesignHeightInTwipsL(aSection);
+ }
+ else if ( aCommand==KCmdGetNearestFontToMaxHeightInTwips )
+ {
+ DoCmdGetNearestFontToMaxHeightInTwipsL(aSection);
+ }
+ else if ( aCommand==KCmdHorizontalPixelsToTwips )
+ {
+ DoCmdHorizontalPixelsToTwips(aSection);
+ }
+ else if ( aCommand==KCmdHorizontalTwipsToPixels )
+ {
+ DoCmdHorizontalTwipsToPixels(aSection);
+ }
+ else if ( aCommand==KCmdPixelsToTwips )
+ {
+ DoCmdPixelsToTwips(aSection);
+ }
+ else if ( aCommand==KCmdReleaseFont )
+ {
+ DoCmdReleaseFontL(aSection);
+ }
+ else if ( aCommand==KCmdTwipsToPixels )
+ {
+ DoCmdTwipsToPixels(aSection);
+ }
+ else if ( aCommand==KCmdVerticalPixelsToTwips )
+ {
+ DoCmdVerticalPixelsToTwips(aSection);
+ }
+ else if ( aCommand==KCmdVerticalTwipsToPixels )
+ {
+ DoCmdVerticalTwipsToPixels(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+ return ret;
+ }
+
+void CT_DataGraphicsDeviceMap::DoCmdGetNearestFontInTwipsL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ // get BitmapUtilData object from parameters
+ if ( !GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ CDataWrapper* wrapper=GetDataWrapperL(wrapperName);
+ if ( wrapper==NULL )
+ {
+ ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CFont* font=NULL;
+ INFO_PRINTF1(_L("execute GetNearestFontInTwips(CFont*&, TFontSpec)"));
+ TInt err=GetGraphicsDeviceMap()->GetNearestFontInTwips(font, fontSpec);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ wrapper->SetObjectL(font);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsDeviceMap::DoCmdGetNearestFontToDesignHeightInTwipsL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ // get BitmapUtilData object from parameters
+ if ( !GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ CDataWrapper* wrapper=GetDataWrapperL(wrapperName);
+ if ( wrapper==NULL )
+ {
+ ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CFont* font=NULL;
+ INFO_PRINTF1(_L("execute GetNearestFontToDesignHeightInTwips(CFont*&, TFontSpec)"));
+ TInt err=GetGraphicsDeviceMap()->GetNearestFontToDesignHeightInTwips(font, fontSpec);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ wrapper->SetObjectL(font);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsDeviceMap::DoCmdGetNearestFontToMaxHeightInTwipsL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ TInt maxHeight;
+ if ( !GetIntFromConfig(aSection, KFldMaxHeight, maxHeight) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldMaxHeight());
+ SetBlockResult(EFail);
+ }
+
+ TPtrC wrapperName;
+ // get BitmapUtilData object from parameters
+ if ( !GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ CDataWrapper* wrapper=GetDataWrapperL(wrapperName);
+ if ( wrapper==NULL )
+ {
+ ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CFont* font=NULL;
+ INFO_PRINTF1(_L("execute GetNearestFontToMaxHeightInTwips(CFont*&, TFontSpec, TInt)"));
+ TInt err=GetGraphicsDeviceMap()->GetNearestFontToMaxHeightInTwips(font, fontSpec, maxHeight);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ wrapper->SetObjectL(font);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsDeviceMap::DoCmdHorizontalPixelsToTwips(const TDesC& aSection)
+ {
+ TInt value;
+ if ( !GetIntFromConfig(aSection, KFldPixels, value) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPixels());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute HorizontalPixelsToTwips(TInt)"));
+ TInt pixels=GetGraphicsDeviceMap()->HorizontalPixelsToTwips(value);
+ INFO_PRINTF2(_L("HorizontalPixelsToTwips=%d"), pixels);
+
+ if ( GetIntFromConfig(aSection, KFldExpected, value) )
+ {
+ if ( value!=pixels )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsDeviceMap::DoCmdHorizontalTwipsToPixels(const TDesC& aSection)
+ {
+ TInt value;
+ if ( !GetIntFromConfig(aSection, KFldTwips, value) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldTwips());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute HorizontalTwipsToPixels(TInt)"));
+ TInt pixels=GetGraphicsDeviceMap()->HorizontalTwipsToPixels(value);
+ INFO_PRINTF2(_L("HorizontalTwipsToPixels=%d"), pixels);
+
+ if ( GetIntFromConfig(aSection, KFldExpected, value) )
+ {
+ if ( value!=pixels )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsDeviceMap::DoCmdPixelsToTwips(const TDesC& aSection)
+ {
+ TPoint point;
+ if ( GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ INFO_PRINTF1(_L("execute PixelsToTwips(const TPoint&)"));
+ iPixelsToTwipsPoint=GetGraphicsDeviceMap()->PixelsToTwips(point);
+ INFO_PRINTF3(_L("PixelsToTwips x=%d y=%d"), iPixelsToTwipsPoint.iX, iPixelsToTwipsPoint.iY);
+
+ if ( GetPointFromConfig(aSection, KFldExpected, point) )
+ {
+ if ( point!=iPixelsToTwipsPoint )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ else
+ {
+ TRect rect;
+ if ( GetRectFromConfig(aSection, KFldRect, rect) )
+ {
+ INFO_PRINTF1(_L("execute PixelsToTwips(const TRect&)"));
+ iPixelsToTwipsRect=GetGraphicsDeviceMap()->PixelsToTwips(rect);
+ LogRect(_L("PixelsToTwips(TRect)"), iPixelsToTwipsRect);
+ if ( GetRectFromConfig(aSection, KFldExpected, rect) )
+ {
+ if ( rect!=iPixelsToTwipsRect )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect());
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataGraphicsDeviceMap::DoCmdReleaseFontL(const TDesC& aSection)
+ {
+ TPtrC wrapperName;
+ // get BitmapUtilData object from parameters
+ if ( !GetStringFromConfig(aSection, KFldFont, wrapperName) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CT_DataFont* wrapper=static_cast<CT_DataFont*>(GetDataWrapperL(wrapperName));
+ if ( wrapper==NULL )
+ {
+ ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CFont* font=wrapper->GetFont();
+ INFO_PRINTF1(_L("execute ReleaseFont(CFont*)"));
+ GetGraphicsDeviceMap()->ReleaseFont(font);
+
+ // check if we need to disown object
+ TBool disOwn=ETrue, Own;
+ if ( GetBoolFromConfig(aSection, KFldDisown, Own))
+ disOwn=Own;
+ if (disOwn)
+ wrapper->DisownObjectL();
+ }
+ }
+ }
+
+void CT_DataGraphicsDeviceMap::DoCmdTwipsToPixels(const TDesC& aSection)
+ {
+ TPoint point;
+ if ( GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ INFO_PRINTF1(_L("execute TwipsToPixels(const TPoint&)"));
+ iTwipsToPixelsPoint=GetGraphicsDeviceMap()->TwipsToPixels(point);
+ INFO_PRINTF3(_L("TwipsToPixels x=%d y=%d"), iTwipsToPixelsPoint.iX, iTwipsToPixelsPoint.iY);
+
+ if ( GetPointFromConfig(aSection, KFldExpected, point) )
+ {
+ if ( point!=iTwipsToPixelsPoint )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ else
+ {
+ TRect rect;
+ if ( GetRectFromConfig(aSection, KFldRect, rect) )
+ {
+ INFO_PRINTF1(_L("execute TwipsToPixels(const TRect&)"));
+ iTwipsToPixelsRect=GetGraphicsDeviceMap()->TwipsToPixels(rect);
+ LogRect(_L("TwipsToPixels(const TRect&)"), iTwipsToPixelsRect);
+ if ( GetRectFromConfig(aSection, KFldExpected, rect) )
+ {
+ if ( rect!=iTwipsToPixelsRect )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect());
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataGraphicsDeviceMap::DoCmdVerticalPixelsToTwips(const TDesC& aSection)
+ {
+ TInt value;
+ if ( !GetIntFromConfig(aSection, KFldPixels, value) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPixels());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute VerticalPixelsToTwips(TInt)"));
+ TInt pixels=GetGraphicsDeviceMap()->VerticalPixelsToTwips(value);
+ INFO_PRINTF2(_L("VerticalPixelsToTwips=%d"), pixels);
+
+ if ( GetIntFromConfig(aSection, KFldExpected, value) )
+ {
+ if ( value!=pixels )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataGraphicsDeviceMap::DoCmdVerticalTwipsToPixels(const TDesC& aSection)
+ {
+ TInt value;
+ if ( !GetIntFromConfig(aSection, KFldTwips, value) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldTwips());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute VerticalTwipsToPixels(TInt)"));
+ TInt pixels=GetGraphicsDeviceMap()->VerticalTwipsToPixels(value);
+ INFO_PRINTF2(_L("VerticalTwipsToPixels=%d"), pixels);
+
+ if ( GetIntFromConfig(aSection, KFldExpected, value) )
+ {
+ if ( value!=pixels )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataMeasureTextInput.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,426 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataMeasureTextInput
+*/
+
+#include "T_DataMeasureTextInput.h"
+
+
+/*@{*/
+/// Parameters
+_LIT(KValue, "value");
+_LIT(KFlag, "flag%d");
+
+/// CFont::TMeasureTextInput::TFlags
+_LIT(KEFVisualOrder, "EFVisualOrder");
+_LIT(KEFVisualOrderRightToLeft, "EFVisualOrderRightToLeft");
+_LIT(KEFIncludePenPositionInBoundsCheck, "EFIncludePenPositionInBoundsCheck");
+
+/// Commands
+_LIT(KCmdNew, "new");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdSetCharJustExcess, "iCharJustExcess");
+_LIT(KCmdSetCharJustNum, "iCharJustNum");
+_LIT(KCmdSetDirection, "iDirection");
+_LIT(KCmdSetEndInputChar, "iEndInputChar");
+_LIT(KCmdSetFlags, "iFlags");
+_LIT(KCmdSetMaxAdvance, "iMaxAdvance");
+_LIT(KCmdSetMaxBounds, "iMaxBounds");
+_LIT(KCmdSetStartInputChar, "iStartInputChar");
+_LIT(KCmdSetWordJustExcess, "iWordJustExcess");
+_LIT(KCmdSetWordJustNum, "iWordJustNum");
+/*@}*/
+
+
+/**
+* Two phase constructor
+*/
+CT_DataMeasureTextInput* CT_DataMeasureTextInput::NewL()
+ {
+ CT_DataMeasureTextInput* ret = new (ELeave) CT_DataMeasureTextInput();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataMeasureTextInput::CT_DataMeasureTextInput()
+: CDataWrapperBase()
+, iMeasureTextInput(NULL)
+ {
+ }
+
+
+/**
+* Protected second phase construction
+*/
+void CT_DataMeasureTextInput::ConstructL()
+ {
+ }
+
+
+/**
+* Destructor.
+*/
+CT_DataMeasureTextInput::~CT_DataMeasureTextInput()
+ {
+ DestroyData();
+ }
+
+
+/**
+* cleanup implementation.
+*/
+void CT_DataMeasureTextInput::DestroyData()
+ {
+ delete iMeasureTextInput;
+ iMeasureTextInput = NULL;
+ }
+
+
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataMeasureTextInput::GetObject()
+ {
+ return iMeasureTextInput;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataMeasureTextInput::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNew)
+ {
+ DoCmdNew();
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DoCmdDestructor();
+ }
+ else if (aCommand == KCmdSetCharJustExcess)
+ {
+ DoCmdSetCharJustExcess(aSection);
+ }
+ else if (aCommand == KCmdSetCharJustNum)
+ {
+ DoCmdSetCharJustNum(aSection);
+ }
+ else if (aCommand == KCmdSetDirection)
+ {
+ DoCmdSetDirection(aSection);
+ }
+ else if (aCommand == KCmdSetEndInputChar)
+ {
+ DoCmdSetEndInputChar(aSection);
+ }
+ else if (aCommand == KCmdSetFlags)
+ {
+ DoCmdSetFlags(aSection);
+ }
+ else if (aCommand == KCmdSetMaxAdvance)
+ {
+ DoCmdSetMaxAdvance(aSection);
+ }
+ else if (aCommand == KCmdSetMaxBounds)
+ {
+ DoCmdSetMaxBounds(aSection);
+ }
+ else if (aCommand == KCmdSetStartInputChar)
+ {
+ DoCmdSetStartInputChar(aSection);
+ }
+ else if (aCommand == KCmdSetWordJustExcess)
+ {
+ DoCmdSetWordJustExcess(aSection);
+ }
+ else if (aCommand == KCmdSetWordJustNum)
+ {
+ DoCmdSetWordJustNum(aSection);
+ }
+ else
+ {
+ retVal=EFalse;
+ }
+
+ return retVal;
+ }
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** Creates an instance of TMeasureTextInput structure */
+void CT_DataMeasureTextInput::DoCmdNew()
+ {
+ INFO_PRINTF1(_L("Creates an instance of TMeasureTextInput structure"));
+
+ // cleanup if any
+ delete iMeasureTextInput;
+ iMeasureTextInput = NULL;
+
+ // call new operator
+ TRAPD(err, iMeasureTextInput = new (ELeave) CFont::TMeasureTextInput());
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Error creating an instance: %d"), err);
+ SetError(err);
+ }
+ }
+
+
+/** Destructor */
+void CT_DataMeasureTextInput::DoCmdDestructor()
+ {
+ DestroyData();
+ }
+
+/** Sets TMeasureTextInputData::iStartInputChar */
+void CT_DataMeasureTextInput::DoCmdSetStartInputChar(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextInputData::iStartInputChar"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(aSection, value))
+ {
+ iMeasureTextInput->iStartInputChar = value;
+ }
+ }
+
+
+/** Sets TMeasureTextInputData::iEndInputChar */
+void CT_DataMeasureTextInput::DoCmdSetEndInputChar(const TDesC& aSection)
+ {
+ INFO_PRINTF2(_L("Sets TMeasureTextInputData::iEndInputChar %S"), &aSection);
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(aSection, value))
+ {
+ iMeasureTextInput->iEndInputChar = value;
+ }
+ }
+
+
+/** Sets TMeasureTextInputData::iDirection */
+void CT_DataMeasureTextInput::DoCmdSetDirection(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextInputData::iDirection"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(aSection, value))
+ {
+ iMeasureTextInput->iDirection = value;
+ }
+ }
+
+
+/** Sets TMeasureTextInputData::iFlags */
+void CT_DataMeasureTextInput::DoCmdSetFlags(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextInputData::iFlags"));
+
+ // get value from parameters
+ if ( !ReadFlags(aSection, iMeasureTextInput->iFlags) )
+ {
+ ERR_PRINTF2(_L("No %S"), &aSection);
+ SetBlockResult(EFail);
+ }
+ }
+
+
+/** Sets TMeasureTextInputData::iMaxAdvance */
+void CT_DataMeasureTextInput::DoCmdSetMaxAdvance(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextInputData::iMaxAdvance"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(aSection, value))
+ {
+ iMeasureTextInput->iMaxAdvance = value;
+ }
+ }
+
+
+/** Sets TMeasureTextInputData::iMaxBounds */
+void CT_DataMeasureTextInput::DoCmdSetMaxBounds(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextInputData::iMaxBounds"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(aSection, value))
+ {
+ iMeasureTextInput->iMaxBounds = value;
+ }
+ }
+
+
+/** Sets TMeasureTextInputData::iCharJustNum */
+void CT_DataMeasureTextInput::DoCmdSetCharJustNum(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextInputData::iCharJustNum"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(aSection, value))
+ {
+ iMeasureTextInput->iCharJustNum = value;
+ }
+ }
+
+
+/** Sets TMeasureTextInputData::iCharJustExcess */
+void CT_DataMeasureTextInput::DoCmdSetCharJustExcess(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextInputData::iCharJustExcess"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(aSection, value))
+ {
+ iMeasureTextInput->iCharJustExcess = value;
+ }
+ }
+
+
+/** Sets TMeasureTextInputData::iWordJustNum */
+void CT_DataMeasureTextInput::DoCmdSetWordJustNum(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextInputData::iWordJustNum"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(aSection, value))
+ {
+ iMeasureTextInput->iWordJustNum = value;
+ }
+ }
+
+
+/** Sets TMeasureTextInputData::iWordJustExcess */
+void CT_DataMeasureTextInput::DoCmdSetWordJustExcess(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextInputData::iWordJustExcess"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(aSection, value))
+ {
+ iMeasureTextInput->iWordJustExcess = value;
+ }
+ }
+
+
+///////////////////////////////// UTIL METHODS //////////////////////////////////////
+
+
+/**
+* Utility method that fetches a int value from parameters
+*/
+TBool CT_DataMeasureTextInput::GetValueFromConfig(const TDesC& aSection, TInt& aValue)
+ {
+ TBool ret=GetIntFromConfig(aSection, KValue(), aValue);
+ if ( !ret )
+ {
+ ERR_PRINTF2(_L("No %S"), &KValue());
+ SetBlockResult(EFail);
+ }
+
+ return ret;
+ }
+
+/**
+ ReadFlags - read in bitwise measeure text input flags
+ @internalComponent
+ @param aSection - main entry in .ini file
+ @param aFlags - bitwise flags output
+ @return ETrue if data is valid in the ini file
+ @pre None
+ @post 2nd stage construction complete
+*/
+TBool CT_DataMeasureTextInput::ReadFlags(const TDesC& aSection, TUint16& aFlags)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ TInt index=0;
+ TBool moreData=ETrue;
+ TPtrC flagString;
+ TBool ret=ETrue;
+
+ aFlags=0;
+ while ( moreData && ret )
+ {
+ tempStore.Format(KFlag(), &aSection, ++index);
+ if ( GetStringFromConfig(aSection, tempStore, flagString) )
+ {
+ TInt flag=0;
+
+ if ( flagString==KEFVisualOrder )
+ {
+ flag=CFont::TMeasureTextInput::EFVisualOrder;
+ }
+ else if ( flagString==KEFVisualOrderRightToLeft )
+ {
+ flag=CFont::TMeasureTextInput::EFVisualOrderRightToLeft;
+ }
+ else if ( flagString==KEFIncludePenPositionInBoundsCheck )
+ {
+ flag=CFont::TMeasureTextInput::EFIncludePenPositionInBoundsCheck;
+ }
+ else
+ {
+ ret=GetIntFromConfig(aSection, tempStore, flag);
+ }
+
+ if ( ret )
+ {
+ aFlags |= flag;
+ }
+ }
+ else
+ {
+ moreData=EFalse;
+ }
+ }
+
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataMeasureTextOutput.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,348 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataMeasureTextOutput
+*/
+
+#include "T_DataMeasureTextOutput.h"
+
+
+/*@{*/
+/// Parameters
+_LIT(KValue, "value");
+_LIT(KRectAx, "rect_ax");
+_LIT(KRectAy, "rect_ay");
+_LIT(KRectBx, "rect_bx");
+_LIT(KRectBy, "rect_by");
+_LIT(KWidth, "width");
+_LIT(KHeight, "height");
+
+/// Commands
+_LIT(KCmdNew, "new");
+_LIT(KCmdSetBounds, "iBounds");
+_LIT(KCmdSetChars, "iChars");
+_LIT(KCmdSetGlyphs, "iGlyphs");
+_LIT(KCmdSetGroups, "iGroups");
+_LIT(KCmdSetMaxGlyphSize, "iMaxGlyphSize");
+_LIT(KCmdSetSpaces, "iSpaces");
+_LIT(KCmdDestructor, "~");
+
+
+
+/*@}*/
+
+
+/**
+* Two phase constructor
+*/
+CT_DataMeasureTextOutput* CT_DataMeasureTextOutput::NewL()
+ {
+ CT_DataMeasureTextOutput* ret = new (ELeave) CT_DataMeasureTextOutput();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataMeasureTextOutput::CT_DataMeasureTextOutput()
+: CDataWrapperBase()
+, iMeasureTextOutput(NULL)
+ {
+ }
+
+
+/**
+* Protected second phase construction
+*/
+void CT_DataMeasureTextOutput::ConstructL()
+ {
+ }
+
+
+/**
+* Destructor.
+*/
+CT_DataMeasureTextOutput::~CT_DataMeasureTextOutput()
+ {
+ DestroyData();
+ }
+
+
+/**
+* cleanup implementation.
+*/
+void CT_DataMeasureTextOutput::DestroyData()
+ {
+ delete iMeasureTextOutput;
+ iMeasureTextOutput = NULL;
+ }
+
+
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataMeasureTextOutput::GetObject()
+ {
+ return iMeasureTextOutput;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataMeasureTextOutput::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNew)
+ {
+ DoCmdNew();
+ }
+ else if (aCommand == KCmdSetBounds)
+ {
+ DoCmdSetBounds(aSection);
+ }
+ else if (aCommand == KCmdSetChars)
+ {
+ DoCmdSetChars(aSection);
+ }
+ else if (aCommand == KCmdSetGlyphs)
+ {
+ DoCmdSetGlyphs(aSection);
+ }
+ else if (aCommand == KCmdSetGroups)
+ {
+ DoCmdSetGroups(aSection);
+ }
+ else if (aCommand == KCmdSetMaxGlyphSize)
+ {
+ DoCmdSetMaxGlyphSize(aSection);
+ }
+ else if (aCommand == KCmdSetSpaces)
+ {
+ DoCmdSetSpaces(aSection);
+ }
+ else if (aCommand == KCmdDestructor)
+ {
+ DestroyData();
+ }
+ else
+ {
+ retVal=EFalse;
+ }
+
+ return retVal;
+ }
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** Creates an instance of TMeasureTextOutput structure */
+void CT_DataMeasureTextOutput::DoCmdNew()
+ {
+ INFO_PRINTF1(_L("Creates an instance of TMeasureTextOutput structure"));
+
+ // cleanup if any
+ DestroyData();
+
+ // call new operator
+ TRAPD(err, iMeasureTextOutput = new (ELeave) CFont::TMeasureTextOutput());
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Error creating an instance: %d"), err);
+ SetError(err);
+ }
+ }
+
+
+/** Sets TMeasureTextOutputData::iChars */
+void CT_DataMeasureTextOutput::DoCmdSetChars(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextOutputData::iChars"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(*this,aSection, value))
+ {
+ iMeasureTextOutput->iChars = value;
+ }
+ }
+
+
+/** Sets TMeasureTextOutputData::iGlyphs */
+void CT_DataMeasureTextOutput::DoCmdSetGlyphs(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextOutputData::iGlyphs"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(*this, aSection, value))
+ {
+ iMeasureTextOutput->iGlyphs = value;
+ }
+ }
+
+
+/** Sets TMeasureTextOutputData::iGroups */
+void CT_DataMeasureTextOutput::DoCmdSetGroups(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextOutputData::iGroups"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(*this, aSection, value))
+ {
+ iMeasureTextOutput->iGroups = value;
+ }
+ }
+
+
+/** Sets TMeasureTextOutputData::iSpaces */
+void CT_DataMeasureTextOutput::DoCmdSetSpaces(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextOutputData::iSpaces"));
+
+ // get value from parameters
+ TInt value;
+ if (GetValueFromConfig(*this, aSection, value))
+ {
+ iMeasureTextOutput->iSpaces = value;
+ }
+ }
+
+
+/** Sets TMeasureTextOutputData::iBounds */
+void CT_DataMeasureTextOutput::DoCmdSetBounds(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextOutputData::iBounds"));
+
+ TBool dataOk = ETrue;
+
+ // get rect Ax from parameters
+ TInt rectAx;
+ if(!GetIntFromConfig(aSection, KRectAx(), rectAx))
+ {
+ ERR_PRINTF2(_L("No %S"), &KRectAx());
+ SetBlockResult(EFail);
+ dataOk = EFalse;
+ }
+
+ // get rect Ay from parameters
+ TInt rectAy;
+ if(!GetIntFromConfig(aSection, KRectAy(), rectAy))
+ {
+ ERR_PRINTF2(_L("No %S"), &KRectAy());
+ SetBlockResult(EFail);
+ dataOk = EFalse;
+ }
+
+ // get rect Bx from parameters
+ TInt rectBx;
+ if(!GetIntFromConfig(aSection, KRectBx(), rectBx))
+ {
+ ERR_PRINTF2(_L("No %S"), &KRectBx());
+ SetBlockResult(EFail);
+ dataOk = EFalse;
+ }
+
+ // get rect By from parameters
+ TInt rectBy;
+ if(!GetIntFromConfig(aSection, KRectBy(), rectBy))
+ {
+ ERR_PRINTF2(_L("No %S"), &KRectBy());
+ SetBlockResult(EFail);
+ dataOk = EFalse;
+ }
+
+ // set the field
+ if (dataOk)
+ {
+ iMeasureTextOutput->iBounds.SetRect(rectAx, rectAy, rectBx, rectBy);
+ }
+ }
+
+
+/** Sets TMeasureTextOutputData::iMaxGlyphSize */
+void CT_DataMeasureTextOutput::DoCmdSetMaxGlyphSize(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Sets TMeasureTextOutputData::iMaxGlyphSize"));
+
+ TBool dataOk = ETrue;
+
+ // get width from parameters
+ TInt width;
+ if(!GetIntFromConfig(aSection, KWidth(), width))
+ {
+ ERR_PRINTF2(_L("No %S"), &KWidth());
+ SetBlockResult(EFail);
+ dataOk = EFalse;
+ }
+
+ // get height from parameters
+ TInt height;
+ if(!GetIntFromConfig(aSection, KHeight(), height))
+ {
+ ERR_PRINTF2(_L("No %S"), &KHeight());
+ SetBlockResult(EFail);
+ dataOk = EFalse;
+ }
+
+ // set the field
+ if (dataOk)
+ {
+ iMeasureTextOutput->iMaxGlyphSize.iWidth = width;
+ iMeasureTextOutput->iMaxGlyphSize.iHeight = height;
+ }
+ }
+
+
+
+///////////////////////////////// UTIL METHODS //////////////////////////////////////
+
+
+/**
+* Utility method that fetches a int value from parameters
+*/
+TBool CT_DataMeasureTextOutput::GetValueFromConfig(CDataWrapper& iInputStep, const TDesC& aSection, TInt& aValue)
+ {
+ TBool ret=iInputStep.GetIntFromConfig(aSection, KValue(), aValue);
+ if (!ret)
+ {
+ iInputStep.ERR_PRINTF2(_L("No %S"), &KValue());
+ iInputStep.SetBlockResult(EFail);
+ }
+
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataPalette.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataPalette
+*/
+
+#include "T_DataPalette.h"
+#include "T_GraphicsUtil.h"
+
+
+/*@{*/
+/// Parameters
+_LIT(KNumberOfColors, "number_of_colors");
+_LIT(KDisplayMode, "displaymode");
+
+/// Commands
+_LIT(KCmdNewL, "NewL");
+_LIT(KCmdNewDefaultL, "NewDefaultL");
+_LIT(KCleanup, "~");
+/*@}*/
+
+
+/**
+* Two phase constructor
+*/
+CT_DataPalette* CT_DataPalette::NewL()
+ {
+ CT_DataPalette* ret = new (ELeave) CT_DataPalette();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataPalette::CT_DataPalette()
+: CDataWrapperBase()
+, iPalette(NULL)
+ {
+ }
+
+
+/**
+* Protected second phase construction
+*/
+void CT_DataPalette::ConstructL()
+ {
+ }
+
+
+/**
+* Destructor.
+*/
+CT_DataPalette::~CT_DataPalette()
+ {
+ DestroyData();
+ }
+
+
+/**
+* cleanup implementation.
+*/
+void CT_DataPalette::DestroyData()
+ {
+ delete iPalette;
+ iPalette = NULL;
+ }
+
+
+/**
+* Return a pointer to the object that the data wraps
+*
+* @return pointer to the object that the data wraps
+*/
+TAny* CT_DataPalette::GetObject()
+ {
+ return iPalette;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataPalette::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdNewL)
+ {
+ DoCmdNew(aSection);
+ }
+ else if (aCommand == KCmdNewDefaultL)
+ {
+ DoCmdNewDefault(aSection);
+ }
+ else if (aCommand == KCleanup)
+ {
+ DestroyData();
+ }
+ else
+ {
+ retVal=EFalse;
+ }
+
+ return retVal;
+ }
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+/** Creates a default palette for the display mode specified */
+void CT_DataPalette::DoCmdNew(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CPalette::NewL() creates a new palette with a given number of colors"));
+ // cleanup if any
+ delete iPalette;
+ iPalette = NULL;
+
+ // get number of colors from parameters
+ TInt numberOfColors;
+ if(!GetIntFromConfig(aSection, KNumberOfColors(), numberOfColors))
+ {
+ ERR_PRINTF2(_L("No %S"), &KNumberOfColors());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // create new palette
+ TRAPD(err, iPalette = CPalette::NewL(numberOfColors));
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("CPalette::NewL error: %d"), err);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Creates a default palette for the display mode specified */
+void CT_DataPalette::DoCmdNewDefault(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CPalette::NewDefaultL() creating a default palette for the display mode specified"));
+
+ // cleanup if any
+ delete iPalette;
+ iPalette = NULL;
+
+ // get display mode from parameters
+ TDisplayMode displayMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), displayMode) )
+ {
+ ERR_PRINTF1(_L("No display mode"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // create new palette
+ TRAPD(err, iPalette = CPalette::NewDefaultL(displayMode));
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("CPalette::NewDefaultL error: %d"), err);
+ SetBlockResult(EFail);
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/gdi/src/T_DataTypefaceStore.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,368 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataTypefaceStore
+*/
+
+#include "T_DataTypefaceStore.h"
+
+/*@{*/
+/// Parameters
+_LIT(KFont, "font");
+_LIT(KFontDataObjectName, "font_data_object_name");
+_LIT(KFontMaxHeight, "font_max_height");
+_LIT(KTypefaceIndex, "typeface_index");
+_LIT(KHeightIndex, "height_index");
+_LIT(KTypefaces, "typefaces");
+_LIT(KCheckHeightPositive, "check_height_positive");
+
+/// Commands
+_LIT(KCmdFontHeightInTwips, "FontHeightInTwips");
+_LIT(KCmdGetNearestFontInTwips, "GetNearestFontInTwips");
+_LIT(KCmdGetNearestFontToDesignHeightInTwips, "GetNearestFontToDesignHeightInTwips");
+_LIT(KCmdGetNearestFontToMaxHeightInTwips, "GetNearestFontToMaxHeightInTwips");
+_LIT(KCmdNumTypefaces, "NumTypefaces");
+_LIT(KCmdReleaseFont, "ReleaseFont");
+_LIT(KCmdTypefaceSupport, "TypefaceSupport");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+/*@}*/
+
+/**
+* Constructor. First phase construction
+*/
+CT_DataTypefaceStore::CT_DataTypefaceStore()
+: CDataWrapperBase()
+ {
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataTypefaceStore::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal = ETrue;
+
+ if (aCommand == KCmdGetNearestFontInTwips)
+ {
+ DoCmdGetNearestFontInTwipsL(aSection);
+ }
+ else if (aCommand == KCmdGetNearestFontToMaxHeightInTwips)
+ {
+ DoCmdGetNearestFontToMaxHeightInTwipsL(aSection);
+ }
+ else if (aCommand == KCmdNumTypefaces)
+ {
+ DoCmdNumTypefaces(aSection);
+ }
+ else if (aCommand == KCmdTypefaceSupport)
+ {
+ DoCmdTypefaceSupport(aSection);
+ }
+ else if (aCommand == KCmdFontHeightInTwips)
+ {
+ DoCmdFontHeightInTwips(aSection);
+ }
+ else if (aCommand == KCmdGetNearestFontToDesignHeightInTwips)
+ {
+ DoCmdGetNearestFontToDesignHeightInTwipsL(aSection);
+ }
+ else if (aCommand == KCmdReleaseFont)
+ {
+ DoCmdReleaseFontL(aSection);
+ }
+ else
+ {
+ retVal = EFalse;
+ }
+
+ return retVal;
+ }
+
+
+////////////////// COMMANDS IMPLEMENTATION ////////////////////////
+
+
+/** Call CTypefaceStore::GetNearestFontInTwips() */
+void CT_DataTypefaceStore::DoCmdGetNearestFontInTwipsL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CTypefaceStore::GetNearestFontInTwips()"));
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFont, fontSpec) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFont());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call CTypefaceStore::GetNearestFontInTwips()
+ CFont* font = NULL;
+ TInt err = GetTypefaceStore()->GetNearestFontInTwips(font, fontSpec);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ // set font data object of provided
+ SetFontDataObjectIfPassedAsParameterL(font, aSection);
+ }
+ }
+ }
+
+
+/** Call CTypefaceStore::GetNearestFontToDesignHeightInTwips() */
+void CT_DataTypefaceStore::DoCmdGetNearestFontToDesignHeightInTwipsL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CTypefaceStore::GetNearestFontToDesignHeightInTwips()"));
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFont, fontSpec) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFont());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call CTypefaceStore::GetNearestFontToDesignHeightInTwips()
+ CFont* font = NULL;
+ TInt err = GetTypefaceStore()->GetNearestFontToDesignHeightInTwips(font, fontSpec);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ // set font data object of provided
+ SetFontDataObjectIfPassedAsParameterL(font, aSection);
+ }
+ }
+ }
+
+
+/** Call CTypefaceStore::GetNearestFontToMaxHeightInTwips() */
+void CT_DataTypefaceStore::DoCmdGetNearestFontToMaxHeightInTwipsL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CTypefaceStore::GetNearestFontToMaxHeightInTwips()"));
+
+ TBool dataOk=ETrue;
+
+ TFontSpec fontSpec;
+ if ( !GetFontSpecFromConfig(aSection, KFont, fontSpec) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFont());
+ SetBlockResult(EFail);
+ }
+
+ // get font maximum height from parameters
+ TInt fontMaxHeight;
+ if(!GetIntFromConfig(aSection, KFontMaxHeight(), fontMaxHeight))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFontMaxHeight());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // call CTypefaceStore::GetNearestFontToMaxHeightInTwips()
+ CFont* font = NULL;
+ TInt err = GetTypefaceStore()->GetNearestFontToMaxHeightInTwips(font, fontSpec, fontMaxHeight);
+
+ // check error code
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Get nearest font to max height in twips error: %d"), err);
+ SetError(err);
+ }
+ else
+ {
+ // set font data object of provided
+ SetFontDataObjectIfPassedAsParameterL(font, aSection);
+
+ // check that the height of the returned font is not greater that the maximum specified
+ TFontSpec fontSpecInTwips = font->FontSpecInTwips();
+ TInt actualHeight = fontSpecInTwips.iHeight;
+ if (actualHeight > fontMaxHeight)
+ {
+ ERR_PRINTF3(_L("Font doesn't match in maximum specified, height: %d, maximum: %d"), actualHeight, fontMaxHeight);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+
+/** Call CTypefaceStore::NumTypefaces() */
+void CT_DataTypefaceStore::DoCmdNumTypefaces(const TDesC& aSection)
+ {
+ TInt actual=GetTypefaceStore()->NumTypefaces();
+ INFO_PRINTF2(_L("Call CTypefaceStore::NumTypefaces() %d"), actual);
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KTypefaces(), expected) )
+ {
+ if ( actual != expected )
+ {
+ ERR_PRINTF3(_L("Actual typfaces %d does not match expected %d"), actual, expected);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** Call CTypefaceStore::TypefaceSupport() for the given index */
+void CT_DataTypefaceStore::DoCmdTypefaceSupport(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CTypefaceStore::TypefaceSupport() for the given index"));
+ // get typeface index from parameters
+ TInt typefaceIndex;
+ if(!GetIntFromConfig(aSection, KTypefaceIndex(), typefaceIndex))
+ {
+ ERR_PRINTF2(_L("No %S"), &KTypefaceIndex());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call TypefaceSupport()
+ TTypefaceSupport typefaceSupport;
+ GetTypefaceStore()->TypefaceSupport(typefaceSupport, typefaceIndex);
+ INFO_PRINTF2(_L("iIsScalable %d"), typefaceSupport.iIsScalable);
+ INFO_PRINTF2(_L("iMaxHeightInTwips %d"), typefaceSupport.iMaxHeightInTwips);
+ INFO_PRINTF2(_L("iMinHeightInTwips %d"), typefaceSupport.iMinHeightInTwips);
+ INFO_PRINTF2(_L("iNumHeights %d"), typefaceSupport.iNumHeights);
+ }
+ }
+
+
+/** Call CTypefaceStore::FontHeightInTwips() */
+void CT_DataTypefaceStore::DoCmdFontHeightInTwips(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call CTypefaceStore::FontHeightInTwips()"));
+ TBool dataOk=ETrue;
+
+ // get typeface index from parameters
+ TInt typefaceIndex;
+ if(!GetIntFromConfig(aSection, KTypefaceIndex(), typefaceIndex))
+ {
+ ERR_PRINTF2(_L("No %S"), &KTypefaceIndex());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ // get height index from parameters
+ TInt heightIndex;
+ if(!GetIntFromConfig(aSection, KHeightIndex(), heightIndex))
+ {
+ ERR_PRINTF2(_L("No %S"), &KHeightIndex());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ if ( dataOk )
+ {
+ TInt typefaceHeight = GetTypefaceStore()->FontHeightInTwips(typefaceIndex, heightIndex);
+ INFO_PRINTF2(_L("Typeface height %d"), typefaceHeight);
+
+ // get positive height check flag from parameters
+ TBool checkHeightPositive = EFalse;
+ GetBoolFromConfig(aSection, KCheckHeightPositive(), checkHeightPositive);
+
+ // check that typeface height is positive
+ if ( checkHeightPositive && (typefaceHeight<=0) )
+ {
+ ERR_PRINTF2(_L("Typeface height is not greater than 0, height: %d"), typefaceHeight);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+/** CTypefaceStore::ReleaseFont() call */
+void CT_DataTypefaceStore::DoCmdReleaseFontL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("CTypefaceStore::ReleaseFont() call"));
+
+ CT_DataFont* fontDataObject=GetFontDataObjectFromParameterL(KFontDataObjectName(), aSection);
+
+ if (fontDataObject == NULL)
+ {
+ ERR_PRINTF1(_L("Font data wrapper was not found"));
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ GetTypefaceStore()->ReleaseFont(static_cast<CFont*>(fontDataObject->GetObject()));
+ }
+ }
+
+
+///////////////////////////////// UTIL METHODS //////////////////////////////////////
+
+
+/**
+* Utility method that sets CT_DataFont with a new font if the name of the data object was passed as a parameter from INI-file.
+*/
+void CT_DataTypefaceStore::SetFontDataObjectIfPassedAsParameterL(CFont* aFont, const TDesC& aSection)
+ {
+ // fetch data object
+ CT_DataFont* fontDataObject = GetFontDataObjectFromParameterL(KFontDataObjectName(), aSection);
+ if ( fontDataObject != NULL )
+ {
+ // set obtained font for the data object
+ fontDataObject->SetObjectL(aFont);
+ }
+ }
+
+
+/**
+* Utility method that fetches CT_DataFont pointer by command parameter name from INI-file.
+*/
+CT_DataFont* CT_DataTypefaceStore::GetFontDataObjectFromParameterL(const TDesC& aParameterName, const TDesC& aSection)
+ {
+ CT_DataFont* ret = NULL;
+
+ // get FontData object from parameters
+ TPtrC fontDataObjectName;
+ if ( GetStringFromConfig(aSection, aParameterName, fontDataObjectName) )
+ {
+ // check that the data object was found
+ ret = static_cast<CT_DataFont*>(GetDataWrapperL(fontDataObjectName));
+ }
+
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/group/T_AnimPlugin.mmp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,44 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET t_animplugin.dll
+TARGETTYPE ANI
+UID 268450594 0x100048F2
+
+USERINCLUDE ../inc
+SYSTEMINCLUDE /epoc32/include
+
+
+
+//By default, the build tools look for the WINSCW def file in a BWINS directory
+//(at the same level as the directory containing the mmp file),
+//the GCC ARM def file in a BMARM directory, and the ARMV5 def file in a EABI directory.
+//If def files are stored in these locations, the project files does not need to specify
+//the location of the def files explicitly. If you want to store the def files in some other
+//location, you will need to specify in the project file where the .def files are using
+//the deffile keyword.
+
+
+LIBRARY euser.lib efsrv.lib bitgdi.lib bafl.lib gdi.lib
+
+
+SOURCEPATH ../src
+SOURCE T_TestAnimDll.cpp T_TWinAnim.cpp T_log.cpp T_AnimProc.cpp T_TSpriteAnim.cpp T_TFreeTimerWinAnim.cpp
+
+NOEXPORTLIBRARY
+NOSTRICTDEF
+
+CAPABILITY PowerMgmt ProtServ ReadDeviceData WriteDeviceData
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/group/bld.inf Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+T_AnimPlugin.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/inc/T_AnimDef.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef ANIMDEF_H_
+#define ANIMDEF_H_
+
+
+//Anim type
+#define EKWindowAnim 1
+#define EKSpriteAnim 2
+#define EKFreeTimerWindowAnim 3
+
+
+//command for RAnim::Command
+#define ECmdSync 1
+
+#define ECmdTestWithoutPara 100
+#define ECmdTestWithPara 101
+#define ECmdGetLast 102
+#define ECmdGetAnimInterval 103
+
+enum TCommandsForAnimMClass
+ {
+ ECmdNone = 150,
+ ECmdRetrieveResult,
+ ECmdGeneralAnimate,
+ ECmdGeneralSetSync,
+ ECmdGeneralSync,
+ ECmdGeneralSystemTime,
+ ECmdGeneralSetInterval,
+ ECmdGeneralSetNextInterval,
+ ECmdGeneralClient,
+ ECmdGeneralScreenDevice,
+ ECmdGeneralEventExtension,
+ ECmdGeneralWindowExtension,
+ ECmdGeneralExtendedInterface,
+ ECmdGeneralNumOfExtInterfaces,
+ ECmdGeneralPanic,
+ ECmdGeneralReplyBuf,
+ ECmdGeneralFlashStateOn,
+ ECmdGeneralDuplicateBitmapL,
+ ECmdGeneralDuplicateFontL,
+ ECmdGeneralCloseFont,
+ ECmdGeneralGetRawEvents,
+ ECmdGeneralPostKeyEvent,
+ ECmdGeneralPostRawEvent,
+ ECmdGeneralMessage,
+ ECmdGeneralRegisterForNotis,
+ ECmdSpriteGetSpriteMember,
+ ECmdSpriteUpdateMember,
+ ECmdSpriteActivate,
+ ECmdSpriteSpriteCanBeSeen,
+ ECmdSpriteSizeChangedL,
+ ECmdSpriteSetPosition,
+ ECmdGfweFocusScreens,
+ ECmdGfweScreens,
+ ECmdGfweSetFocusScreen,
+ ECmdGfweSetOrdinalPosition,
+ ECmdGfweWindowGroupInfo,
+ ECmdGfweWindowGroupName,
+ ECmdGfweWindowGroups,
+ ECmdGfweIsFocusable,
+ ECmdWindowActivateGc,
+ ECmdWindowInvalidate,
+ ECmdWindowParameters,
+ ECmdWindowIsHidden,
+ ECmdWindowSetRect,
+ ECmdWindowSetVisible,
+ ECmdWindowVisibleRegion,
+ ECmdWindowWindowSize,
+ ECmdFreeTimerWinDeactivateGc,
+ ECmdFreeTimerWinUpdate,
+ ECmdWindowIsStarted,
+ ECmdReceiveResult,
+ ECmdGeneralReplyBuf8,
+ ECmdGeneralReplyBuf16,
+
+ ECmdUtilEatupMemory,
+ ECmdUtilFreeEatenMemory
+};
+
+#endif /*ANIMDEF_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/inc/T_AnimProc.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,92 @@
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef ANIMPROC_H
+#define ANIMPROC_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "T_TestAnimDll.h"
+#include "badesca.h"
+#include "e32cmn.h"
+
+// CLASS DECLARATION
+#define KAnimTimeSize 3
+
+
+
+typedef RArray<TInt> RIntArray;
+
+/**
+* CAnimProc
+*
+*/
+class CAnimProc
+{
+public: // Constructors and destructor
+
+ CAnimProc(CTestAnimDll* aDll,TInt aType);
+ virtual ~CAnimProc();
+
+ TInt CmdReply(MAnimGeneralFunctions* pFunc, TInt aOpcode, TAny *aArgs);
+
+
+ TInt ConstructWinL(TAny *aArgs,MAnimGeneralFunctions* pFunc);
+
+ TInt WriteLog(const TDesC& aInfo);
+ TInt WriteLog(const TDesC8& aInfo);
+protected:
+
+ CDesCArray* ProcParamLC(const TDesC8& param);
+ void ConvertParam(TDes8& buf,TAny *aArgs);
+ TInt GetIntFromStr(const TDesC& str,RIntArray& ary);
+
+ void RecordAnimTime();
+
+ void RecordLastCmd(TInt cmd);
+ void RecordLastCmd(TInt cmd,const TDesC8& str);
+ void RecordLastCmd(const TDesC8& str);
+
+ TInt64 iAnimTime[KAnimTimeSize]; // last time of Animate
+
+
+ TPoint iNewPoint; // The square's current position
+ TPoint iLastPoint; // The square's last position
+
+ TInt iStepX; // move step of x-coordinate
+ TInt iStepY; // move step of y-coordinate
+
+ TSize iSize; // The square's size
+
+ TRect iScreenSize; // The screen size
+
+ TInt iDrawType; // draw type
+
+ TSize iPenSize; // pen size
+
+ TBool iDrawn; // Has the animation been drawn
+
+ TRgb iColor; // draw color
+
+ CTestAnimDll* iDll; // anim dll
+
+ RBuf iLastCommand; // store last command & parameter
+
+ TInt iAnimType; // animation type
+};
+
+#endif // ANIMPROC_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/inc/T_TFreeTimerWinAnim.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef CFREETIMERWINANIM_H
+#define CFREETIMERWINANIM_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <w32adll.h>
+// CLASS DECLARATION
+
+/**
+ * CTFreeTimerWinAnim
+ *
+ */
+class CTFreeTimerWinAnim : public CFreeTimerWindowAnim
+ {
+public:
+ CTFreeTimerWinAnim();
+ ~CTFreeTimerWinAnim();
+
+ //from CAnim
+ virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
+ virtual void Command(TInt aOpcode, TAny *aArgs);
+ virtual void Animate(TDateTime *aDateTime);
+ //from MEventHandler
+ virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
+ //from CWindowAnim
+ virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
+ virtual void Redraw();
+ virtual void FocusChanged(TBool aState);
+
+private:
+ TBool iResult;
+ TInt iCurrentCommand;
+ TRect iScreenSize; // The screen size
+ }; // class CTFreeTimerWinAnim
+
+#endif // CFREETIMERWINANIM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/inc/T_TSpriteAnim.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,77 @@
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef SPRITEANIM_H
+#define SPRITEANIM_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "w32adll.h"
+#include "w32std.h"
+
+
+
+
+// CLASS DECLARATION
+
+/**
+* CWinAnim
+*
+*/
+
+class CTestAnimDll;
+class CAnimProc;
+
+class CTSpriteAnim: public CSpriteAnim, CAnimProc
+{
+public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CTSpriteAnim();
+
+ /**
+ * Constructor for performing 1st stage construction
+ */
+ CTSpriteAnim(CTestAnimDll* aDll, TInt aType);
+
+ virtual void ConstructL(TAny *aArgs);
+ virtual void Redraw();
+ virtual void FocusChanged(TBool aState);
+ virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
+ virtual void Command(TInt aOpcode, TAny *aArgs);
+ virtual void Animate(TDateTime *aDateTime);
+ virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
+
+private:
+ void Draw();
+ void Compare();
+
+ TInt DoCmdGetSpriteMemberL();
+ TInt DoCmdActiveL();
+ TInt DoCmdSetPositionL();
+ TInt DoCmdSpriteCanBeSeen();
+ TInt DoCmdUpdateMemberL();
+ TInt DoCmdSizeChangeL();
+
+protected:
+
+
+};
+
+#endif // WINANIM_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/inc/T_TWinAnim.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,172 @@
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef WINANIM_H
+#define WINANIM_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "w32adll.h"
+#include "w32std.h"
+#include "T_AnimProc.h"
+
+
+// CLASS DECLARATION
+
+/**
+* MTimeoutNotify
+*
+*/
+class MTimeoutNotify
+ {
+ public:
+
+ /**
+ * TimedOut
+ * Handle the event when a time out occurs.
+ */
+ virtual void TimedOut() = 0;
+ };
+
+/**
+* CTimeOutTimer
+*/
+class CTimeOutTimer : public CTimer
+ {
+ public: // Constructors and destructor
+
+ static CTimeOutTimer* NewL( const TInt aPriority,
+ MTimeoutNotify& aTimeOutNotify );
+ virtual ~CTimeOutTimer();
+
+ public: // From CTimer
+ void RunL();
+
+ protected: // Constructor
+ CTimeOutTimer( const TInt aPriority, MTimeoutNotify& aTimeOutNotify );
+
+ protected: // Constructor
+ void ConstructL();
+
+ private:
+ MTimeoutNotify& iNotify;
+ };
+
+/**
+* CWinAnim
+*
+*/
+
+const TInt KBufMessage = 200;
+
+class CTestAnimDll;
+
+class CTWinAnim : public CWindowAnim, CAnimProc , public MTimeoutNotify
+{
+public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CTWinAnim();
+
+ /**
+ * Constructor for performing 1st stage construction
+ */
+ CTWinAnim(CTestAnimDll* aDll, TInt aType);
+
+ virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
+ virtual void Redraw();
+ virtual void FocusChanged(TBool aState);
+ virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
+ virtual void Command(TInt aOpcode, TAny *aArgs);
+ virtual void Animate(TDateTime *aDateTime);
+ virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
+ virtual void HandleNotification(const TWsEvent &aEvent);
+public:
+ virtual void TimedOut();
+
+private:
+ void Draw();
+ void Compare();
+
+//for M class testing
+private:
+ //for MAnimWindowFunctions
+ TInt DoCmdSetRect();
+ TInt DoCmdWindowSize();
+ TInt DoCmdSetVisible();
+ TInt DoCmdInvalidate();
+ TInt DoCmdParameters();
+ TInt DoCmdVisibleRegion();
+ //for MAnimGeneralFunctionsWindowExtension
+ TInt DoCmdSetFocusScreen();
+ TInt DoCmdWindowGroups();
+ TBool DoCmdWindowGroupInfo();
+ TBool DoCmdWindowGroupName();
+ TInt DoCmdSetOrdinalPosition();
+ TBool DoCmdIsFocusable();
+ //for MAnimGeneralFunctions
+ TInt DoCmdDuplicateBitmapL();
+ TInt DoCmdDuplicateFontL();
+ TInt DoCmdCloseFontL();
+ TInt DoCmdSetIntervalL();
+ TInt DoCmdSetNextIntervalL();
+ TInt DoCmdSystemTimeL();
+ TInt DoCmdRegisterForNotisL();
+ TInt DoCmdMessageL();
+ TInt DoCmdAnimateL();
+ TInt DoCmdFlashStateOn();
+ TInt DoCmdPanic();
+ TInt DoCmdScreenDevice();
+ TInt DoCmdWindowExtension();
+ TInt DoCmdEventExtension();
+ TInt DoCmdExtendedInterfaceL();
+ TInt DoCmdNumOfExtInterfaces();
+ TInt DoCmdSetSyncL();
+ TInt DoCmdSync();
+ TInt DoCmdGetRawEventsL();
+ TInt DoCmdPostRawEventL();
+ TInt DoCmdPostKeyEventL();
+ TInt DoCmdClient();
+ TInt DoCmdGeneralReplyBuf8L();
+ TInt DoCmdGeneralReplyBuf16L();
+
+ //Util
+ TInt DoCmdEatupMemory();
+ TInt DoCmdFreeEatenMemory();
+ void FreeMemory();
+
+private:
+ CTimeOutTimer* iServerTimer;
+ MAnimGeneralFunctions::TAnimSync iSyncMode;
+ TInt iCurrentCommand;
+ CFbsBitmap* iDuplicateBitmap;
+ CFbsFont* iDuplicateFont;
+ TDateTime iDateTime;
+ TInt iResult;
+ TDateTime iAnimateTime;
+ TInt64* iIntervalTimeStamp;
+ TInt iInterval;
+ TInt iNextInterval;
+ TEventCode iExpectEventCode;
+ TInt iAvaiableSpace;
+ TInt iBiggestBlock;
+ RPointerArray < TAny > iMemArray;
+};
+
+#endif // WINANIM_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/inc/T_TestAnimDll.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,74 @@
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef TESTANIMDLL_H
+#define TESTANIMDLL_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "w32adll.h"
+#include "T_log.h"
+
+// CLASS DECLARATION
+
+/**
+* CTestAnimDll
+*
+*/
+class CTestAnimDll : public CAnimDll
+{
+public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CTestAnimDll();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CTestAnimDll* NewL();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CTestAnimDll* NewLC();
+
+ virtual CAnim *CreateInstanceL(TInt aType);
+
+ TInt WriteLog(const TDesC& aInfo);
+ TInt WriteLog(const TDesC8& aInfo);
+
+protected:
+ CLog* iLog;
+ RFs iFs;
+
+private:
+
+ /**
+ * Constructor for performing 1st stage construction
+ */
+ CTestAnimDll();
+
+ /**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+ void ConstructL();
+
+};
+
+#endif // TESTANIMDLL_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/inc/T_log.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,47 @@
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef LOG_H_
+#define LOG_H_
+
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>
+
+
+class CLog : public CBase
+{
+public: // Constructors and destructor
+ ~CLog();
+ static CLog* NewL(RFs &aFs, const TDesC &aFileName);
+ static CLog* NewLC(RFs &aFs, const TDesC &aFileName);
+
+ //write log
+ TInt WriteLog(const TDesC& aInfo);
+ TInt WriteLog(const TDesC8& aInfo);
+private:
+ //Constructor for performing 1st stage construction
+ CLog();
+
+ //EPOC default constructor for performing 2nd stage construction
+ void ConstructL(RFs &aFs, const TDesC &aFileName);
+
+ RFile iFile; //log file object
+ TFileText iText;
+ RBuf8 iBuf;
+};
+
+
+#endif /*LOG_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/src/T_AnimProc.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,429 @@
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "T_AnimProc.h"
+#include "T_AnimDef.h"
+
+#define KMaxBufSize 250
+
+_LIT(KLim1,";");
+_LIT(KLim2,",");
+
+_LIT8(KSyncSecond,"ESyncSecond");
+_LIT8(KSyncMinute,"ESyncMinute");
+_LIT8(KSyncFlash,"ESyncFlash");
+_LIT8(KSyncNone,"ESyncNone");
+
+
+CAnimProc::CAnimProc(CTestAnimDll* aDll,TInt aType)
+ {
+ for (TInt i=0;i<KAnimTimeSize;i++)
+ iAnimTime[i]=0;
+
+ iNewPoint.SetXY (0, 0);
+ iLastPoint.SetXY (0, 0);
+
+ iStepX=0;
+ iStepY=0;
+ iDll=aDll;
+
+ iAnimType=aType;
+
+ }
+
+
+CAnimProc::~CAnimProc()
+ {
+ iLastCommand.Close();
+ }
+TInt CAnimProc::WriteLog(const TDesC& aInfo)
+ {
+ return iDll->WriteLog(aInfo);
+ }
+TInt CAnimProc::WriteLog(const TDesC8& aInfo)
+ {
+ return iDll->WriteLog(aInfo);
+ }
+
+
+
+void CAnimProc::ConvertParam(TDes8& buf, TAny *aArgs)
+ {
+ if ( aArgs)
+ {
+ buf.Zero();
+
+ TUint8* p=STATIC_CAST(TUint8*,aArgs);
+ TInt len=p[0];
+
+ if ( len>0)
+ buf.Copy (p+1, len);
+ }
+ }
+
+void CAnimProc::RecordLastCmd(TInt cmd)
+ {
+ iLastCommand.Format(_L("%d"),cmd);
+ }
+void CAnimProc::RecordLastCmd(TInt cmd,const TDesC8& str)
+ {
+ TBuf<KMaxBufSize> buf;
+ buf.Copy(str);
+ iLastCommand.Format(_L("%d %S"),cmd,&buf);
+ }
+void CAnimProc::RecordLastCmd(const TDesC8& str)
+ {
+ iLastCommand.Copy(str);
+ }
+TInt CAnimProc::CmdReply(MAnimGeneralFunctions* pFunc , TInt aOpcode,
+ TAny *aArgs)
+ {
+ TBuf<KMaxBufSize> logbuf;
+ TBuf<KMaxBufSize> msgbuf;
+ logbuf.Format (_L("CAnimProc::CmdReplyL %d"),aOpcode);
+ WriteLog(logbuf);
+
+ TBuf8<KMaxBufSize> arg;
+
+ TInt ret,slot;
+ TBool msgexist=EFalse,argexist=ETrue,userpanic=EFalse;
+
+ // check is msg exist
+ const RMessagePtr2 *msg=pFunc->Message();
+ if ( msg && !msg->IsNull())
+ {
+ for (TInt i=1;i<4;i++)
+ {
+ ret=msg->Read (i, msgbuf);
+ if ( ret==KErrNone)
+ {
+ slot=i;
+ msgexist=ETrue;
+ break;
+ }
+ }
+ }
+
+ switch (aOpcode)
+ {
+ case ECmdTestWithoutPara:
+ {
+ argexist=EFalse;
+ if (msgexist)
+ {
+ RecordLastCmd (aOpcode);
+ ret=msg->Write(slot,iLastCommand);
+ // this function should only used for AsyncCommandReply, otherwise emulator will crash.
+ msg->Complete(KErrNone);
+ }
+ break;
+ }
+ case ECmdTestWithPara:
+ {
+ ConvertParam(arg, aArgs);
+ WriteLog(arg);
+ if (msgexist)
+ {
+ RecordLastCmd (aOpcode, arg);
+ msg->Write(slot,iLastCommand);
+ }
+ break;
+ }
+ case ECmdGetLast:
+ {
+ argexist=EFalse;
+ if (msgexist)
+ {
+ logbuf.Format (_L("send last command %S"),&iLastCommand);
+ WriteLog(logbuf);
+ msg->Write(slot,iLastCommand);
+ }
+ else
+ userpanic=ETrue;
+ break;
+ }
+ case ECmdSync:
+ {
+ ConvertParam(arg, aArgs);
+ WriteLog(arg);
+ MAnimGeneralFunctions::TAnimSync sync;
+ if (arg.Compare(KSyncSecond)==0)
+ sync=MAnimGeneralFunctions::ESyncSecond;
+ else if (arg.Compare(KSyncNone)==0)
+ sync=MAnimGeneralFunctions::ESyncNone;
+ else if (arg.Compare(KSyncFlash)==0)
+ sync=MAnimGeneralFunctions::ESyncFlash;
+ else if (arg.Compare(KSyncMinute)==0)
+ sync=MAnimGeneralFunctions::ESyncMinute;
+ else
+ {
+ userpanic=ETrue;
+ break;
+ }
+
+ pFunc->SetSync(sync);
+ break;
+ }
+ case ECmdGetAnimInterval:
+ {
+ argexist=EFalse;
+ if (msgexist)
+ {
+ TInt i1,i2;
+ i1=(iAnimTime[1]-iAnimTime[0])/1000;
+ i2=(iAnimTime[2]-iAnimTime[1])/1000;
+ if (i1>i2)
+ {
+ TInt tmp;
+ tmp=i1;
+ i1=i2;
+ i2=tmp;
+ }
+ msgbuf.Format(_L("%d %d"),i1,i2);
+ msg->Write(slot,msgbuf);
+ }
+ else
+ userpanic=ETrue;
+ break;
+ }
+ default:
+ {
+ userpanic=ETrue;
+ break;
+ }
+ }
+
+ if ( userpanic)
+ pFunc->Panic ();
+ else
+ {
+ if ( argexist)
+ RecordLastCmd (aOpcode, arg);
+ else
+ RecordLastCmd (aOpcode);
+
+
+ }
+ return KErrNone ;
+ }
+
+CDesCArray* CAnimProc::ProcParamLC(const TDesC8& param)
+ {
+ CDesCArrayFlat * ary= new (ELeave) CDesCArrayFlat(2);
+ CleanupStack::PushL(ary);
+ if ( param.Length ()>0)
+ {
+ TBuf<KMaxBufSize> buf;
+ TBuf<KMaxBufSize> tmp;
+ buf.Copy(param);
+
+ TInt idx;
+
+ do
+ {
+ idx=buf.Find(KLim1);
+ if (idx!=KErrNotFound )
+ {
+
+ tmp.Copy(buf.Ptr(),idx);
+ ary->AppendL(tmp);
+ buf.Delete(0,idx+1);
+ }
+ }
+
+ while (idx!=KErrNotFound);
+
+ if (buf.Length()>0)
+ ary->AppendL(buf);
+ }
+ return ary;
+ }
+TInt CAnimProc::GetIntFromStr(const TDesC& str,RIntArray& ary)
+ {
+ ary.Reset();
+ TInt val;
+
+ if ( str.Length ()>0)
+ {
+ TBuf<KMaxBufSize> buf;
+ TBuf<KMaxBufSize> tmp;
+ buf.Copy(str);
+
+ TInt idx;
+ do
+ {
+ idx=buf.Find(KLim2);
+ if (idx!=KErrNotFound )
+ {
+
+ tmp.Copy(buf.Ptr(),idx);
+ TLex lex(tmp);
+ lex.Val(val);
+ ary.Append(val);
+ buf.Delete(0,idx+1);
+ }
+ }
+
+ while (idx!=KErrNotFound);
+
+ if (buf.Length()>0)
+ {
+ TLex lex(buf);
+ lex.Val(val);
+ ary.Append(val);
+ }
+ }
+
+ return KErrNone;
+ }
+void CAnimProc::RecordAnimTime()
+ {
+ TTime currentTime;
+ currentTime.HomeTime();
+
+ for (TInt i=0;i<KAnimTimeSize-1;i++)
+ iAnimTime[i]=iAnimTime[i+1];
+
+ iAnimTime[KAnimTimeSize-1]=currentTime.Int64();
+ }
+TInt CAnimProc::ConstructWinL(TAny *aArgs,MAnimGeneralFunctions* pFunc)
+ {
+ iLastCommand.CreateL(KMaxBufSize);
+
+ TInt ret,val;
+
+ TBuf8<KMaxBufSize> param;
+ ConvertParam(param, aArgs);
+ WriteLog(param);
+
+ RecordLastCmd(iAnimType,param);
+
+ TBuf<KMaxBufSize> buf;
+
+ CDesCArray* ary=ProcParamLC(param);
+ TInt len=ary->Count();
+
+ RIntArray intary;
+ CleanupClosePushL(intary);
+
+
+ for (TInt i=0;i<len;i++)
+ {
+ const TDesC& str=(*ary)[i];
+// WriteLog (str);
+ switch (i)
+ {
+ case 0: //start point
+ {
+ GetIntFromStr(str,intary);
+ if (intary.Count()!=2)
+ ret=KErrArgument;
+ else
+ {
+ iLastPoint.SetXY( intary[0], intary[1] );
+ iNewPoint.SetXY( intary[0], intary[1] );
+ buf.Format(_L("start poinx x=%d y=%d"),iNewPoint.iX,iNewPoint.iY);
+ WriteLog (buf);
+ }
+ break;
+ }
+ case 1: //step
+ {
+ GetIntFromStr(str,intary);
+ if (intary.Count()!=2)
+ ret=KErrArgument;
+ else
+ {
+ iStepX = intary[0];
+ iStepY =intary[1];
+ buf.Format(_L("step x=%d y=%d"),iStepX,iStepY);
+ WriteLog (buf);
+ }
+ break;
+ }
+ case 2: //draw type
+ {
+ TLex lex(str);
+ lex.Val(val);
+ iDrawType=val;
+ buf.Format(_L("draw type=%d"),iDrawType);
+ WriteLog (buf);
+ break;
+ }
+ case 3: //draw rect
+ {
+ GetIntFromStr(str,intary);
+ if (intary.Count()!=2)
+ ret=KErrArgument;
+ else
+ {
+ iSize.SetSize( intary[0], intary[1]);
+ buf.Format(_L("draw rect width=%d height=%d"),iSize.iWidth,iSize.iHeight);
+ WriteLog (buf);
+ }
+ break;
+ }
+ case 4: //pen color
+ {
+ GetIntFromStr(str,intary);
+ if (intary.Count()!=3)
+ ret=KErrArgument;
+ else
+ {
+ iColor.SetRed( intary[0]);
+ iColor.SetGreen( intary[1]);
+ iColor.SetBlue( intary[2]);
+ buf.Format(_L("pen color r=%d g=%d b=%d"),iColor.Red(),iColor.Green(),iColor.Blue());
+ WriteLog (buf);
+ }
+ break;
+ }
+ case 5: //pen size
+ {
+ GetIntFromStr(str,intary);
+ if (intary.Count()!=2)
+ ret=KErrArgument;
+ else
+ {
+ iPenSize.SetSize( intary[0], intary[1]);
+ buf.Format(_L("pen size width=%d height=%d"),iPenSize.iWidth,iPenSize.iHeight);
+ WriteLog (buf);
+ }
+ break;
+ }
+ }
+ }
+
+
+ // initiates an initial position update
+ iDrawn = ETrue;
+
+ CleanupStack::PopAndDestroy(&intary);
+ CleanupStack::PopAndDestroy(ary);
+
+ const RMessagePtr2 *msg=pFunc->Message();
+ if ( msg && !msg->IsNull())
+ {
+ TBuf<KMaxBufSize> msgbuf;
+ ret=msg->Read (1, msgbuf);
+ if ( ret==KErrNone)
+ {
+ msg->Write(1,iLastCommand);
+ }
+ }
+
+ return ret;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/src/T_TFreeTimerWinAnim.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_AnimDef.h"
+
+#include "T_TFreeTimerWinAnim.h"
+
+CTFreeTimerWinAnim::CTFreeTimerWinAnim()
+ {
+ iResult=EFalse;
+ iCurrentCommand=ECmdNone;
+ }
+
+CTFreeTimerWinAnim::~CTFreeTimerWinAnim()
+ {
+ }
+
+//from CWindowAnim
+void CTFreeTimerWinAnim::ConstructL(TAny */*aArgs*/, TBool /*aHasFocus*/)
+ {
+ // Store the screen size
+ iScreenSize = iWindowFunctions->WindowSize();
+
+ // Set the screen visible
+ iWindowFunctions->SetVisible( ETrue );
+ //just for start heartbeat
+ iWindowFunctions->SetRect(TRect(0,0,1,1));
+ }
+
+void CTFreeTimerWinAnim::Redraw()
+ {
+ if(iCurrentCommand==ECmdFreeTimerWinUpdate)
+ {
+ iResult=ETrue;
+ }
+ }
+
+void CTFreeTimerWinAnim::FocusChanged(TBool /*aState*/)
+ {
+
+ }
+
+//from CAnim
+TInt CTFreeTimerWinAnim::CommandReplyL(TInt aOpcode, TAny */*aArgs*/)
+ {
+ iCurrentCommand=aOpcode;
+ TInt nReturn=KErrNone;
+ switch(aOpcode)
+ {
+ case ECmdFreeTimerWinDeactivateGc:
+ {
+ TRect rect(10,10,20,20);
+ TInt err;
+ iWindowFunctions->ActivateGc();
+ TRAP(err,iGc->DrawRect(rect));
+ if(KErrNone == err)
+ {
+ WindowFunctions()->DeactivateGc();
+ TRAP(err,iGc->DrawRect(rect));
+ if(KErrGeneral != err)
+ {
+ nReturn = err;
+ }
+ }
+ else
+ {
+ nReturn = err;
+ }
+ }
+ break;
+ case ECmdFreeTimerWinUpdate:
+ {
+ iResult=EFalse;
+ WindowFunctions()->Update();
+ }
+ break;
+ case ECmdRetrieveResult:
+ nReturn=iResult;
+ break;
+ }
+ return nReturn;
+ }
+
+void CTFreeTimerWinAnim::Command(TInt /*aOpcode*/, TAny */*aArgs*/)
+ {
+
+ }
+void CTFreeTimerWinAnim::Animate(TDateTime */*aDateTime*/)
+ {
+
+ }
+
+//from MEventHandler
+TBool CTFreeTimerWinAnim::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
+ {
+ return EFalse;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/src/T_TSpriteAnim.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "txtfrmat.h"
+#include "bitdev.h"
+#include "T_AnimProc.h"
+#include "T_TSpriteAnim.h"
+#include "T_TestAnimDll.h"
+#include "w32std.h"
+#include "T_AnimDef.h"
+
+CTSpriteAnim::CTSpriteAnim(CTestAnimDll* aDll, TInt aType) :
+ CAnimProc(aDll, aType)
+ {
+ // No implementation required
+
+ }
+
+CTSpriteAnim::~CTSpriteAnim()
+ {
+ WriteLog(_L("~CTSpriteAnim"));
+ }
+
+void CTSpriteAnim::ConstructL(TAny *aArgs)
+ {
+ WriteLog(_L("CTSpriteAnim::ConstructL"));
+ ConstructWinL(aArgs, iFunctions);
+
+ // screen size
+ iFunctions->ScreenDevice()->GetDrawRect(iScreenSize);
+ }
+void CTSpriteAnim::Redraw()
+ {
+ WriteLog(_L("CTSpriteAnim::Redraw"));
+ Draw();
+ }
+
+void CTSpriteAnim::Draw()
+ {
+ // signal that the current position has been drawn
+ iDrawn = ETrue;
+ }
+void CTSpriteAnim::FocusChanged(TBool /*aState*/)
+ {
+
+ }
+TInt CTSpriteAnim::CommandReplyL(TInt aOpcode, TAny *aArgs)
+ {
+ switch (aOpcode)
+ {
+ case ECmdSpriteGetSpriteMember:
+ return DoCmdGetSpriteMemberL();
+ case ECmdSpriteUpdateMember:
+ return DoCmdUpdateMemberL();
+ case ECmdSpriteActivate:
+ return DoCmdActiveL();
+ case ECmdSpriteSpriteCanBeSeen:
+ return DoCmdSpriteCanBeSeen();
+ case ECmdSpriteSizeChangedL:
+ return DoCmdSizeChangeL();
+ case ECmdSpriteSetPosition:
+ return DoCmdSetPositionL();
+ default:
+ break;
+ }
+ return CmdReply(iFunctions, aOpcode, aArgs);
+ }
+void CTSpriteAnim::Command(TInt aOpcode, TAny *aArgs)
+ {
+ CmdReply(iFunctions, aOpcode, aArgs);
+ }
+void CTSpriteAnim::Animate(TDateTime* /*aDateTime*/)
+ {
+ iLastPoint = iNewPoint;
+
+ TInt nextpoint=iNewPoint.iX + iStepX;
+ TInt right=iNewPoint.iX + iSize.iWidth;
+
+ if (right> iScreenSize.iBr.iX ||nextpoint >= iScreenSize.iBr.iX
+ ||iNewPoint.iX<iScreenSize.iTl.iX)
+ iStepX = -iStepX;
+
+ TInt nexty=iNewPoint.iY + iStepY;
+ TInt bottom=nexty + iSize.iHeight;
+
+ if (bottom> iScreenSize.iBr.iY ||nexty >= iScreenSize.iBr.iY ||iNewPoint.iY
+ <iScreenSize.iTl.iY || nexty <= iScreenSize.iTl.iY)
+ iStepY = -iStepY;
+
+ iNewPoint.iX += iStepX;
+ iNewPoint.iY += iStepY;
+
+ iSpriteFunctions->SetPosition(iNewPoint);
+
+ RecordAnimTime();
+
+ TInt interval=(iAnimTime[KAnimTimeSize-1]-iAnimTime[KAnimTimeSize-2])/1000;
+
+ TBuf<100> buf;
+ buf.Format(_L("CTSpriteAnim::Animate interval=%d x=%d y=%d"),
+ interval,iNewPoint.iX,iNewPoint.iY);
+
+ WriteLog(buf);
+ }
+
+void CTSpriteAnim::Compare()
+ {
+ // compare
+ const CFbsScreenDevice* scdev=iFunctions->ScreenDevice();
+
+ TBool compare=scdev->RectCompare(TRect(iNewPoint, iSize), *scdev, TRect(
+ TPoint(0, 0), iSize));
+ TBuf<50> buf;
+ buf.Format(_L("CTSpriteAnim::Compare res %d"),
+ compare);
+ WriteLog(buf);
+ }
+TBool CTSpriteAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
+ {
+ return ETrue;
+ }
+
+TInt CTSpriteAnim::DoCmdGetSpriteMemberL()
+ {
+ TInt result = 0;
+ TInt aMember;
+ TPtr8 ptr1((TUint8*)&aMember, sizeof(TInt));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ TSpriteMember* member = iSpriteFunctions->GetSpriteMember(aMember);
+ TPoint point = member->iOffset;
+ TPtr8 ptr2((TUint8*)&point, sizeof(TPoint), sizeof(TPoint));
+ msg->Write(2, ptr2);
+
+ }
+ else
+ {
+ result = -1;
+ }
+ return result;
+
+ }
+
+TInt CTSpriteAnim::DoCmdActiveL()
+ {
+ TInt result = 0;
+ TBool aState;
+ TPtr8 ptr3((TUint8*)&aState, sizeof(TBool));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr3);
+ iSpriteFunctions->Activate(aState);
+ }
+ else
+ {
+ result = -1;
+ }
+ return result;
+ }
+
+TInt CTSpriteAnim::DoCmdSetPositionL()
+ {
+ TInt result = 0;
+ TPoint aPoint;
+ TPtr8 ptr6((TUint8*)&aPoint, sizeof(TPoint));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr6);
+ iSpriteFunctions->SetPosition(aPoint);
+ }
+ else
+ {
+ result = -1;
+ }
+ return result;
+ }
+
+TInt CTSpriteAnim::DoCmdSpriteCanBeSeen()
+ {
+ TBool visible = iSpriteFunctions->SpriteCanBeSeen();
+ TPtr8 ptr((TUint8*)&visible, sizeof(TBool), sizeof(TBool));
+ iFunctions->Message()->Write(1, ptr);
+ return 0;
+ }
+
+TInt CTSpriteAnim::DoCmdUpdateMemberL()
+ {
+ //TInt aMember, const TRect &aRect, TBool aFullUpdate
+ TInt result = 0;
+ TInt aMember;
+ TPtr8 ptr1((TUint8*)&aMember, sizeof(TInt));
+
+ TRect aRect;
+ TPtr8 ptr2((TUint8*)&aRect, sizeof(TRect));
+
+ TBool aFullUpdate;
+ TPtr8 ptr3((TUint8*)&aFullUpdate, sizeof(TInt));
+
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ msg->ReadL(2,ptr2);
+ msg->ReadL(3,ptr3);
+ iSpriteFunctions->UpdateMember(aMember, aRect, aFullUpdate);
+ }
+ else
+ {
+ result = -1;
+ }
+ return result;
+ }
+
+TInt CTSpriteAnim::DoCmdSizeChangeL()
+ {
+ iSpriteFunctions->SizeChangedL();
+ return 0;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/src/T_TWinAnim.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,1234 @@
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "T_TWinAnim.h"
+#include "T_TestAnimDll.h"
+#include "txtfrmat.h"
+#include "bitdev.h"
+#include "T_AnimDef.h"
+#include "w32adll.h"
+
+// Implementation of CTimeoutTimer.
+CTimeOutTimer::CTimeOutTimer(const TInt aPriority,
+ MTimeoutNotify& aTimeOutNotify) :
+ CTimer(aPriority), iNotify(aTimeOutNotify)
+ {
+ // No implementation required
+ }
+
+CTimeOutTimer* CTimeOutTimer::NewL(const TInt aPriority,
+ MTimeoutNotify& aTimeOutNotify)
+ {
+ CTimeOutTimer *self = new ( ELeave ) CTimeOutTimer( aPriority, aTimeOutNotify );
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+CTimeOutTimer::~CTimeOutTimer()
+ {
+ Cancel();
+ }
+
+void CTimeOutTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add( this);
+ }
+
+void CTimeOutTimer::RunL()
+ {
+ iNotify.TimedOut();
+ }
+
+//Implementation of CTWinAnim
+CTWinAnim::CTWinAnim(CTestAnimDll* aDll, TInt aType) :
+ CAnimProc(aDll, aType)
+ {
+ // No implementation required
+ }
+
+CTWinAnim::~CTWinAnim()
+ {
+ WriteLog(_L("~CTWinAnim"));
+ if (iServerTimer)
+ {
+ iServerTimer->Cancel();
+ }
+
+ // Then delete the timer object
+ delete iServerTimer;
+ iServerTimer = NULL;
+
+ if (iIntervalTimeStamp)
+ delete [] iIntervalTimeStamp;
+
+ if (iDuplicateBitmap)
+ delete iDuplicateBitmap;
+
+ if (iMemArray.Count() > 0)
+ FreeMemory();
+ }
+
+void CTWinAnim::ConstructL(TAny *aArgs, TBool /*aHasFocus*/)
+ {
+ WriteLog(_L("CTWinAnim::ConstructL"));
+ ConstructWinL(aArgs, iFunctions);
+
+ // Store the screen size
+ iScreenSize = iWindowFunctions->WindowSize();
+
+ TBuf<50> buf;
+ buf.Format(_L("Screen width=%d height=%d"),iScreenSize.Width(),iScreenSize.Height());
+ WriteLog(buf);
+
+ // Set the screen visible
+ iWindowFunctions->SetVisible(ETrue);
+ //just for start heartbeat
+ iWindowFunctions->SetRect(TRect(0, 0, 1, 1));
+ iServerTimer = CTimeOutTimer::NewL(EPriorityHigh, *this);
+ }
+
+void CTWinAnim::Redraw()
+ {
+ WriteLog(_L("CTWinAnim::Redraw"));
+ iResult=ETrue;
+
+ Draw();
+ }
+
+void CTWinAnim::Draw()
+ {
+ // get the background colour
+ TLogicalRgb backgroundColour(TLogicalRgb::ESystemBackgroundColor);
+
+ // Clear the old image.
+ iGc->SetPenSize(iPenSize);
+ iGc->SetPenColor(backgroundColour);
+ iGc->DrawRect(TRect(iLastPoint, iSize) );
+
+ // Draw a shape at the new position
+ iGc->SetPenSize(iPenSize);
+ iGc->SetPenColor(iColor);
+ iGc->DrawRect(TRect(iNewPoint, iSize) );
+
+ if (iDuplicateBitmap)
+ {
+ TRect rect;
+ rect.SetRect(0, 0, 200, 200);
+ iGc->DrawBitmap(rect, iDuplicateBitmap);
+ }
+
+ // signal that the current position has been drawn
+ iDrawn = ETrue;
+ }
+
+void CTWinAnim::HandleNotification(const TWsEvent &aEvent)
+ {
+ if (aEvent.Type() == iExpectEventCode)
+ {
+ iResult = ETrue;
+ }
+ }
+
+void CTWinAnim::FocusChanged(TBool /*aState*/)
+ {
+
+ }
+
+void CTWinAnim::TimedOut()
+ {
+ switch (iCurrentCommand)
+ {
+ case ECmdGeneralSetInterval:
+ {
+ TInt64 interval=iIntervalTimeStamp[1]-iIntervalTimeStamp[0];
+ TInt expectInterval=0;
+ if(iInterval>0)
+ expectInterval = iInterval * 1000000 / 2;
+
+ if (interval == expectInterval)
+ iResult=ETrue;
+ else
+ iResult=EFalse;
+
+ break;
+ }
+
+ case ECmdGeneralSetNextInterval:
+ {
+ TInt64 interval1=iIntervalTimeStamp[1]-iIntervalTimeStamp[0];
+ TInt64 interval2=iIntervalTimeStamp[2]-iIntervalTimeStamp[1];
+ TInt expectInterval = iInterval * 1000000 / 2;
+ TInt expectNextInterval = 0;
+
+ //If the value is less than 1, it automatically gets set to 1.
+ if(iNextInterval > 0)
+ {
+ expectNextInterval = iNextInterval * 1000000 / 2;
+ }
+ else
+ {
+ expectNextInterval = 1000000 / 2;
+ }
+
+ if ((expectNextInterval*5/12)<=interval1 && interval1<=1000000
+ && interval2==expectInterval)
+ iResult=ETrue;
+ else
+ iResult=EFalse;
+ break;
+ }
+ }
+ }
+
+TInt CTWinAnim::CommandReplyL(TInt aOpcode, TAny *aArgs)
+ {
+ if (aOpcode != ECmdRetrieveResult)
+ {
+ iCurrentCommand=aOpcode;
+ }
+ TInt nReturn=KErrNone;
+ switch (aOpcode)
+ {
+ case ECmdWindowActivateGc:
+ iWindowFunctions->ActivateGc();
+ break;
+ case ECmdWindowSetRect:
+ nReturn=DoCmdSetRect();
+ break;
+ case ECmdWindowIsStarted:
+ iResult=EFalse;
+ iSyncMode=iFunctions->Sync();
+ iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
+ break;
+ case ECmdRetrieveResult:
+ nReturn=iResult;
+ break;
+ case ECmdWindowWindowSize:
+ nReturn=DoCmdWindowSize();
+ break;
+ case ECmdWindowIsHidden:
+ nReturn=iWindowFunctions->IsHidden();
+ break;
+ case ECmdWindowSetVisible:
+ nReturn=DoCmdSetVisible();
+ break;
+ case ECmdWindowInvalidate:
+ nReturn=DoCmdInvalidate();
+ break;
+ case ECmdWindowParameters:
+ nReturn=DoCmdParameters();
+ break;
+ case ECmdWindowVisibleRegion:
+ nReturn=DoCmdVisibleRegion();
+ break;
+
+ case ECmdGfweScreens:
+ nReturn=iFunctions->WindowExtension()->Screens();
+ break;
+ case ECmdGfweFocusScreens:
+ nReturn=iFunctions->WindowExtension()->FocusScreens();
+ break;
+ case ECmdGfweSetFocusScreen:
+ nReturn=DoCmdSetFocusScreen();
+ break;
+ case ECmdGfweWindowGroups:
+ nReturn=DoCmdWindowGroups();
+ break;
+ case ECmdGfweWindowGroupInfo:
+ nReturn=DoCmdWindowGroupInfo();
+ break;
+ case ECmdGfweWindowGroupName:
+ nReturn=DoCmdWindowGroupName();
+ break;
+ case ECmdGfweSetOrdinalPosition:
+ nReturn=DoCmdSetOrdinalPosition();
+ break;
+ case ECmdGfweIsFocusable:
+ nReturn=DoCmdIsFocusable();
+ break;
+
+ case ECmdGeneralDuplicateBitmapL:
+ nReturn = DoCmdDuplicateBitmapL();
+ break;
+ case ECmdGeneralDuplicateFontL:
+ nReturn = DoCmdDuplicateFontL();
+ break;
+ case ECmdGeneralCloseFont:
+ nReturn = DoCmdCloseFontL();
+ break;
+ case ECmdGeneralSetInterval:
+ nReturn = DoCmdSetIntervalL();
+ break;
+ case ECmdGeneralSetNextInterval:
+ nReturn = DoCmdSetNextIntervalL();
+ break;
+ case ECmdGeneralSystemTime:
+ nReturn = DoCmdSystemTimeL();
+ break;
+ case ECmdGeneralRegisterForNotis:
+ nReturn = DoCmdRegisterForNotisL();
+ break;
+ case ECmdGeneralMessage:
+ nReturn = DoCmdMessageL();
+ break;
+ case ECmdGeneralAnimate:
+ nReturn = DoCmdAnimateL();
+ break;
+ case ECmdGeneralFlashStateOn:
+ nReturn = DoCmdFlashStateOn();
+ break;
+ case ECmdGeneralPanic:
+ nReturn = DoCmdPanic();
+ break;
+ case ECmdGeneralScreenDevice:
+ nReturn = DoCmdScreenDevice();
+ break;
+ case ECmdGeneralWindowExtension:
+ nReturn = DoCmdWindowExtension();
+ break;
+ case ECmdGeneralEventExtension:
+ nReturn = DoCmdEventExtension();
+ break;
+ case ECmdGeneralExtendedInterface:
+ nReturn = DoCmdExtendedInterfaceL();
+ break;
+ case ECmdGeneralNumOfExtInterfaces:
+ nReturn = DoCmdNumOfExtInterfaces();
+ break;
+ case ECmdGeneralSetSync:
+ nReturn = DoCmdSetSyncL();
+ break;
+ case ECmdGeneralSync:
+ nReturn = DoCmdSync();
+ break;
+ case ECmdGeneralGetRawEvents:
+ nReturn = DoCmdGetRawEventsL();
+ break;
+ case ECmdGeneralPostRawEvent:
+ nReturn = DoCmdPostRawEventL();
+ break;
+ case ECmdGeneralPostKeyEvent:
+ nReturn = DoCmdPostKeyEventL();
+ break;
+ case ECmdGeneralClient:
+ nReturn = DoCmdClient();
+ break;
+ case ECmdGeneralReplyBuf8:
+ nReturn = DoCmdGeneralReplyBuf8L();
+ break;
+ case ECmdGeneralReplyBuf16:
+ nReturn = DoCmdGeneralReplyBuf16L();
+ break;
+ case ECmdUtilEatupMemory:
+ nReturn = DoCmdEatupMemory();
+ break;
+ case ECmdUtilFreeEatenMemory:
+ nReturn = DoCmdFreeEatenMemory();
+ break;
+ default:
+ nReturn=CmdReply(iFunctions, aOpcode, aArgs);
+ }
+
+ return nReturn;
+ }
+
+void CTWinAnim::Command(TInt aOpcode, TAny *aArgs)
+ {
+ CmdReply(iFunctions, aOpcode, aArgs);
+ }
+
+void CTWinAnim::Animate(TDateTime *aDateTime)
+ {
+ //Set iAnimateTime.
+ TTime now;
+ now.HomeTime();
+ iAnimateTime = now.DateTime();
+
+ switch (iCurrentCommand)
+ {
+ case ECmdGeneralAnimate:
+ iDateTime = *aDateTime;
+ break;
+ case ECmdGeneralSetInterval:
+ {
+ if (iIntervalTimeStamp[0]==0)
+ {
+ iIntervalTimeStamp[0]=now.Int64();
+ }
+ else
+ if (iIntervalTimeStamp[1]==0)
+ {
+ iIntervalTimeStamp[1]=now.Int64();
+ }
+ break;
+ }
+
+ case ECmdGeneralSetNextInterval:
+ {
+ if (iIntervalTimeStamp[1]==0)
+ {
+ iIntervalTimeStamp[1]=now.Int64();
+ }
+ else
+ if (iIntervalTimeStamp[2]==0)
+ {
+ iIntervalTimeStamp[2]=now.Int64();
+ }
+ break;
+ }
+ }
+
+ iResult=ETrue;
+ //if MAnimGeneralFunctions::Sync() not equal to CWindowAnim::iSyncMode then call CWindowAnim::SetSync(CWindowAnim::iSyncMode)
+ if (iFunctions->Sync()!=iSyncMode && iCurrentCommand==ECmdWindowIsStarted)
+ {
+ iFunctions->SetSync(iSyncMode);
+ }
+ // if the last position has been drawn, update the position
+ if (iDrawn)
+ {
+ // this position has not been drawn, so clear the flag
+ iDrawn = EFalse;
+
+ if (iLastPoint != iNewPoint)
+ Compare();
+
+ // Save the current position, so we can rub it out later
+ iLastPoint = iNewPoint;
+
+ TInt nextpoint=iNewPoint.iX + iStepX;
+ TInt right=iNewPoint.iX + iSize.iWidth;
+
+ if (right> iScreenSize.iBr.iX ||nextpoint >= iScreenSize.iBr.iX
+ ||iNewPoint.iX<iScreenSize.iTl.iX)
+ iStepX = -iStepX;
+
+ TInt nexty=iNewPoint.iY + iStepY;
+ TInt bottom=nexty + iSize.iHeight;
+
+ if (bottom> iScreenSize.iBr.iY ||nexty >= iScreenSize.iBr.iY
+ ||iNewPoint.iY<iScreenSize.iTl.iY || nexty
+ <= iScreenSize.iTl.iY)
+ iStepY = -iStepY;
+
+ iNewPoint.iX += iStepX;
+ iNewPoint.iY += iStepY;
+
+ // Force a draw to be performed by declaring the screen invalid
+ iWindowFunctions->Invalidate(iScreenSize);
+ }
+
+ RecordAnimTime();
+
+ TInt interval=(iAnimTime[KAnimTimeSize-1]-iAnimTime[KAnimTimeSize-2])/1000;
+
+ TBuf<100> buf;
+ buf.Format(_L("CTWinAnim::Animate interval=%d x=%d y=%d"),
+ interval,iNewPoint.iX,iNewPoint.iY);
+
+ WriteLog(buf);
+ }
+
+void CTWinAnim::Compare()
+ {
+ // compare
+ const CFbsScreenDevice* scdev=iFunctions->ScreenDevice();
+
+ TBool compare=scdev->RectCompare(TRect(iNewPoint, iSize), *scdev, TRect(
+ TPoint(0, 0), iSize));
+ TBuf<50> buf;
+ buf.Format(_L("CTWinAnim::Compare res %d"),
+ compare);
+ iDll->WriteLog(buf);
+ }
+TBool CTWinAnim::OfferRawEvent(const TRawEvent& aRawEvent)
+ {
+ WriteLog(_L("CTWinAnim::OfferRawEvent has been called"));
+ TBuf<10> event;
+ event.AppendNum(aRawEvent.Type());
+ WriteLog(event);
+ iResult = ETrue;
+ return ETrue;
+ }
+
+//for MAnimWindowFunctions
+TInt CTWinAnim::DoCmdSetRect()
+ {
+ const RMessagePtr2 *msg=iFunctions->Message();
+ TPckgBuf<TRect> arg;
+ TRect rect(0, 0, 0, 0);
+ TInt nReturn=KErrNotFound;
+
+ if (msg && !msg->IsNull())
+ {
+ nReturn=msg->Read(1, arg);
+ if (KErrNone==nReturn)
+ {
+ rect=arg();
+ iWindowFunctions->SetRect(rect);
+ }
+ }
+ return nReturn;
+ }
+
+TInt CTWinAnim::DoCmdWindowSize()
+ {
+ TSize size=iWindowFunctions->WindowSize();
+ TPckgBuf<TSize> pckg(size);
+ TInt nReturn=KErrNone;
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if (msg)
+ {
+ nReturn=msg->Write(1, pckg);
+ }
+
+ return nReturn;
+ }
+
+TInt CTWinAnim::DoCmdSetVisible()
+ {
+ TInt nReturn=KErrNotFound;
+ TPckgBuf<TBool> arg;
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if (msg)
+ {
+ nReturn=msg->Read(1, arg);
+ if (KErrNone==nReturn)
+ {
+ iWindowFunctions->SetVisible(arg());
+ }
+ }
+
+ return nReturn;
+ }
+
+TInt CTWinAnim::DoCmdInvalidate()
+ {
+ const RMessagePtr2 *msg=iFunctions->Message();
+ TPckgBuf<TRect> arg;
+ TRect rect(0, 0, 0, 0);
+ TInt nReturn=KErrNotFound;
+
+ if (msg && !msg->IsNull())
+ {
+ nReturn=msg->Read(1, arg);
+ if (KErrNone==nReturn)
+ {
+ rect=arg();
+ iResult=EFalse;
+ iWindowFunctions->Invalidate(rect);
+ iWindowFunctions->ActivateGc();
+ iGc->DrawRect(rect);
+ }
+ }
+ return nReturn;
+ }
+
+TInt CTWinAnim::DoCmdParameters()
+ {
+ TWindowInfo data;
+ iWindowFunctions->Parameters(data);
+
+ TPckgBuf<TRect> pckgScreenPos(data.iScreenPos);
+ TPckgBuf<TInt> pckgMode((TInt)data.iMode);
+
+ TInt nReturn=KErrNone;
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if (msg)
+ {
+ nReturn=msg->Write(1, pckgScreenPos);
+ nReturn=msg->Write(2, pckgMode);
+ }
+
+ return nReturn;
+ }
+
+TInt CTWinAnim::DoCmdVisibleRegion()
+ {
+ RRegion region;
+ iWindowFunctions->VisibleRegion(region);
+ return region.Count();
+ }
+
+//for MAnimGeneralFunctionsWindowExtension
+TInt CTWinAnim::DoCmdSetFocusScreen()
+ {
+ const RMessagePtr2 *msg=iFunctions->Message();
+ TPckgBuf<TInt> arg;
+ TInt nReturn=KErrNotFound;
+
+ if (msg && !msg->IsNull())
+ {
+ nReturn=msg->Read(1, arg);
+ if (KErrNone==nReturn)
+ {
+ iFunctions->WindowExtension()->SetFocusScreen(arg());
+ }
+ }
+ return nReturn;
+ }
+
+TInt CTWinAnim::DoCmdWindowGroups()
+ {
+ const RMessagePtr2 *msg=iFunctions->Message();
+ TPckgBuf<TInt> arg;
+ TInt nReturn=KErrNotFound;
+
+ if (msg && !msg->IsNull())
+ {
+ nReturn=msg->Read(1, arg);
+ if (KErrNone==nReturn)
+ {
+ nReturn=iFunctions->WindowExtension()->WindowGroups(arg());
+ }
+ }
+ return nReturn;
+ }
+
+TBool CTWinAnim::DoCmdWindowGroupInfo()
+ {
+ const RMessagePtr2 *msg=iFunctions->Message();
+ TPckgBuf<TInt> argScrNumber;
+ TPckgBuf<TInt> argPosition;
+
+ TBool nReturn=EFalse;
+ MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo aInfo;
+
+ if (msg && !msg->IsNull())
+ {
+ if (KErrNone==msg->Read(1, argScrNumber) && KErrNone==msg->Read(2, argPosition))
+ {
+ nReturn=iFunctions->WindowExtension()->WindowGroupInfo(aInfo, argScrNumber(), argPosition());
+
+ if (nReturn)
+ {
+ TPckgBuf<TInt> pckgInfo(aInfo.iId);
+ msg->Write(3, pckgInfo);
+ }
+ }
+ }
+ return nReturn;
+ }
+
+TBool CTWinAnim::DoCmdWindowGroupName()
+ {
+ const RMessagePtr2 *msg=iFunctions->Message();
+ TPckgBuf<TInt> argScrNumber;
+ TPckgBuf<TInt> argPosition;
+
+ TBool nReturn=EFalse;
+
+ if (msg && !msg->IsNull())
+ {
+ if (KErrNone==msg->Read(1, argScrNumber) && KErrNone==msg->Read(2, argPosition))
+ {
+ TPtrC name;
+ nReturn=iFunctions->WindowExtension()->WindowGroupName(name, argScrNumber(), argPosition());
+ if (nReturn)
+ {
+ msg->Write(3, name);
+ }
+ }
+ }
+
+ return nReturn;
+ }
+
+TInt CTWinAnim::DoCmdSetOrdinalPosition()
+ {
+ const RMessagePtr2 *msg=iFunctions->Message();
+ TPckgBuf<TInt> argGroupId;
+ TPckgBuf<TInt> argPosition;
+ TPckgBuf<TInt> argPriority;
+
+ TInt nReturn=KErrNotFound;
+
+ if (msg && !msg->IsNull())
+ {
+ if (KErrNone==msg->Read(1, argGroupId) && KErrNone==msg->Read(2, argPosition)
+ && KErrNone==msg->Read(3, argPriority))
+ {
+ nReturn=iFunctions->WindowExtension()->SetOrdinalPosition(argGroupId(), argPosition(),
+ argPriority());
+ }
+ }
+
+ return nReturn;
+ }
+
+TBool CTWinAnim::DoCmdIsFocusable()
+ {
+ const RMessagePtr2 *msg=iFunctions->Message();
+ TPckgBuf<TInt> argScrNumber;
+ TPckgBuf<TInt> argPosition;
+
+ TBool nReturn=EFalse;
+ MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo aInfo;
+
+ if (msg && !msg->IsNull())
+ {
+ if (KErrNone==msg->Read(1, argScrNumber) && KErrNone==msg->Read(2, argPosition))
+ {
+ if (iFunctions->WindowExtension()->WindowGroupInfo(aInfo, argScrNumber(), argPosition()))
+ {
+ nReturn=aInfo.IsFocusable();
+ }
+ }
+ }
+ return nReturn;
+ }
+
+TInt CTWinAnim::DoCmdDuplicateBitmapL()
+ {
+ TInt result = 0;
+ TInt handle;
+ TPtr8 ptr1((TUint8*)&handle, sizeof(TInt));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ iDuplicateBitmap = iFunctions->DuplicateBitmapL(handle);
+ if (iDuplicateBitmap)
+ {
+ TRect rect;
+ iWindowFunctions->ActivateGc();
+ rect.SetRect(0, 0, 200, 200);
+ iGc->DrawBitmap(rect, iDuplicateBitmap);
+ }
+ }
+ else
+ {
+ result = -1;
+ }
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdDuplicateFontL()
+ {
+ TInt result = 0;
+ TInt handle;
+ TPtr8 ptr1((TUint8*)&handle, sizeof(TInt));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ iDuplicateFont = iFunctions->DuplicateFontL(handle);
+ TInt id =0;
+ if (iDuplicateFont)
+ {
+ id = iDuplicateFont->TypeUid().iUid;
+ TPtr8 ptr2((TUint8*)&id, sizeof(TInt), sizeof(TInt));
+ msg->Write(2, ptr2);
+ }
+ }
+ else
+ {
+ return -1;
+ }
+
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdCloseFontL()
+ {
+ DoCmdDuplicateFontL();
+ iFunctions->CloseFont(iDuplicateFont);
+ return 0;
+ }
+
+TInt CTWinAnim::DoCmdSetIntervalL()
+ {
+ TInt result = 0;
+ TPtr8 ptr1((TUint8*)&iInterval, sizeof(TInt));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ if (iIntervalTimeStamp)
+ delete [] iIntervalTimeStamp;
+ iIntervalTimeStamp=new (ELeave) TInt64[3];
+ iIntervalTimeStamp[0]=0;
+ iIntervalTimeStamp[1]=0;
+ iIntervalTimeStamp[2]=0;
+ iFunctions->SetInterval(iInterval);
+ iServerTimer->After( 5000000); // delay 5 second
+ }
+ else
+ {
+ result = -1;
+ }
+
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdSetNextIntervalL()
+ {
+ TInt result = 0;
+ TPtr8 ptr1((TUint8*)&iInterval, sizeof(TInt));
+ TPtr8 ptr2((TUint8*)&iNextInterval, sizeof(TInt));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ msg->ReadL(2,ptr2);
+ if (iIntervalTimeStamp)
+ delete [] iIntervalTimeStamp;
+
+ iIntervalTimeStamp=new (ELeave) TInt64[3];
+ iIntervalTimeStamp[0]=0;
+ iIntervalTimeStamp[1]=0;
+ iIntervalTimeStamp[2]=0;
+ iFunctions->SetInterval(iInterval);
+ iFunctions->SetNextInterval(iNextInterval);//2 flash = 1 second
+ if (iIntervalTimeStamp[0]==0)
+ {
+ TTime now;
+ now.HomeTime();
+ iIntervalTimeStamp[0]=now.Int64();
+ }
+
+ iServerTimer->After( 5000000); //delay 5 second
+ }
+ else
+ {
+ result = -1;
+ }
+
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdSystemTimeL()
+ {
+ TBool result = DoCmdSetSyncL();
+ if (result)
+ {
+ return result;
+ }
+ iFunctions->Animate(NULL);
+
+ TDateTime time = iFunctions->SystemTime();
+ MAnimGeneralFunctions::TAnimSync syncType = iFunctions->Sync();
+ switch (syncType)
+ {
+ case MAnimGeneralFunctions::ESyncDay:
+ if (time.Day() == iAnimateTime.Day())
+ {
+ result = ETrue;
+ }
+ else
+ {
+ result = EFalse;
+ }
+ break;
+ case MAnimGeneralFunctions::ESyncMinute:
+ if (time.Minute() == iAnimateTime.Minute() && time.Day()
+ == iAnimateTime.Day())
+ {
+ result = ETrue;
+ }
+ else
+ {
+ result = EFalse;
+ }
+ break;
+ case MAnimGeneralFunctions::ESyncFlash:
+ case MAnimGeneralFunctions::ESyncNone:
+ case MAnimGeneralFunctions::ESyncSecond:
+ if (time.Day() == iAnimateTime.Day() && time.Minute()
+ == iAnimateTime.Minute() && time.Second()
+ == iAnimateTime.Second())
+ {
+ result = ETrue;
+ }
+ else
+ {
+ result = EFalse;
+ }
+ break;
+ }
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdRegisterForNotisL()
+ {
+ iResult = EFalse;
+ TUint32 notice;
+ TInt result = 0;
+ TPtr8 ptr1((TUint8*)¬ice, sizeof(TUint32));
+ TPtr8 ptr2((TUint8*)&iExpectEventCode, sizeof(TEventCode));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1, ptr1);
+ msg->ReadL(2, ptr2);
+ iFunctions->RegisterForNotifications(notice);
+ }
+ else
+ {
+ return -1;
+ }
+
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdMessageL()
+ {
+ TInt result;
+ TBuf<KBufMessage> message;
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,message);
+ msg->Write(2, message);
+ }
+ else
+ {
+ result = -1;
+ }
+
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdAnimateL()
+ {
+ TInt result = 0;
+ TDateTime time;
+ TPtr8 ptr1((TUint8*)&time, sizeof(TDateTime));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ iResult = EFalse;
+ iFunctions->Animate(&time);
+ if (iDateTime.MicroSecond() == time.MicroSecond() && iDateTime.Minute()
+ == time.Minute() && iDateTime.Second() == time.Second())
+ {
+ iResult = ETrue;
+ }
+ else
+ {
+ iResult = EFalse;
+ }
+
+ }
+
+ return iResult;
+ }
+
+TInt CTWinAnim::DoCmdFlashStateOn()
+ {
+ TBool status = EFalse;
+ TTime time;
+ time.HomeTime();
+ TBool result = iFunctions->FlashStateOn();
+ TInt ms = time.DateTime().MicroSecond();
+ TInt H1Limit = 16000; //0.016 * 100000 = 1/64 * 1000000;
+ TInt H2Limit = 567000; // (7/12 - 1/64) * 1000000;
+ TInt H3Limit = 599000; // (7/12 + 1/64) * 1000000;
+ TInt H4Limit = 984000; // (1 - 0.016) * 1000000;
+
+ if(ms < H1Limit ||
+ (ms > H2Limit && ms < H3Limit) ||
+ ms > H4Limit)
+ {
+ return -1;
+ }
+
+ if (time.DateTime().MicroSecond() < 1000000 * 7/12)
+ {
+ status = ETrue;
+ }
+ else
+ {
+ status = EFalse;
+ }
+ if (result == status)
+ {
+ status = ETrue;
+ }
+ else
+ {
+ status = EFalse;
+ }
+
+ return status;
+ }
+
+TInt CTWinAnim::DoCmdPanic()
+ {
+ iFunctions->Panic();
+ return 0;
+ }
+
+TInt CTWinAnim::DoCmdScreenDevice()
+ {
+ TDisplayMode mode = iFunctions->ScreenDevice()->DisplayMode();
+ return 0;
+ }
+
+TInt CTWinAnim::DoCmdWindowExtension()
+ {
+ MAnimGeneralFunctionsWindowExtension* ext = iFunctions->WindowExtension();
+ TInt screen = ext->FocusScreens();
+ return 0;
+ }
+
+TInt CTWinAnim::DoCmdEventExtension()
+ {
+ MAnimGeneralFunctionsEventExtension* ext = iFunctions->EventExtension();
+ TKeyEvent event;
+ event.iCode = EEventKeyDown;
+ ext->PostKeyEvent(event, 1);
+ return 0;
+ }
+
+TInt CTWinAnim::DoCmdExtendedInterfaceL()
+ {
+ TInt result = 0;
+ TInt interface;
+ TPtr8 ptr1((TUint8*)&interface, sizeof(TInt));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ TAny* any = iFunctions->ExtendedInterface(interface);
+ if (interface == 0)
+ {
+ //Zhang Yue modified.for the return result is a Int value, not a pointer address.
+ result = (TInt)any;
+ }
+ else
+ {
+ if (interface == 1)
+ {
+ ((MAnimGeneralFunctionsWindowExtension*) any)->FocusScreens();
+ }
+ else
+ {
+ if (interface == 2)
+ {
+ TKeyEvent event;
+ event.iCode = EEventKeyDown;
+ ((MAnimGeneralFunctionsEventExtension*) any)->PostKeyEvent(
+ event, 1);
+ }
+ else
+ {
+ if (any)
+ {
+ result = -1;
+ }
+ else
+ {
+ result = 0;
+ }//end if (any)
+ }//end if(interface 2)
+ }//end if(interface)
+ }//end if(interface)
+
+ } //end if(msg)
+ else
+ {
+ result = -1;
+ }
+
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdNumOfExtInterfaces()
+ {
+ return iFunctions->NumberOfExtendedInterfaces();
+ }
+
+TInt CTWinAnim::DoCmdSetSyncL()
+ {
+ TInt result = 0;
+ MAnimGeneralFunctions::TAnimSync mode;
+ TPtr8 ptr1((TUint8*)&mode, sizeof(MAnimGeneralFunctions::TAnimSync));
+ const RMessagePtr2 *msg=iFunctions->Message();
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ iFunctions->SetSync(mode);
+ }
+ else
+ {
+ return -1;
+ }
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdSync()
+ {
+ MAnimGeneralFunctions::TAnimSync mode = iFunctions->Sync();
+ return mode;
+ }
+
+TInt CTWinAnim::DoCmdGetRawEventsL()
+ {
+ TInt result = 0;
+ TBool getevent;
+ TPtr8 ptr1((TUint8*)&getevent, sizeof(TBool));
+ const RMessagePtr2 *msg=iFunctions->Message();
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ iFunctions->GetRawEvents(getevent);
+
+ }
+ else
+ {
+ return -1;
+ }
+
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdPostRawEventL()
+ {
+ iResult = EFalse;
+ TInt result = 0;
+ TRawEvent event;
+ TPtr8 ptr1((TUint8*)&event, sizeof(TRawEvent));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ iFunctions->PostRawEvent(event);
+ }
+ else
+ {
+ return -1;
+ }
+
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdPostKeyEventL()
+ {
+ iResult = EFalse;
+ TInt result = 0;
+ TKeyEvent event;
+ TPtr8 ptr1((TUint8*)&event, sizeof(TKeyEvent));
+ const RMessagePtr2 *msg=iFunctions->Message();
+
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(1,ptr1);
+ iFunctions->PostKeyEvent(event);
+ }
+ else
+ {
+ result = -1;
+ }
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdClient()
+ {
+ return iFunctions->Client().Id();
+ }
+
+TInt CTWinAnim::DoCmdGeneralReplyBuf8L()
+ {
+ TInt result;
+ TBuf8<KBufMessage> message;
+ const RMessagePtr2 *msg=iFunctions->Message();
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(3,message);
+ iFunctions->ReplyBuf(message);
+ }
+ else
+ {
+ result = -1;
+ }
+
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdGeneralReplyBuf16L()
+ {
+ TInt result;
+ TBuf<KBufMessage> message;
+ const RMessagePtr2 *msg=iFunctions->Message();
+ if(msg && !msg->IsNull())
+ {
+ msg->ReadL(3,message);
+ iFunctions->ReplyBuf(message);
+ }
+ else
+ {
+ result = -1;
+ }
+ return result;
+ }
+
+TInt CTWinAnim::DoCmdEatupMemory()
+ {
+ TInt leftsize=20;
+
+ // eat memory until fail to avaiable memory is less than is left size
+ TInt nTotalSize=User::Heap().Size();
+ TAny* mem=User::AllocZ(nTotalSize);
+
+ if (mem)
+ iMemArray.Append(mem);
+
+ do
+ {
+ mem=User::AllocZ(leftsize);
+ if (mem)
+ {
+ iMemArray.Append(mem);
+ }
+ }
+ while (mem);
+
+ iAvaiableSpace=User::Available(iBiggestBlock);
+ return 0;
+ }
+
+TInt CTWinAnim::DoCmdFreeEatenMemory()
+ {
+ FreeMemory();
+ return 0;
+ }
+
+void CTWinAnim::FreeMemory()
+ {
+ for (TInt i=0; i<iMemArray.Count(); i++)
+ {
+ TAny* mem=iMemArray[i];
+ User::Free(mem);
+ }
+
+ iMemArray.Reset();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/src/T_TestAnimDll.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,106 @@
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "T_TestAnimDll.h"
+#include "T_AnimDef.h"
+#include "T_TWinAnim.h"
+#include "T_TSpriteAnim.h"
+#include "T_TFreeTimerWinAnim.h"
+
+
+CTestAnimDll::CTestAnimDll()
+{
+ // No implementation required
+}
+
+
+CTestAnimDll::~CTestAnimDll()
+{
+ WriteLog(_L("~CTestAnimDll"));
+ delete iLog;
+ iFs.Close();
+}
+
+CTestAnimDll* CTestAnimDll::NewLC()
+{
+ CTestAnimDll* self = new (ELeave)CTestAnimDll();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+CTestAnimDll* CTestAnimDll::NewL()
+{
+ CTestAnimDll* self=CTestAnimDll::NewLC();
+ CleanupStack::Pop(); // self;
+ return self;
+}
+
+void CTestAnimDll::ConstructL()
+{
+ User::LeaveIfError(iFs.Connect());
+ _LIT(KFileName,"c:\\anim.txt");
+ iLog=CLog::NewL(iFs,KFileName);
+
+}
+
+EXPORT_C CAnimDll* CreateCAnimDllL()
+{
+ return CTestAnimDll::NewL();
+}
+
+TInt CTestAnimDll::WriteLog(const TDesC& aInfo)
+ {
+ return iLog->WriteLog((aInfo));
+ }
+TInt CTestAnimDll::WriteLog(const TDesC8& aInfo)
+ {
+ return iLog->WriteLog((aInfo));
+ }
+
+CAnim* CTestAnimDll::CreateInstanceL(TInt aType)
+{
+ TBuf<50> buf;
+ buf.Format(_L("CTestAnimDll::CreateInstanceL %d"),aType);
+ WriteLog(buf);
+
+ CAnim* anim=NULL;
+ switch (aType)
+ {
+ case EKWindowAnim:
+ {
+ anim=new (ELeave)CTWinAnim(this,aType);
+ break;
+ }
+ case EKSpriteAnim:
+ {
+ anim=new (ELeave)CTSpriteAnim(this,aType);
+ break;
+ }
+ case EKFreeTimerWindowAnim:
+ {
+ anim=new (ELeave) CTFreeTimerWinAnim();
+ break;
+ }
+ default:
+ {
+// iFunctions->Panic();
+ break;
+ }
+
+ }
+
+ return anim;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/AnimPlugin/src/T_log.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "T_log.h"
+
+#define DES_AS_8_BIT(str) (TPtrC8((TText8*)((str).Ptr()), (str).Size()))
+_LIT8(KLimit,"\r\n");
+_LIT8(KTimeFormat, "%2d:%2d:%3d ");
+
+CLog::CLog()
+ {
+
+ }
+
+CLog::~CLog()
+ {
+ iFile.Close();
+
+ iBuf.Close();
+ }
+
+CLog* CLog::NewLC(RFs &aFs, const TDesC &aFileName)
+ {
+ CLog* self = new (ELeave)CLog();
+ CleanupStack::PushL(self);
+ self->ConstructL(aFs,aFileName);
+ return self;
+ }
+
+CLog* CLog::NewL(RFs &aFs, const TDesC &aFileName)
+ {
+ CLog* self=CLog::NewLC(aFs, aFileName);
+ CleanupStack::Pop(); // self;
+ return self;
+ }
+
+void CLog::ConstructL(RFs &aFs, const TDesC &aFileName)
+ {
+ User::LeaveIfError(iFile.Replace(aFs,aFileName,EFileWrite|EFileShareAny));
+
+ iText.Set(iFile);
+ iBuf.Create(1024);
+
+ }
+//write log
+//input: aInfo, text msg;
+//return: KErrNone, ok; other, fail;
+TInt CLog::WriteLog(const TDesC& aInfo)
+ {
+ TTime currentTime;
+ currentTime.HomeTime();
+ TDateTime time=currentTime.DateTime();
+
+ iBuf.Format(KTimeFormat,time.Minute(),time.Second(),time.MicroSecond());
+ iBuf.Append(aInfo);
+
+ iFile.Write(iBuf);
+ iFile.Write(KLimit);
+
+ return 0;
+ }
+
+//write log
+//input: aInfo, text msg;
+//return: KErrNone, ok; other, fail;
+TInt CLog::WriteLog(const TDesC8& aInfo)
+ {
+ TTime currentTime;
+ currentTime.HomeTime();
+ TDateTime time=currentTime.DateTime();
+
+ iBuf.Format(KTimeFormat,time.Minute(),time.Second(),time.MicroSecond());
+ iBuf.Append(aInfo);
+
+ iFile.Write(iBuf);
+ iFile.Write(KLimit);
+
+ return 0;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/TWsGraphicShare/TWsGraphicShare.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+// Include Files
+
+#include "TWsGraphicShare.h"
+#include <e32base.h>
+#include <e32std.h>
+#include <w32stdgraphic.h>
+
+// Local Functions
+
+LOCAL_C void DrawSharedGraphicL(const TDesC& aSemName, TInt aScrNum, const TWsGraphicId& aId, const TRect& aDestRect, const TDesC8& aData)
+ {
+ // Construct & Initiate
+ RWsSession ws;
+ User::LeaveIfError(ws.Connect());
+ CleanupClosePushL(ws);
+
+ CWsScreenDevice* screenDevice = new(ELeave) CWsScreenDevice(ws);
+ CleanupStack::PushL(screenDevice);
+ User::LeaveIfError(screenDevice->Construct(aScrNum));
+
+ TSize screenSize = screenDevice->SizeInPixels();
+
+ CWindowGc* gc = new(ELeave) CWindowGc(screenDevice);
+ CleanupStack::PushL(gc);
+ User::LeaveIfError(gc->Construct());
+
+ RWindowGroup winGroup(ws);
+ CleanupClosePushL(winGroup);
+ User::LeaveIfError(winGroup.Construct(1));
+
+ RWindow win(ws);
+ CleanupClosePushL(win);
+ TUint32 handle = 0x0F00;
+ User::LeaveIfError(win.Construct(winGroup, handle));
+ win.SetBackgroundColor(TRgb(255, 255, 255));
+ win.SetPosition(TPoint(aDestRect.iTl.iX, aDestRect.iTl.iY));
+ win.SetSize(aDestRect.Size());
+ win.Activate();
+
+ // Draw
+ gc->Activate(win);
+ win.Invalidate();
+ win.BeginRedraw();
+ ws.Flush();
+ gc->DrawWsGraphic(aId, TRect(0,0,aDestRect.Width(),aDestRect.Height()), aData );
+ gc->Deactivate();
+ win.EndRedraw();
+ ws.Flush();
+
+ // Synchronize with master process
+ RSemaphore semaphore;
+ CleanupClosePushL(semaphore);
+ User::LeaveIfError(semaphore.OpenGlobal(aSemName));
+ semaphore.Signal();
+ semaphore.Wait();
+ semaphore.Close();
+
+ // Deconstruct
+ CleanupStack::PopAndDestroy(6);
+ }
+
+LOCAL_C void MainL ( )
+ {
+ TBuf<128> commandLine;
+ TLex lex;
+ TBuf<32> semName;
+ TInt screenNumber = 0;
+ TInt graphId;
+ TInt left, top, right, bottom;
+
+ // Read arguments from the command line
+ // There is a space between two adjacent parameters
+ // Commandline's format looks like that:
+ // 'screenNumber' 'graphId' 'left' 'top' 'right' 'bottom'
+ User::CommandLine(commandLine);
+ commandLine.TrimLeft();
+
+ _LIT(KSpace, " ");
+ TInt pos;
+ // Get process name
+ pos = commandLine.Find(KSpace);
+ semName = commandLine.Left(pos);
+ commandLine = commandLine.Mid(pos+1);
+
+ // Get screen number
+ pos = commandLine.Find(KSpace);
+ lex = commandLine.Left(pos);
+ lex.Val(screenNumber);
+ commandLine = commandLine.Mid(pos+1);
+
+ // Get gragaphic id
+ pos = commandLine.Find(KSpace);
+ lex = commandLine.Left(pos);
+ lex.Val(graphId);
+ commandLine = commandLine.Mid(pos+1);
+
+ // Get coordinates
+ pos = commandLine.Find(KSpace);
+ lex = commandLine.Left(pos);
+ lex.Val(left);
+ commandLine = commandLine.Mid(pos+1);
+
+ pos = commandLine.Find(KSpace);
+ lex = commandLine.Left(pos);
+ lex.Val(top);
+ commandLine = commandLine.Mid(pos+1);
+
+ pos = commandLine.Find(KSpace);
+ lex = commandLine.Left(pos);
+ lex.Val(right);
+ commandLine = commandLine.Mid(pos+1);
+
+ pos = commandLine.Find(KSpace);
+ lex = commandLine.Left(pos);
+ lex.Val(bottom);
+ commandLine = commandLine.Mid(pos+1);
+
+ // Get data
+ TBuf8<32> data;
+ data.Copy(commandLine);
+
+ TWsGraphicId id(TUid::Uid(graphId));
+ TRect destRect(left, top, right, bottom);
+
+ // Draw the graphic
+ DrawSharedGraphicL(semName, screenNumber, id, destRect, data);
+ }
+
+// Global Functions
+
+GLDEF_C TInt E32Main()
+ {
+ // Create cleanup stack
+ __UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+
+ // Run application code inside TRAP harness, wait keypress when terminated
+ TRAPD(error, MainL());
+ User::LeaveIfError(error);
+
+ delete cleanup;
+ __UHEAP_MARKEND;
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/TWsGraphicShare/TWsGraphicShare.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef __TWSGRAPHICSHARE_H__
+#define __TWSGRAPHICSHARE_H__
+
+// Include Files
+
+#include <e32base.h>
+
+// Function Prototypes
+
+GLDEF_C TInt E32Main();
+
+#endif // __TWSGRAPHICSHARE_H__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/TWsGraphicShare/TWsGraphicShare.mmp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+TARGET twsgraphicshare.exe
+TARGETTYPE exe
+UID 0 0xE0A688F9
+
+USERINCLUDE .
+SYSTEMINCLUDE /epoc32/include
+
+SOURCEPATH .
+SOURCE TWsGraphicShare.cpp
+
+LIBRARY euser.lib
+LIBRARY ws32.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/TWsGraphicShare/TWsGraphicUnshare.mmp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+TARGET twsgraphicunshare.exe
+TARGETTYPE exe
+UID 0 0xE0A688F8
+
+USERINCLUDE .
+SYSTEMINCLUDE /epoc32/include
+
+SOURCEPATH .
+SOURCE TWsGraphicShare.cpp
+
+LIBRARY euser.lib
+LIBRARY ws32.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/TWsGraphicShare/bld.inf Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+TWsGraphicShare.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/group/T_GraphicsWservAPI.mmp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+TARGET t_graphicswservapi.exe
+TARGETTYPE exe
+UID 0x1000007B 0x20003721
+VENDORID 0x70000001
+
+CAPABILITY SwEvent WriteDeviceData Powermgmt ProtServ
+
+SOURCEPATH ../src
+
+SOURCE ../../common/src/TestServerBase.cpp
+SOURCE ../../common/src/UtilityClearPanicDlg.cpp
+SOURCE ../../common/src/DataWrapperBase.cpp
+SOURCE ../../common/src/T_GraphicsUtil.cpp
+SOURCE ../../common/src/DataWrapperActive.cpp
+
+SOURCE T_GraphicsWservAPIServer.cpp
+SOURCE T_DataWsClientClass.cpp
+SOURCE T_DataWsSession.cpp
+SOURCE T_DataWindowTreeNode.cpp
+SOURCE T_DataWindowGroup.cpp
+SOURCE T_DataWindowBase.cpp
+SOURCE T_DataBlankWindow.cpp
+SOURCE T_DataDrawableWindow.cpp
+SOURCE T_DataWindow.cpp
+SOURCE T_DataBackedUpWindow.cpp
+SOURCE T_DataWindowGc.cpp
+SOURCE T_DataWsBitmap.cpp
+SOURCE T_DataWsGraphic.cpp
+SOURCE T_DataWsGraphicBitmap.cpp
+SOURCE T_DataWsGraphicMsgBuf.cpp
+SOURCE T_DataWsEvent.cpp
+SOURCE T_DataWsPriorityKeyEvent.cpp
+SOURCE T_DataWsRedrawEvent.cpp
+SOURCE T_DataWindowInfo.cpp
+SOURCE T_DataWsScreenDevice.cpp
+SOURCE T_DataWsGraphicAnimation.cpp
+SOURCE T_DataWsGraphicFrameRate.cpp
+SOURCE T_DataWsGraphicMsgFixedBase.cpp
+SOURCE T_DataDsaSession.cpp
+SOURCE T_DataDirectScreenAccess.cpp
+SOURCE T_DataSoundPlugIn.cpp
+SOURCE T_DataWsGraphicBitmapAnimation.cpp
+SOURCE T_DataFrame.cpp
+SOURCE T_DataAnimDll.cpp
+SOURCE T_DataAnimForMClass.cpp
+
+
+SOURCE T_DataWsSpriteBase.cpp
+SOURCE T_DataWsSprite.cpp
+SOURCE T_DataWsPointerCursor.cpp
+
+//from gdi
+SOURCE ../../gdi/src/T_DataBitmapContext.cpp
+SOURCE ../../gdi/src/T_DataBitmapDevice.cpp
+SOURCE ../../gdi/src/T_DataDrawTextExtendedParam.cpp
+SOURCE ../../gdi/src/T_DataDrawTextParam.cpp
+SOURCE ../../gdi/src/T_DataFont.cpp
+SOURCE ../../gdi/src/T_DataGraphicsContext.cpp
+SOURCE ../../gdi/src/T_DataGraphicsDevice.cpp
+SOURCE ../../gdi/src/T_DataGraphicsDeviceMap.cpp
+SOURCE ../../gdi/src/T_DataMeasureTextInput.cpp
+SOURCE ../../gdi/src/T_DataMeasureTextOutput.cpp
+SOURCE ../../gdi/src/T_DataPalette.cpp
+SOURCE ../../gdi/src/T_DataTypefaceStore.cpp
+
+//from bitgdi
+SOURCE ../../bitgdi/src/T_DataFbsBitGc.cpp
+SOURCE ../../bitgdi/src/T_DataFbsBitmapDevice.cpp
+SOURCE ../../bitgdi/src/T_DataFbsDevice.cpp
+SOURCE ../../bitgdi/src/T_DataFbsScreenDevice.cpp
+
+//from fntstore
+SOURCE ../../fntstore/src/T_DataAlgStyle.cpp
+
+//from fbserv
+SOURCE ../../fbserv/src/T_DataBitmapUtil.cpp
+SOURCE ../../fbserv/src/T_DataFbsBitmap.cpp
+SOURCE ../../fbserv/src/T_DataFbsColor256BitmapUtil.cpp
+SOURCE ../../fbserv/src/T_DataFbsFont.cpp
+SOURCE ../../fbserv/src/T_DataFbsSession.cpp
+SOURCE ../../fbserv/src/T_DataFbsTypefaceStore.cpp T_DataAnim.cpp T_RAnimChild.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../common/inc
+USERINCLUDE ../../gdi/inc
+USERINCLUDE ../../bitgdi/inc
+USERINCLUDE ../../fntstore/inc
+USERINCLUDE ../../fbserv/inc
+
+SYSTEMINCLUDE /epoc32/include
+SYSTEMINCLUDE /epoc32/include/test
+SYSTEMINCLUDE /epoc32/include/graphics
+
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+LIBRARY esock.lib
+LIBRARY testexecuteutils.lib
+LIBRARY testexecutelogclient.lib
+LIBRARY charconv.lib
+LIBRARY fbscli.lib
+LIBRARY ws32.lib
+LIBRARY gdi.lib
+LIBRARY bafl.lib
+LIBRARY c32.lib
+LIBRARY c32root.lib
+LIBRARY hal.lib
+LIBRARY w32stdgraphic.lib
+
+LIBRARY fntstr.lib
+LIBRARY estor.lib
+LIBRARY bitgdi.lib
+LIBRARY eikcore.lib
+LIBRARY cone.lib
+LIBRARY apgrfx.lib
+LIBRARY iniparser.lib
+LIBRARY imageconversion.lib
+
+USERINCLUDE ../AnimPlugin/inc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/group/bld.inf Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRJ_TESTEXPORTS
+
+// T_DataWindowGc
+../scripts/smoketest_bitmap.script z:/smoketest/smoketest_bitmap.script
+../scripts/setup_smoketest_bitmap.script z:/smoketest/setup_smoketest_bitmap.script
+
+../testdata/smoketest_bitmap.ini z:/smoketest/smoketest_bitmap.ini
+
+// Generic test data
+../testdata/datafile/uibench_16bit.mbm z:/smoketest/bitmap/uibench_16bit.mbm
+
+PRJ_TESTMMPFILES
+
+T_GraphicsWservAPI.mmp
+
+../AnimPlugin/group/T_AnimPlugin.mmp
+../TWsGraphicShare/TWsGraphicShare.mmp
+../TWsGraphicShare/TWsGraphicUnshare.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataAnim.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_TESTANIM_H__)
+#define __T_GRAPHICS_WSERV_TESTANIM_H__
+
+#include "T_RAnimChild.h"
+#include "DataWrapperBase.h"
+
+#define KIpcArgNum 3
+
+class CT_DataAnim : public CDataWrapperBase
+ {
+public:
+ static CT_DataAnim* NewL();
+
+ ~CT_DataAnim();
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ void RunL(CActive* aActive, TInt aIndex);
+
+protected:
+ CT_DataAnim();
+ void ConstructL();
+
+private:
+ void DestroyData();
+
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdConstructL(const TDesC& aSection);
+ void DoCmdCommandReply(const TDesC& aSection);
+ void DoCmdCommand(const TDesC& aSection);
+ void DoCmdAsyncCommandReply(const TDesC& aSection, const TInt aAsyncErrorIndex);
+ void DoCmdClose();
+ void DoCmdDestroy();
+ void DoCmdDestructor();
+
+ TDesC8& CopyToSendBuf(const TDesC& buf);
+
+ TBool GetIpcArg(const TDesC& aSection);
+
+ TBool CheckIpcArg(const TDesC& aSection);
+ TBool CheckAnimateInterval(const TDesC& aSection);
+
+ TBool ReadAnimCommand(const TDesC& aSectName, const TDesC& aKeyName, TInt& aCommand);
+ TBool ReadAnimType(const TDesC& aSectName, const TDesC& aKeyName, TInt& aType);
+private:
+ CActiveCallback* iActiveCallback;
+ T_RAnimChild* iAnim;
+
+ TIpcArgs iIpcArgs;
+
+ RBuf8 iSendBuf;
+ RBuf iIpcBuf[KIpcArgNum];
+
+ TBuf<200> iAsyncCmdSection;
+ };
+
+
+#endif /* __T_GRAPHICS_WSERV_TESTANIM_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataAnimDll.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_ANIMDLL_H__)
+#define __T_GRAPHICS_WSERV_ANIMDLL_H__
+
+// User Includes
+#include "T_DataWsClientClass.h"
+
+class CT_DataAnimDll : public CDataWrapperBase, public CT_DataWsClientClass
+ {
+public:
+ static CT_DataAnimDll* NewL();
+
+ ~CT_DataAnimDll();
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataAnimDll();
+ void ConstructL();
+
+ virtual MWsClientClass* GetClientClass() const;
+
+private:
+ void DestroyData();
+
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdLoad(const TDesC& aSection);
+ void DoCmdClose();
+ void DoCmdDestroy();
+ void DoCmdDestructor();
+
+private:
+ RAnimDll* iAnimDll;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_ANIMDLL_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataAnimForMClass.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_ANIM_FOR_MCLASS_H__)
+#define __T_GRAPHICS_WSERV_ANIM_FOR_MCLASS_H__
+
+#include "T_RAnimChild.h"
+#include "DataWrapperBase.h"
+
+#define KIpcArgNum 3
+
+class CT_DataAnimForMClass : public CDataWrapperBase
+ {
+public:
+ static CT_DataAnimForMClass* NewL();
+
+ ~CT_DataAnimForMClass();
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection,const TInt);
+ //void RunL(CActive* aActive, TInt aIndex);
+
+protected:
+ CT_DataAnimForMClass();
+ void ConstructL();
+
+private:
+ void DestroyData();
+
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdConstructL(const TDesC& aSection);
+ void DoCmdCommandReplyL(const TDesC& aSection);
+ void DoCmdCommand(const TDesC& aSection);
+ void DoCmdAsyncCommandReply(const TDesC& aSection, const TInt aAsyncErrorIndex);
+ void DoCmdClose();
+ void DoCmdDestroy();
+ void DoCmdDestructor();
+
+ TDesC8& CopyToSendBuf(const TDesC& buf);
+
+ TBool GetIpcArg(const TDesC& aSection);
+
+ TBool CheckIpcArg(const TDesC& aSection);
+ TBool CheckAnimateInterval(const TDesC& aSection);
+ void ResetIpcArg();
+ //MAnimGeneralFunctions
+ void DoCmdRetrieveResult(const TDesC& aSectName , const TInt& datOpcode);
+
+ void DoCmdGeneralAnimate(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralClient(const TDesC& aSectName , const TInt& datOpcode );
+ void DoCmdGeneralFlashStateOn(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralPanic(const TDesC& aSectName, const TInt& datOpcode);
+ void DoCmdGeneralScreenDevice(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralWindowExtension(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralEventExtension(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralExtendedInterface(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralNumOfExtInterfaces(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralGetRawEvents(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralPostRawEvent(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralPostKeyEventL(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralSetSync(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralSync(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralSetInterval(const TDesC& aSectName, const TInt& datOpcode);
+ void DoCmdGeneralSetNextInterval(const TDesC& aSectName, const TInt& datOpcode);
+ void DoCmdGeneralSystemTime(const TDesC& aSectName, const TInt& datOpcode);
+ void DoCmdGeneralRegisterForNotis(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralMessage(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralDuplicateBitmapL(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralDuplicateFontL(const TDesC& aSectName, const TInt& datOpcode);
+ void DoCmdGeneralCloseFontL(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdGeneralReplyBuf8(const TDesC& aSectName, const TInt& datOpcode);
+ void DoCmdGeneralReplyBuf16(const TDesC& aSectName, const TInt& datOpcode);
+
+ void DoCmdSpriteGetSpriteMember(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdSpriteUpdateMember(const TDesC& aSectName, const TInt& datOpcode);
+ void DoCmdSpriteActivate(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdSpriteSpriteCanBeSeen(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdSpriteSizeChangedL(const TDesC& aSectName , const TInt& datOpcode);
+ void DoCmdSpriteSetPosition(const TDesC& aSectName , const TInt& datOpcode);
+
+ //MAnimWindowFunctions
+ void DoWindowActivateGc(TInt aOpcode);
+ void DoWindowSetRect(TInt aOpcode,const TDesC& aSection);
+ void DoWindowWindowSizeL(TInt aOpcode,const TDesC& aSection);
+ void DoWindowIsHidden(TInt aOpcode,const TDesC& aSection);
+ void DoWindowSetVisible(TInt aOpcode,const TDesC& aSection);
+ void DoWindowInvalidate(TInt aOpcode,const TDesC& aSection);
+ void DoWindowParametersL(TInt aOpcode,const TDesC& aSection);
+ void DoWindowVisibleRegion(TInt aOpcode,const TDesC& aSection);
+ void GetWindowRetrieveResult(TInt aOpcode,const TDesC& aSection);
+
+ //MAnimGeneralFunctionsWindowExtension
+ void DoGeneralExtScreensL(TInt aOpcode,const TDesC& aSection);
+ void DoGeneralExtFocusScreensL(TInt aOpcode,const TDesC& aSection);
+ void DoGeneralExtSetFocusScreen(TInt aOpcode,const TDesC& aSection);
+ void DoGeneralExtWindowGroupsL(TInt aOpcode,const TDesC& aSection);
+ void DoGeneralExtWindowGroupInfoL(TInt aOpcode,const TDesC& aSection);
+ void DoGeneralExtWindowGroupNameL(TInt aOpcode,const TDesC& aSection);
+ void DoGeneralExtSetOrdinalPositionL(TInt aOpcode,const TDesC& aSection);
+ void DoGeneralExtIsFocusableL(TInt aOpcode,const TDesC& aSection);
+
+ //MAnimFreeTimerWindowFunctions
+ void DoFreeTimerWinDeactivateGc(TInt aOpcode);
+ void DoFreeTimerWinUpdate(TInt aOpcode);
+
+ //Common Util
+ void DoCmdEatupMemory(const TInt& datOpcode);
+ void DoCmdFreeEatenMemory(const TInt& datOpcode);
+private:
+ CActiveCallback* iActiveCallback;
+ T_RAnimChild* iAnim;
+
+ TIpcArgs iIpcArgs;
+
+ RBuf8 iSendBuf;
+ RBuf iIpcBuf[KIpcArgNum];
+
+ TBuf<200> iAsyncCmdSection;
+ };
+
+
+#endif /* __T_GRAPHICS_WSERV_TESTANIM_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataBackedUpWindow.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_BACKEDUPWINDOW_H__)
+#define __T_GRAPHICS_WSERV_BACKEDUPWINDOW_H__
+
+// User Includes
+#include "T_DataDrawableWindow.h"
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataBackedUpWindow : public CT_DataDrawableWindow
+ {
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataBackedUpWindow* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataBackedUpWindow();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * @return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iBackedUpWindow; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataBackedUpWindow();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ virtual RDrawableWindow* GetDrawableWindow() const;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdConstructL(const TDesC& aSection);
+ void DoCmdBitmapHandle();
+ void DoCmdUpdateScreenL(const TDesC& aSection);
+ void DoCmdUpdateBackupBitmap();
+ void DoCmdMaintainBackup();
+
+private:
+ RBackedUpWindow* iBackedUpWindow;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_BACKEDUPWINDOW_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataBlankWindow.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_BLANKWINDOW_H__)
+#define __T_GRAPHICS_WSERV_BLANKWINDOW_H__
+
+// User Includes
+#include "T_DataWindowBase.h"
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataBlankWindow : public CT_DataWindowBase
+ {
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataBlankWindow* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataBlankWindow();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * @return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iBlankWindow; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataBlankWindow();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ virtual RWindowBase* GetWindowBase() const;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdConstructL(const TDesC& aSection);
+ void DoCmdSetColor(const TDesC& aSection);
+ void DoCmdSetSize(const TDesC& aSection);
+ void DoCmdSetExtent(const TDesC& aSection);
+
+private:
+ RBlankWindow* iBlankWindow;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_BLANKWINDOW_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataDirectScreenAccess.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef T_DATADIRECTSCREENACCESS_H_
+#define T_DATADIRECTSCREENACCESS_H_
+
+#include <w32std.h>
+#include "DataWrapperActive.h"
+
+
+class CT_DataDirectScreenAccess : public CDataWrapperActive
+ , public MDirectScreenAccess
+{
+public:
+ static CT_DataDirectScreenAccess* NewL();
+ ~CT_DataDirectScreenAccess();
+ virtual TAny* GetObject() {return iDirectScreenAccess; }
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const
+ TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ //implement the CDataWrapperActive
+ virtual CActive* GetActive() {return iDirectScreenAccess; }
+
+protected:
+ CT_DataDirectScreenAccess();
+ void ConstructL();
+
+private: //functions to be tested
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdStartL(const TDesC& aSection);
+ void DoCmdGcL(const TDesC& aSection);
+ void DoCmdScreenDeviceL(const TDesC& aSection);
+ void DoCmdDrawRegion(const TDesC& aSection);
+ void DoCmdSetPriority(const TDesC& aSection);
+ void DoCmdBringAppFgL(const TDesC& aSection);
+ void DoCmdDestructor();
+
+private:
+ //implement the MDirectScreenAccess
+ void Restart(RDirectScreenAccess::TTerminationReasons aReason);
+ void AbortNow(RDirectScreenAccess::TTerminationReasons aReason);
+
+ //Helper function
+ void DestroyData();
+ RWsSession* GetRWSessionL(const TDesC& aSection);
+ CWsScreenDevice* GetDevicesL(const TDesC& aSection);
+ RWindow* GetWindowL(const TDesC& aSection);
+
+private:
+ //Wrapped Object
+ CDirectScreenAccess* iDirectScreenAccess;
+ RDirectScreenAccess::TTerminationReasons iWantedReason;
+
+
+
+};
+
+
+
+#endif /*T_DATADIRECTSCREENACCESS_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataDrawableWindow.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_DRAWABLEWINDOW_H__)
+#define __T_GRAPHICS_WSERV_DRAWABLEWINDOW_H__
+
+// User Includes
+#include "T_DataWindowBase.h"
+
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataDrawableWindow : public CT_DataWindowBase
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataDrawableWindow();
+
+ virtual RDrawableWindow* GetDrawableWindow() const=0;
+ virtual RWindowBase* GetWindowBase() const;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DoCmdScroll(const TDesC& aEntry);
+ void DoCmdGetDrawRect(const TDesC& aEntry);
+ };
+
+ #endif /* __T_GRAPHICS_WSERV_DRAWABLEWINDOW_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataDsaSession.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef T_DATADSASESSION_H_
+#define T_DATADSASESSION_H_
+
+#include <w32std.h>
+#include "DataWrapperBase.h"
+#include "T_DataWsClientClass.h"
+
+class CT_DataDsaSession : public CDataWrapperBase, public CT_DataWsClientClass
+{
+public:
+ static CT_DataDsaSession* NewL();
+ ~CT_DataDsaSession();
+ virtual TAny* GetObject() {return iDsaSession;}
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const
+ TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataDsaSession();
+ void ConstructL();
+ void RunL(CActive* aActive, TInt aIndex);
+ void DoCancel(CActive* aActive, TInt aIndex);
+ virtual MWsClientClass* GetClientClass() const;
+
+private://functions used to test.
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdConstruct();
+ void DoCmdClose();
+ void DoCmdRequestL(const TDesC& aSection, const TInt aAsyncErrorIndex);
+ void DoCmdCompleted();
+ void DoCmdCancel();
+
+ void DoCmdEatupMemory(const TDesC& aSection);
+ void DoCmdFreeEatenMemory();
+private:
+ //helper functions
+ void DestroyData();
+ //Helper class
+ RWsSession* GetRWSessionL(const TDesC& aSection);
+
+ //used in ActiveCallback
+ void RunRequestReady( const TInt aIndex);
+
+private:
+ RDirectScreenAccess* iDsaSession;
+ //ActiveCallback objects
+ CActiveCallback* iActiveRequestReady;
+};
+
+
+#endif /*T_DATADSASESSION_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataFrame.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_FRAME_H__)
+#define __T_GRAPHICS_WSERV_FRAME_H__
+
+#include <w32stdgraphic.h>
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataFrame : public CDataWrapperBase
+ {
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataFrame* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataFrame();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iFrame; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataFrame();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+private:
+ void DoCmdDestroy();
+ void DoCmdNewL();
+ void DoCmdFrameInfo(const TDesC& aSection);
+ void DoCmdSetFrameInfo(const TDesC& aSection);
+ void DoCmdBitmapL(const TDesC& aSection);
+ void DoCmdSetBitmapL(const TDesC& aSection);
+ void DoCmdMaskL(const TDesC& aSection);
+ void DoCmdSetMaskL(const TDesC& aSection);
+private:
+ CWsGraphicBitmapAnimation::CFrame* iFrame;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_FRAME_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataSoundPlugIn.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataSoundPlugIn
+*/
+
+#if (!defined __T_WSSOUNDPLUGIN_DATA_H__)
+#define __T_WSSOUNDPLUGIN_DATA_H__
+
+// EPOC includes
+#include <w32std.h>
+#include <datawrapper.h>
+// User Includes
+#include "DataWrapperBase.h"
+#include "T_DataWsClientClass.h"
+
+class CT_DataSoundPlugIn : public CDataWrapperBase , public CT_DataWsClientClass
+ {
+public:
+ static CT_DataSoundPlugIn* NewL();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+
+ ~CT_DataSoundPlugIn();
+
+ virtual TAny* GetObject();
+
+protected:
+ CT_DataSoundPlugIn();
+ void ConstructL();
+
+ virtual MWsClientClass* GetClientClass() const;
+
+private:
+ void Cleanup();
+
+ // Commands
+ void DoCmdNewL(const TDesC& aSection);
+ void DoCmdConstruct(const TDesC& aSection);
+ void DoCmdClose();
+ void DoCmdDestroy();
+ void DoCmdIsLoaded(const TDesC& aSection);
+ void DoCmdUnload();
+ void DoCmdLoad(const TDesC& aSection);
+ void DoCmdSetKeyClick(const TDesC& aSection);
+ void DoCmdSetPenClick(const TDesC& aSection);
+ void DoCmdKeyClickEnabled(const TDesC& aSection);
+ void DoCmdPenClickEnabled(const TDesC& aSection);
+ void DoCmdCommandReply(const TDesC& aSection);
+private:
+ RSoundPlugIn* iSoundPlugIn;
+ };
+
+#endif /* __T_WSSOUNDPLUGIN_DATA_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWindow.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WINDOW_H__)
+#define __T_GRAPHICS_WSERV_WINDOW_H__
+
+// User Includes
+#include "T_DataDrawableWindow.h"
+
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWindow : public CT_DataDrawableWindow
+ {
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWindow* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWindow();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWindow; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWindow();
+
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ virtual RDrawableWindow* GetDrawableWindow() const;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdConstructL(const TDesC& aSection);
+ void DoCmdBeginRedraw(const TDesC& aSection);
+ void DoCmdEndRedraw();
+ void DoCmdInvalidate(const TDesC& aSection);
+ void DoCmdGetInvalidRegionL(const TDesC& aSection);
+ void DoCmdSetBackgroundColor(const TDesC& aSection);
+ void DoCmdSetSize(const TDesC& aSection);
+ void DoCmdSetExtent(const TDesC& aSection);
+ void DoCmdHandleTransparencyUpdate();
+ void DoCmdSetTransparencyFactor(const TDesC& aSection);
+ void DoCmdSetTransparencyBitmapL(const TDesC& aSection);
+ void DoCmdSetTransparencyWsBitmapL(const TDesC& aSection);
+ void DoCmdSetNonTransparent();
+ void DoCmdEnableRedrawStore(const TDesC& aSection);
+ void DoCmdSetTransparencyAlphaChannel();
+ void DoCmdSetTransparentRegionL(const TDesC& aSection);
+ void DoCmdSetTransparencyPolicy(const TDesC& aSection);
+ void DoCmdIsRedrawStoreEnabled(const TDesC& aSection);
+ void DoCmdEnableOSB(const TDesC& aSection);
+ void DoCmdSave();
+
+private:
+ RWindow* iWindow;
+ };
+#endif /* __T_GRAPHICS_WSERV_WINDOW_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWindowBase.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WINDOWBASE_H__)
+#define __T_GRAPHICS_WSERV_WINDOWBASE_H__
+
+// User Includes
+#include "T_DataWindowTreeNode.h"
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWindowBase : public CT_DataWindowTreeNode
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWindowBase();
+
+ virtual RWindowBase* GetWindowBase() const=0;
+ virtual RWindowTreeNode* GetWindowTreeNode() const;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DoCmdActivate();
+ void DoCmdSetPosition(const TDesC& aSection);
+ void DoCmdSetSizeErr(const TDesC& aSection);
+ void DoCmdSetExtentErr(const TDesC& aSection);
+ void DoCmdSize(const TDesC& aSection);
+ void DoCmdInquireOffsetL(const TDesC& aSection);
+ void DoCmdPointerFilter(const TDesC& aSection);
+ void DoCmdSetPointerGrab(const TDesC& aSection);
+ void DoCmdClaimPointerGrab(const TDesC& aSection);
+ void DoCmdSetPointerCapture(const TDesC& aSection);
+ void DoCmdSetPointerCapturePriority(const TDesC& aSection);
+ void DoCmdGetPointerCapturePriority(const TDesC& aSection);
+ void DoCmdSetVisible(const TDesC& aSection);
+ void DoCmdSetShadowHeight(const TDesC& aSection);
+ void DoCmdSetShadowDisabled(const TDesC& aSection);
+ void DoCmdPosition(const TDesC& aSection);
+ void DoCmdAbsPosition(const TDesC& aSection);
+ void DoCmdSetCornerType(const TDesC& aSection);
+ void DoCmdSetShapeL(const TDesC& aSection);
+ void DoCmdSetRequiredDisplayMode(const TDesC& aSection);
+ void DoCmdDisplayMode(const TDesC& aSection);
+ void DoCmdEnableBackup(const TDesC& aSection);
+ void DoCmdRequestPointerRepeatEvent(const TDesC& aSection);
+ void DoCmdCancelPointerRepeatEventRequest();
+ void DoCmdAllocPointerMoveBuffer(const TDesC& aSection);
+ void DoCmdFreePointerMoveBuffer();
+ void DoCmdEnablePointerMoveBuffer();
+ void DoCmdDisablePointerMoveBuffer();
+ void DoCmdRetrievePointerMoveBufferL(const TDesC& aSection);
+ void DoCmdDiscardPointerMoveBuffer();
+ void DoCmdAddKeyRect(const TDesC& aSection);
+ void DoCmdRemoveAllKeyRects();
+ void DoCmdPasswordWindow(const TDesC& aSection);
+ void DoCmdFadeBehind(const TDesC& aSection);
+ void DoCmdIsFaded(const TDesC& aSection);
+ void DoCmdIsNonFading(const TDesC& aSection);
+ void DoCmdMoveToGroupL(const TDesC& aSection);
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WINDOWBASE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWindowGc.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WINDOWGC_H__)
+#define __T_GRAPHICS_WSERV_WINDOWGC_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+#include "T_DataBitmapContext.h"
+#include "T_DataWsClientClass.h"
+
+// EPOC Includes
+#include <gdi.h>
+
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWindowGc : public CT_DataBitmapContext, public CT_DataWsClientClass
+ {
+
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWindowGc* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWindowGc();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWindowGc; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWindowGc();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ virtual MWsClientClass* GetClientClass() const;
+ virtual CGraphicsContext* GetGraphicsContext() const;
+ virtual CBitmapContext* GetBitmapContext() const;
+
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdDestructor();
+ void DoCmdConstruct();
+ void DoCmdActivateL(const TDesC& aSection);
+ void DoCmdDeactivate();
+ void DoCmdBitBltL(const TDesC& aCommand, const TDesC& aSection, const TInt aAsyncErrorIndex);
+ void DoCmdBitBltMaskedL(const TDesC& aCommand, const TDesC& aSection, const TInt aAsyncErrorIndex);
+ void DoCmdSetDitherOrigin(const TDesC& aSection);
+ void DoCmdSetOpaque(const TDesC& aSection);
+ void DoCmdDrawWsGraphicL(const TDesC& aSection);
+
+private:
+ CWindowGc* iWindowGc;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WINDOWGC_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWindowGroup.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WINDOWGROUP_H__)
+#define __T_GRAPHICS_WSERV_WINDOWGROUP_H__
+
+// User Includes
+#include "T_DataWindowTreeNode.h"
+
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWindowGroup : public CT_DataWindowTreeNode
+ {
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWindowGroup* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWindowGroup();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWindowGroup; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWindowGroup();
+
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ virtual RWindowTreeNode* GetWindowTreeNode() const;
+
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdDestructor();
+ void DoCmdConstructL(const TDesC& aSection);
+ void DoCmdConstructChildAppL(const TDesC& aSection);
+ void DoCmdAllowProcessToCreateChildWindowGroups(const TDesC& aSection);
+ void DoCmdEnableReceiptOfFocus(const TDesC& aSection);
+ void DoCmdAutoForeground(const TDesC& aSection);
+ void DoCmdSetOrdinalPriorityAdjust(const TDesC& aSection);
+ void DoCmdSetOrdinalPositionErr(const TDesC& aSection);
+ void DoCmdCaptureKey(const TDesC& aSection);
+ void DoCmdCancelCaptureKey(const TDesC& aSection);
+ void DoCmdCaptureKeyUpAndDowns(const TDesC& aSection);
+ void DoCmdCancelCaptureKeyUpAndDowns(const TDesC& aSection);
+ void DoCmdCaptureLongKey(const TDesC& aSection);
+ void DoCmdCancelCaptureLongKey(const TDesC& aSection);
+ void DoCmdAddPriorityKey(const TDesC& aSection);
+ void DoCmdRemovePriorityKey(const TDesC& aSection);
+ void DoCmdSetTextCursorL(const TDesC& aSection);
+ void DoCmdCancelTextCursor();
+ void DoCmdSetOwningWindowGroupL(const TDesC& aSection);
+ void DoCmdDefaultOwningWindow();
+ void DoCmdSetName(const TDesC& aSection);
+ void DoCmdName(const TDesC& aSection);
+ void DoCmdIdentifier();
+ void DoCmdDisableKeyClick(const TDesC& aSection);
+ void DoCmdEnableScreenChangeEvents();
+ void DoCmdDisableScreenChangeEvents();
+ void DoCmdSimulatePointerEvent(const TDesC& aSection);
+ void DoCmdSetChildGroupL(const TDesC& aSection);
+ void DoCmdClearChildGroup();
+
+private:
+ RWindowGroup* iWindowGroup;
+ TInt32 iCaptureKeyHandle;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WINDOWGROUP_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWindowInfo.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WINDOWINFO_H__)
+#define __T_GRAPHICS_WSERV_WINDOWINFO_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC Includes
+#include <w32std.h>
+#include <w32adll.h>
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWindowInfo : public CDataWrapperBase
+ {
+
+public:
+ static CT_DataWindowInfo* NewL();
+
+ ~CT_DataWindowInfo();
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataWindowInfo();
+ void ConstructL();
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnew();
+ void DoCmdDestructor();
+ void DoCmdGetRedrawRegionAndRedrawShadowRegion(const TDesC& aEntry);
+
+private:
+ TWindowInfo* iWindowInfo;
+ const TRegion* iRedrawRegion;
+ const TRegion* iRedrawShadowRegion;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WINDOWINFO_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWindowTreeNode.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WINDOWTREENODE_H__)
+#define __T_GRAPHICS_WSERV_WINDOWTREENODE_H__
+
+// User Includes
+#include "T_DataWsClientClass.h"
+#include "DataWrapperBase.h"
+#include "T_GraphicsUtil.h"
+
+// EPOC includes
+#include <w32std.h>
+#include <e32keys.h>
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWindowTreeNode : public CDataWrapperBase, public CT_DataWsClientClass
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWindowTreeNode();
+
+ virtual MWsClientClass* GetClientClass() const;
+ virtual RWindowTreeNode* GetWindowTreeNode() const=0;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DoCmdClose();
+ void DoCmdDestroyL();
+ void DoCmdParent(const TDesC& aSection);
+ void DoCmdPrevSibling(const TDesC& aSection);
+ void DoCmdNextSibling(const TDesC& aSection);
+ void DoCmdChild(const TDesC& aSection);
+ void DoCmdOrdinalPriority(const TDesC& aSection);
+ void DoCmdOrdinalPosition(const TDesC& aSection);
+ void DoCmdFullOrdinalPosition(const TDesC& aSection);
+ void DoCmdSetOrdinalPosition(const TDesC& aSection);
+ void DoCmdWindowGroupId();
+ void DoCmdSetPointerCursor(const TDesC& aSection);
+ void DoCmdSetCustomPointerCursorL(const TDesC& aSection);
+ void DoCmdEnableOnEvents(const TDesC& aSection);
+ void DoCmdDisableOnEvents();
+ void DoCmdEnableGroupChangeEvents();
+ void DoCmdDisableGroupChangeEvents();
+ void DoCmdEnableFocusChangeEvents();
+ void DoCmdDisableFocusChangeEvents();
+ void DoCmdEnableGroupListChangeEvents();
+ void DoCmdDisableGroupListChangeEvents();
+ void DoCmdEnableVisibilityChangeEvents();
+ void DoCmdDisableVisibilityChangeEvents();
+ void DoCmdEnableErrorMessages(const TDesC& aSection);
+ void DoCmdDisableErrorMessages();
+ void DoCmdEnableModifierChangedEvents(const TDesC& aSection);
+ void DoCmdDisableModifierChangedEvents();
+ void DoCmdSetNonFading(const TDesC& aSection);
+ void DoCmdSetFaded(const TDesC& aSection);
+ void DoCmdClearPointerCursor();
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WINDOWTREENODE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsBitmap.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WSBITMAP_H__)
+#define __T_GRAPHICS_WSERV_WSBITMAP_H__
+
+// User Includes
+#include "T_DataWsClientClass.h"
+#include "T_DataFbsBitmap.h"
+
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsBitmap : public CT_DataFbsBitmap, public CT_DataWsClientClass
+ {
+
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWsBitmap* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWsBitmap();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWsBitmap; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWsBitmap();
+
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ virtual MWsClientClass* GetClientClass() const;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnewL(const TDesC& aEntry);
+ void DoCmdDestructor();
+ void DoCmdCreate(const TDesC& aEntry);
+ void DoCmdDuplicateL(const TDesC& aEntry);
+ void DoCmdLoad(const TDesC& aEntry);
+ void DoCmdInternalizeL(const TDesC& aEntry);
+ void DoCmdReset();
+
+private:
+ CWsBitmap* iWsBitmap;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WSBITMAP_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsClientClass.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_CLIENTCLASS_H__)
+#define __T_GRAPHICS_WSERV_CLIENTCLASS_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC Includes
+#include <w32std.h>
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsClientClass
+ {
+public:
+ virtual TBool DoCommandL(CDataWrapperBase& aDataWrapper, const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ virtual MWsClientClass* GetClientClass() const=0;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DoCmdWsHandle(CDataWrapperBase& aDataWrapper, const TDesC& aSection);
+ };
+
+#endif /* __T_GRAPHICS_WSERV_CLIENTCLASS_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsEvent.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_EVENT_H__)
+#define __T_GRAPHICS_WSERV_EVENT_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC Includes
+#include <w32std.h>
+
+class CT_DataWsEvent : public CDataWrapperBase
+ {
+public:
+ static CT_DataWsEvent* NewL();
+
+ ~CT_DataWsEvent();
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataWsEvent();
+ void ConstructL();
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnew();
+ void DoCmdErrorMessage(const TDesC& aSection);
+ void DoCmdEventData(const TDesC& aSection);
+ void DoCmdHandle(const TDesC& aSection);
+ void DoCmdInt(const TDesC& aSection);
+ void DoCmdKey(const TDesC& aSection);
+ void DoCmdModifiersChanged(const TDesC& aSection);
+ void DoCmdPointer(const TDesC& aSection);
+ void DoCmdSetHandle(const TDesC& aSection);
+ void DoCmdSetTimeNow();
+ void DoCmdSetType(const TDesC& aSection);
+ void DoCmdTime();
+ void DoCmdType(const TDesC& aSection);
+ void DoCmdVisibilityChanged(const TDesC& aSection);
+
+private:
+ TWsEvent* iWsEvent;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_EVENT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsGraphic.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WSGRAPHIC_H__)
+#define __T_GRAPHICS_WSERV_WSGRAPHIC_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC Includes
+#include <w32std.h>
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsGraphic : public CDataWrapperBase
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWsGraphic();
+
+ virtual CWsGraphic* GetWsGraphic() const = 0;
+ virtual TInt Share(TSecureId aClientId) = 0;
+ virtual TInt ShareGlobally() = 0;
+ virtual TInt UnShare(TSecureId aClientId) = 0;
+ virtual TInt UnShareGlobally() = 0;
+
+private:
+ // Helper methods
+ void DoCmdDestructorL();
+ void DoCmdDestroy();
+ void DoCmdIdL(const TDesC& aEntry);
+ void DoCmdIsActive(const TDesC& aEntry);
+ void DoCmdShareGlobally();
+ void DoCmdShare(const TDesC& aEntry);
+ void DoCmdUnShare(const TDesC& aEntry);
+ void DoCmdUnShareGlobally();
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WSGRAPHIC_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsGraphicAnimation.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_DATA_WS_GRAPHIC_ANNIMATION_H__)
+#define __T_DATA_WS_GRAPHIC_ANNIMATION_H__
+
+// User Includes
+#include "T_DataWsGraphicMsgFixedBase.h"
+
+// EPOC Includes
+#include <w32stdgraphic.h>
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsGraphicAnimation : public CT_DataWsGraphicMsgFixedBase
+ {
+public:
+ CT_DataWsGraphicAnimation();
+ ~CT_DataWsGraphicAnimation();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+ virtual TAny* GetObject();
+
+protected:
+ // CT_DataWsGraphicMsgFixedBase implementation
+ virtual TWsGraphicMsgFixedBase* GetWsGraphicMsgFixedBase() const;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnew();
+ void DoCmdIsPaused(const TDesC& aSection);
+ void DoCmdIsPlaying(const TDesC& aSection);
+ void DoCmdIsStopped(const TDesC& aSection);
+ void DoCmdIsStopping(const TDesC& aSection);
+ void DoCmdLoops(const TDesC& aSection);
+ void DoCmdPause();
+ void DoCmdPlay(const TDesC& aSection);
+ void DoCmdStop(const TDesC& aSection);
+
+private:
+ TWsGraphicAnimation* iWsGraphicAnimation;
+ };
+
+#endif /* __T_DATA_WS_GRAPHIC_ANNIMATION_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsGraphicBitmap.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WSGRAPHICBITMAP_H__)
+#define __T_GRAPHICS_WSERV_WSGRAPHICBITMAP_H__
+
+// User Includes
+#include "T_DataWsGraphic.h"
+
+
+// EPOC includes
+#include <w32stdgraphic.h>
+
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsGraphicBitmap : public CT_DataWsGraphic
+ {
+
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWsGraphicBitmap* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWsGraphicBitmap();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWsGraphicBitmap; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWsGraphicBitmap();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ // CT_DataWsGraphic Implementation
+ virtual CWsGraphic* GetWsGraphic() const;
+ virtual TInt Share(TSecureId aClientId);
+ virtual TInt ShareGlobally();
+ virtual TInt UnShare(TSecureId aClientId);
+ virtual TInt UnShareGlobally();
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdNewL(const TDesC& aEntry);
+ void DoCmdDestructor();
+
+private:
+ CWsGraphicBitmap* iWsGraphicBitmap;
+
+ };
+#endif /* __T_GRAPHICS_WSERV_WSGRAPHICBITMAP_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsGraphicBitmapAnimation.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WSGRAPHICBITMAPANIMATION_H__)
+#define __T_GRAPHICS_WSERV_WSGRAPHICBITMAPANIMATION_H__
+
+#include <w32stdgraphic.h>
+#include "T_DataWsGraphic.h"
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsGraphicBitmapAnimation : public CT_DataWsGraphic
+ {
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWsGraphicBitmapAnimation* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWsGraphicBitmapAnimation();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWsGraphicBitmapAnimation; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWsGraphicBitmapAnimation();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ //from CT_DataWsGraphic
+ CWsGraphic* GetWsGraphic() const {return iWsGraphicBitmapAnimation;};
+ TInt Share(TSecureId aClientId);
+ TInt ShareGlobally();
+ TInt UnShare(TSecureId aClientId);
+ TInt UnShareGlobally();
+
+private:
+ void DoCmdDestroy();
+ void DoCmdNewL(const TDesC& aSection);
+ void Util_StartAnimTesterClientL(const TDesC& aSection);
+ void Util_CloseAnimTesterClientL(const TDesC& aSection);
+
+private:
+ CWsGraphicBitmapAnimation* iWsGraphicBitmapAnimation;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WSGRAPHICBITMAPANIMATION_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsGraphicFrameRate.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_DATA_WS_GRAPHIC_FRAME_RATE_H__)
+#define __T_DATA_WS_GRAPHIC_FRAME_RATE_H__
+
+// User Includes
+#include "T_DataWsGraphicMsgFixedBase.h"
+
+// EPOC Includes
+#include <w32stdgraphictest.h>
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsGraphicFrameRate : public CT_DataWsGraphicMsgFixedBase
+ {
+public:
+ CT_DataWsGraphicFrameRate();
+ ~CT_DataWsGraphicFrameRate();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+ virtual TAny* GetObject();
+
+protected:
+ // CT_DataWsGraphicMsgFixedBase implementation
+ virtual TWsGraphicMsgFixedBase* GetWsGraphicMsgFixedBase() const;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnew();
+
+private:
+ TWsGraphicFrameRate* iWsGraphicFrameRate;
+ };
+
+#endif /* __T_DATA_WS_GRAPHIC_FRAME_RATE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsGraphicMsgBuf.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WSGRAPHICMSGBUF_H__)
+#define __T_GRAPHICS_WSERV_WSGRAPHICMSGBUF_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC Includes
+#include <w32std.h>
+#include <w32stdgraphictest.h>
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsGraphicMsgBuf : public CDataWrapperBase
+ {
+
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWsGraphicMsgBuf* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWsGraphicMsgBuf();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWsGraphicMsgBuf; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWsGraphicMsgBuf();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnew();
+ void DoCmdClose();
+ void DoCmdCleanupClosePushL();
+ void DoCmdAppendL(const TDesC& aSection);
+ void DoCmdRemove(const TDesC& aSection);
+ void DoCmdCount(const TDesC& aSection);
+ void DoCmdTypeId(const TDesC& aSection);
+ void DoCmdDataL(const TDesC& aSection);
+ void DoCmdGetFixedMsg(const TDesC& aSection);
+ void DoCmdPckg();
+
+private:
+ RWsGraphicMsgBuf* iWsGraphicMsgBuf;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WSGRAPHICMSGBUF_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsGraphicMsgFixedBase.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_DATA_WS_GRAPHIC_MSG_FIXED_BASE_H__)
+#define __T_DATA_WS_GRAPHIC_MSG_FIXED_BASE_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsGraphicMsgFixedBase : public CDataWrapperBase
+ {
+public:
+ ~CT_DataWsGraphicMsgFixedBase();
+
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+ TPtrC8 GetPckg();
+
+protected:
+ CT_DataWsGraphicMsgFixedBase();
+
+ virtual TWsGraphicMsgFixedBase* GetWsGraphicMsgFixedBase() const = 0;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DoCmdPckg();
+ void DoCmdSize(const TDesC& aSection);
+ void DoCmdTypeId(const TDesC& aSection);
+
+private:
+ TPtrC8 iPckg;
+ };
+
+#endif /* __T_DATA_WS_GRAPHIC_MSG_FIXED_BASE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsPointerCursor.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WSPOINTERCURSOR_H__)
+#define __T_GRAPHICS_WSERV_WSPOINTERCURSOR_H__
+
+// User Includes
+#include "T_DataWsSpriteBase.h"
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsPointerCursor : public CT_DataWsSpriteBase
+ {
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWsPointerCursor* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWsPointerCursor();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWsPointerCursor; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWsPointerCursor();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ virtual RWsSpriteBase* GetWsSpriteBase() const{return iWsPointerCursor;}
+private:
+ void DestroyData();
+ void DoCmdNewL(const TDesC& aSection);
+ void DoCmdConstructL(const TDesC& aSection);
+
+private:
+ RWsPointerCursor* iWsPointerCursor;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WSPOINTERCURSOR_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsPriorityKeyEvent.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_PRIORITYKEYEVENT_H__)
+#define __T_GRAPHICS_WSERV_PRIORITYKEYEVENT_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC Includes
+#include <w32std.h>
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsPriorityKeyEvent : public CDataWrapperBase
+ {
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWsPriorityKeyEvent* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWsPriorityKeyEvent();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWsPriorityKeyEvent; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWsPriorityKeyEvent();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+
+ void DoCmdnew();
+ void DoCmdHandle(const TDesC& aEntry);
+ void DoCmdKey(const TDesC& aEntry);
+ void DoCmdSetHandle(const TDesC& aEntry);
+
+private:
+ TWsPriorityKeyEvent* iWsPriorityKeyEvent;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_PRIORITYKEYEVENT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsRedrawEvent.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_REDRAWEVENT_H__)
+#define __T_GRAPHICS_WSERV_REDRAWEVENT_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+
+// EPOC Includes
+#include <w32std.h>
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsRedrawEvent : public CDataWrapperBase
+ {
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWsRedrawEvent* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWsRedrawEvent();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * @return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWsRedrawEvent; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWsRedrawEvent();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+
+ void DoCmdnew();
+ void DoCmdHandle(const TDesC& aEntry);
+ void DoCmdRect(const TDesC& aEntry);
+
+private:
+ TWsRedrawEvent* iWsRedrawEvent;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_REDRAWEVENT_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsScreenDevice.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_SCREENDEVICE_H__)
+#define __T_GRAPHICS_WSERV_SCREENDEVICE_H__
+
+// User Includes
+#include "T_DataBitmapDevice.h"
+#include "T_DataWsClientClass.h"
+
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsScreenDevice : public CT_DataBitmapDevice, public CT_DataWsClientClass
+ {
+public:
+ static CT_DataWsScreenDevice* NewL();
+
+ ~CT_DataWsScreenDevice();
+
+ virtual TAny* GetObject();
+ virtual void SetObjectL(TAny* aAny);
+
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataWsScreenDevice();
+ void ConstructL();
+
+ virtual MWsClientClass* GetClientClass() const;
+ virtual MGraphicsDeviceMap* GetGraphicsDeviceMap() const;
+ virtual CGraphicsDevice* GetGraphicsDevice() const;
+ virtual CBitmapDevice* GetBitmapDevice() const;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnewL(const TDesC& aSection);
+ void DoCmdDestructor();
+ void DoCmdConstruct(const TDesC& aSection);
+ void DoCmdCopyScreenToBitmapL(const TDesC& aSection);
+ void DoCmdCreateContextL(const TDesC& aSection);
+ void DoCmdCurrentScreenMode(const TDesC& aSection);
+ void DoCmdGetCurrentScreenModeScale(const TDesC& aSection);
+ void DoCmdGetCurrentScreenModeScaledOrigin(const TDesC& aSection);
+ void DoCmdGetDefaultScreenModeOrigin(const TDesC& aSection);
+ void DoCmdGetDefaultScreenSizeAndRotation(const TDesC& aSection);
+ void DoCmdGetFontByIdL(const TDesC& aSection);
+ void DoCmdGetRotationsListL(const TDesC& aSection);
+ void DoCmdGetScreenModeDisplayMode(const TDesC& aSection);
+ void DoCmdGetScreenModeOrigin(const TDesC& aSection);
+ void DoCmdGetScreenModeScale(const TDesC& aSection);
+ void DoCmdGetScreenModeScaledOrigin(const TDesC& aSection);
+ void DoCmdGetScreenModeSizeAndRotation(const TDesC& aSection);
+ void DoCmdGetScreenNumber(const TDesC& aSection);
+ void DoCmdGetScreenSizeModeListL(const TDesC& aSection);
+ void DoCmdNumScreenModes(const TDesC& aSection);
+ void DoCmdPointerRect(const TDesC& aSection);
+ void DoCmdRectCompare(const TDesC& aSection);
+ void DoCmdScreenModeEnforcement(const TDesC& aSection);
+ void DoCmdSetAppScreenMode(const TDesC& aSection);
+ void DoCmdSetBackLight(const TDesC& aSection);
+ void DoCmdSetCustomPaletteL(const TDesC& aSection);
+ void DoCmdSetScreenSizeAndRotation(const TDesC& aSection);
+
+ void DoCmdcheckPixels(const TDesC& aSection);
+ void DoCmdcheckLineColor(const TDesC& aSection);
+ void DoCmdcheckRectColor(const TDesC& aSection);
+
+private:
+ CWsScreenDevice* iWsScreenDevice;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_SCREENDEVICE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsSession.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_SESSION_H__)
+#define __T_GRAPHICS_WSERV_SESSION_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+#include "T_DataWsClientClass.h"
+
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsSession : public CDataWrapperBase, public CT_DataWsClientClass
+ {
+public:
+ static CT_DataWsSession* NewL();
+
+ ~CT_DataWsSession();
+
+ virtual TAny* GetObject() { return iWsSession; }
+
+ virtual void SetObjectL(TAny* aAny);
+
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ CT_DataWsSession();
+
+ void ConstructL();
+
+ void RunL(CActive* aActive, TInt aIndex);
+ void DoCancel(CActive* aActive, TInt aIndex);
+
+ virtual MWsClientClass* GetClientClass() const;
+
+private:
+ /**
+ * Helper methods
+ */
+ void DestroyData();
+ void DoCmdnew();
+ void DoCmdConnectL(const TDesC& aSection);
+ void DoCmdClose();
+ void DoCmdVersion(const TDesC& aSection);
+ void DoCmdSetHotKey(const TDesC& aSection);
+ void DoCmdClearHotKeys(const TDesC& aSection);
+ void DoCmdRestoreDefaultHotKey(const TDesC& aSection);
+ void DoCmdEventReady(const TDesC& aSection, TInt aAsyncErrorIndex);
+ void DoCmdEventReadyCancel();
+ void DoCmdGetEventL(const TDesC& aSection);
+ void DoCmdPurgePointerEvents();
+ void DoCmdRedrawReady(const TDesC& aSection, TInt aAsyncErrorIndex);
+ void DoCmdRedrawReadyCancel();
+ void DoCmdGetRedrawL(const TDesC& aSection);
+ void DoCmdPriorityKeyReady(const TDesC& aSection, TInt aAsyncErrorIndex);
+ void DoCmdPriorityKeyReadyCancel();
+ void DoCmdGetPriorityKeyL(const TDesC& aSection);
+ void DoCmdFlush();
+ void DoCmdSetAutoFlush(const TDesC& aSection);
+ void DoCmdSetKeyboardRepeatRate(const TDesC& aSection);
+ void DoCmdGetKeyboardRepeatRate(const TDesC& aSection);
+ void DoCmdGetDoubleClickSettings(const TDesC& aSection);
+ void DoCmdSetDoubleClick(const TDesC& aSection);
+ void DoCmdNumWindowGroups(const TDesC& aSection);
+ void DoCmdWindowGroupListL(const TDesC& aSection);
+ void DoCmdGetFocusWindowGroup(const TDesC& aSection);
+ void DoCmdGetDefaultOwningWindow(const TDesC& aSection);
+ void DoCmdSetWindowGroupOrdinalPosition(const TDesC& aSection);
+ void DoCmdGetWindowGroupClientThreadId(const TDesC& aSection);
+ void DoCmdGetWindowGroupHandle(const TDesC& aSection);
+ void DoCmdGetWindowGroupOrdinalPriority(const TDesC& aSection);
+ void DoCmdGetWindowGroupNameFromIdentifier(const TDesC& aSection);
+ void DoCmdFindWindowGroupIdentifier(const TDesC& aSection);
+ void DoCmdFetchMessage(const TDesC& aSection);
+ void DoCmdSetShadowVector(const TDesC& aSection);
+ void DoCmdShadowVector(const TDesC& aSection);
+ void DoCmdSetBackgroundColor(const TDesC& aSection);
+ void DoCmdGetBackgroundColor(const TDesC& aSection);
+ void DoCmdSetSystemPointerCursor(const TDesC& aSection);
+ void DoCmdClearSystemPointerCursor(const TDesC& aSection);
+ void DoCmdClaimSystemPointerCursorList();
+ void DoCmdFreeSystemPointerCursorList();
+ void DoCmdSetCustomTextCursorL(const TDesC& aSection);
+ void DoCmdResourceCount(const TDesC& aSection);
+ void DoCmdPasswordEntered();
+ void DoCmdComputeMode(const TDesC& aSection);
+ void DoCmdHeapCount(const TDesC& aSection);
+ void DoCmdSetModifierState(const TDesC& aSection);
+ void DoCmdGetModifierState(const TDesC& aSection);
+ void DoCmdRequestOffEventsL(const TDesC& aSection);
+ void DoCmdGetDefModeMaxNumColors(const TDesC& aSection);
+ void DoCmdGetColorModeListL(const TDesC& aSection);
+ void DoCmdSetPointerCursorArea(const TDesC& aSection);
+ void DoCmdPointerCursorArea(const TDesC& aSection);
+ void DoCmdSetPointerCursorMode(const TDesC& aSection);
+ void DoCmdSetClientCursorMode(const TDesC& aSection);
+ void DoCmdPointerCursorMode(const TDesC& aSection);
+ void DoCmdSetDefaultSystemPointerCursor(const TDesC& aSection);
+ void DoCmdClearDefaultSystemPointerCursor();
+ void DoCmdSetPointerCursorPosition(const TDesC& aSection);
+ void DoCmdPointerCursorPosition(const TDesC& aSection);
+ void DoCmdSetDefaultFadingParameters(const TDesC& aSection);
+ void DoCmdPrepareForSwitchOff();
+ void DoCmdSetBufferSizeL(const TDesC& aSection);
+ void DoCmdSetMaxBufferSizeL(const TDesC& aSection);
+ void DoCmdSetSystemFaded(const TDesC& aSection);
+ void DoCmdSetFocusScreen(const TDesC& aSection);
+ void DoCmdGetFocusScreen(const TDesC& aSection);
+ void DoCmdClearAllRedrawStores();
+ void DoCmdLogCommand(const TDesC& aSection);
+ void DoCmdLogMessage(const TDesC& aSection);
+ void DoCmdNumberOfScreens(const TDesC& aSection);
+ void DoCmdSimulateRawEvent(const TDesC& aSection);
+ void DoCmdSimulateKeyEvent(const TDesC& aSection);
+
+ // CActiveCallback support
+ void RunEventReady(const TInt aIndex);
+ void DoCancelEventReady(const TInt aIndex);
+
+ void RunPriorityKeyReady(const TInt aIndex);
+ void DoCancelPriorityKeyReady(const TInt aIndex);
+
+ void RunRedrawReady(const TInt aIndex);
+ void DoCancelRedrawReady(const TInt aIndex);
+
+private:
+ RWsSession* iWsSession;
+ /** vaiable that temporarily stores value of server resource count that is set
+ * by iSession->ResourceCount()
+ */
+ TInt iResourceCount;
+ TInt iNumWinGroup;
+ TInt iColorModeCount;
+ TInt iWindowGroupIdentifier;
+
+ /** Active object for EventReady async operation */
+ CActiveCallback* iActiveEventReady;
+
+ /** Active object for PriorityKeyReady async operation */
+ CActiveCallback* iActivePriorityKeyReady;
+
+ /** Active object for RedrawReady async operation */
+ CActiveCallback* iActiveRedrawReady;
+
+ /** Keyboard repeat rate data */
+ TTimeIntervalMicroSeconds32 iKeyboardRepeateRateInitialTime;
+ TTimeIntervalMicroSeconds32 iKeyboardRepeateRateTime;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_SESSION_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsSprite.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WSSPRITE_H__)
+#define __T_GRAPHICS_WSERV_WSSPRITE_H__
+
+// User Includes
+#include "T_DataWsSpriteBase.h"
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsSprite : public CT_DataWsSpriteBase
+ {
+public:
+ /**
+ * Two phase constructor
+ */
+ static CT_DataWsSprite* NewL();
+
+ /**
+ * Public destructor
+ */
+ ~CT_DataWsSprite();
+
+ /**
+ * Return a pointer to the object that the data wraps
+ *
+ * \return pointer to the object that the data wraps
+ */
+ virtual TAny* GetObject() { return iWsSprite; }
+
+ /**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ virtual void SetObjectL(TAny* aAny);
+
+ /**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ virtual void DisownObjectL();
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWsSprite();
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ virtual RWsSpriteBase* GetWsSpriteBase() const{return iWsSprite;}
+private:
+ void DestroyData();
+ void DoCmdNewL(const TDesC& aSection);
+ void DoCmdConstructL(const TDesC& aSection);
+ void DoCmdSetPosition(const TDesC& aSection);
+
+private:
+ RWsSprite* iWsSprite;
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WSSPRITE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_DataWsSpriteBase.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_WSSPRITEBASE_H__)
+#define __T_GRAPHICS_WSERV_WSSPRITEBASE_H__
+
+// User Includes
+#include "DataWrapperBase.h"
+#include "T_DataWsClientClass.h"
+/**
+ * Test Active Notification class
+ *
+ */
+class CT_DataWsSpriteBase : public CDataWrapperBase, public CT_DataWsClientClass
+ {
+public:
+ virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+protected:
+ /**
+ * Protected constructor. First phase construction
+ */
+ CT_DataWsSpriteBase();
+
+ virtual MWsClientClass* GetClientClass() const;
+ virtual RWsSpriteBase* GetWsSpriteBase() const=0;
+private:
+ /**
+ * Helper methods
+ */
+ void DoCmdActivate();
+ void DoCmdAppendMemberL(const TDesC& aSection);
+ void DoCmdUpdateMemberL(const TDesC& aSection);
+ void DoCmdClose();
+
+
+ };
+
+#endif /* __T_GRAPHICS_WSERV_WSSPRITEBASE_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_GraphicsWservAPIServer.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if (!defined __T_GRAPHICS_WSERV_API_SERVER_H__)
+#define __T_GRAPHICS_WSERV_API_SERVER_H__
+
+// User Include
+#include "TestServerBase.h"
+
+class CT_GraphicsWservAPIServer : public CTestServerBase
+ {
+private:
+ class CT_GraphicsWservAPIBlock : public CTestBlockController
+ {
+ public:
+ inline CT_GraphicsWservAPIBlock();
+ inline ~CT_GraphicsWservAPIBlock();
+
+ CDataWrapper* CreateDataL(const TDesC& aData);
+ };
+
+public:
+ inline CT_GraphicsWservAPIServer();
+ inline ~CT_GraphicsWservAPIServer();
+
+ static CT_GraphicsWservAPIServer* NewL();
+
+ inline CTestBlockController* CreateTestBlock();
+ };
+
+#include "T_GraphicsWservAPIServer.inl"
+
+#endif /* __T_GRAPHICS_WSERV_API_SERVER_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_GraphicsWservAPIServer.inl Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_GraphicsWservAPIServer inline functions
+*/
+
+
+/*@{*/
+/*@}*/
+
+inline CT_GraphicsWservAPIServer::CT_GraphicsWservAPIBlock::CT_GraphicsWservAPIBlock()
+ {
+ }
+
+inline CT_GraphicsWservAPIServer::CT_GraphicsWservAPIBlock::~CT_GraphicsWservAPIBlock()
+ {
+ }
+
+inline CT_GraphicsWservAPIServer::CT_GraphicsWservAPIServer()
+ {
+ }
+
+inline CT_GraphicsWservAPIServer::~CT_GraphicsWservAPIServer()
+ {
+ }
+
+inline CTestBlockController* CT_GraphicsWservAPIServer::CreateTestBlock()
+ {
+ return new CT_GraphicsWservAPIBlock();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/inc/T_RAnimChild.h Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef TESTANIM_H
+#define TESTANIM_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "w32std.h"
+
+// CLASS DECLARATION
+
+/**
+* CTestAnim
+*
+*/
+class T_RAnimChild : public RAnim
+{
+public: // Constructors and destructor
+ T_RAnimChild();
+ T_RAnimChild(RAnimDll &aDll);
+ virtual ~T_RAnimChild();
+
+ TInt Construct(const RWindowBase &aDevice, TInt aType, const TDesC8 &aParams);
+ TInt Construct(const RWindowBase &aDevice, TInt aType, const TDesC8 &aParams, const TIpcArgs& aIpcArgs);
+ TInt Construct(const RWsSprite &aDevice, TInt aType, const TDesC8 &aParams);
+ TInt Construct(const RWsSprite &aDevice, TInt aType, const TDesC8 &aParams, const TIpcArgs& aIpcArgs);
+ TInt CommandReply(TInt aOpcode);
+ TInt CommandReply(TInt aOpcode, const TPtrC8 &aArgs);
+ TInt CommandReply(TInt aOpcode, const TDesC8& aArgs, const TIpcArgs& aIpcArgs);
+ void Command(TInt aOpcode, const TPtrC8 &aArgs);
+ void Command(TInt aOpcode);
+ void AsyncCommandReply(TRequestStatus& aRequestStatus,TInt aOpcode, const TIpcArgs& aIpcArgs);
+};
+
+#endif // TESTANIM_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/scripts/setup_smoketest_bitmap.script Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,28 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+RUN_UTILS MkDir c:\smoketest\
+
+RUN_UTILS CopyFile z:\smoketest\smoketest_bitmap.ini c:\smoketest\smoketest_bitmap.ini
+RUN_UTILS MakeReadWrite c:\smoketest\smoketest_bitmap.ini
+RUN_UTILS CopyFile z:\smoketest\smoketest_bitmap.script c:\smoketest\smoketest_bitmap.script
+RUN_UTILS MakeReadWrite c:\smoketest\smoketest_bitmap.script
+
+RUN_UTILS MkDir c:\smoketest\bitmap\
+
+//datafile uibench_16bit.mbm
+RUN_UTILS CopyFile z:\smoketest\bitmap\uibench_16bit.mbm c:\smoketest\bitmap\uibench_16bit.mbm
+RUN_UTILS MakeReadWrite c:\smoketest\bitmap\uibench_16bit.mbm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/scripts/smoketest_bitmap.script Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,83 @@
+//
+// Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRINT Run Bitmap smoketest
+
+LOAD_SUITE T_GraphicsWservAPI
+
+START_TESTCASE SMOKE_BITMAP_0001
+//! @SYMTestCaseID SMOKE_BITMAP_0001
+//! @SYMTestCaseDesc BitBlt(const TPoint &aPos, const CFbsBitmap *aBitmap): perform a bitmap block transfer
+//! Uses API elements: RWsSession::Connect & SetAutoFlush, CWsScreenDevice::Construct & GetPixel, RWindowGroup::Construct, RWindow::Construct & BeginRedraw & EndRedraw,
+//! CWindowGc::Construct & Activate & Deactivate & SetBrushColor & SetBrushStyle, CFbsBitmap::Load & SetSizeInTwips
+//! @SYMTestActions 1. Setup a CWindowGc to test and a RWindow to display its drawing result
+//! 1.1 New and connect a RWsSession
+//! 1.2 New and construct a CWsScreenDevice within the RWsSession
+//! 1.3 Create a CWindowGc within the CWsScreenDevice (use CreateContext)
+//! 1.4 New and construct a RWindowGroup within the RWsSession
+//! 1.5 New and construct a RWindow as the child of the RWindowGroup
+//! and SetRequiredDisplayMode (to EColor4K) for the RWindow, SetBackgroundColor to TRgb(255,255,255)
+//! 1.6 SetAutoFlush to TRUE for the RWsSession
+//! 1.7 Activate the CWindowGc to the RWindow
+//! and SetBrushColor to TRgb(255,0,0) and SetBrushStyle to ESolidBrush
+//! . New and Load a CFbsBitmap
+//! 3. Use RWindow::BeginRedraw() to start a redraw cycle
+//! 4. Execute BitBlt to perform a bitmap block transfer to the specified point (10,11)
+//! 5. RWindow::EndRedraw() to end the redraw cycle and display the drawing result
+//! 6. Deactive RWindow, destruct and close all objects used
+ START_TEST_BLOCK 10 T_GraphicsWservAPI c:\smoketest\smoketest_bitmap.ini
+ CREATE_OBJECT RWsSession ws
+ CREATE_OBJECT CWsScreenDevice scrdev
+ CREATE_OBJECT CWindowGc wingc
+ CREATE_OBJECT RWindowGroup wingrp
+ CREATE_OBJECT RWindow win
+ COMMAND ws new
+ COMMAND ws Connect
+ COMMAND scrdev new GRAPHICS-WSERV-WindowGc-Setup-0002-0001-new_command004
+ COMMAND scrdev Construct GRAPHICS-WSERV-WindowGc-Setup-0002-0001-Construct_command005
+ COMMAND scrdev CreateContext GRAPHICS-WSERV-WindowGc-Setup-0002-0001-CreateContext_command006
+ COMMAND wingrp new GRAPHICS-WSERV-WindowGc-Setup-0002-0001-new_command008
+ COMMAND wingrp Construct GRAPHICS-WSERV-WindowGc-Setup-0002-0001-Construct_command009
+ COMMAND win new GRAPHICS-WSERV-WindowGc-Setup-0002-0001-new_command011
+ COMMAND win Construct GRAPHICS-WSERV-WindowGc-Setup-0002-0001-Construct_command012
+ COMMAND win SetRequiredDisplayMode GRAPHICS-WSERV-WindowGc-Setup-0002-0001-SetRequiredDisplayMode_command013
+ COMMAND win SetBackgroundColor GRAPHICS-WSERV-WindowGc-Setup-0002-0001-SetBackgroundColor_command014
+ COMMAND win Activate
+ COMMAND ws SetAutoFlush GRAPHICS-WSERV-WindowGc-Setup-0002-0001-SetAutoFlush_command017
+ COMMAND wingc Activate GRAPHICS-WSERV-WindowGc-Setup-0002-0001-Activate_command019
+ COMMAND wingc SetBrushColor GRAPHICS-WSERV-WindowGc-Setup-0002-0001-SetBrushColor_command020
+ COMMAND wingc SetBrushStyle GRAPHICS-WSERV-WindowGc-Setup-0002-0001-SetBrushStyle_command021
+
+ CREATE_OBJECT CFbsBitmap fbsbmp
+ COMMAND fbsbmp new
+ COMMAND fbsbmp Load GRAPHICS-WSERV-WindowGc-PublicApi-0051-0001-Load_command002
+ COMMAND fbsbmp SizeInTwips
+ COMMAND fbsbmp SizeInPixels
+ COMMAND fbsbmp DisplayMode
+ COMMAND win BeginRedraw
+ COMMAND wingc BitBlt GRAPHICS-WSERV-WindowGc-PublicApi-0051-0001-BitBlt_command009
+ COMMAND win EndRedraw
+ COMMAND win Save
+ COMMAND fbsbmp ~
+
+ COMMAND wingc Deactivate
+ COMMAND win Close
+ COMMAND wingrp Close
+ COMMAND wingc ~
+ COMMAND scrdev ~
+ COMMAND ws Close
+ END_TEST_BLOCK
+END_TESTCASE SMOKE_BITMAP_0001
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataAnim.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,699 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataAnim.h"
+#include "T_GraphicsUtil.h"
+#include "T_AnimDef.h"
+
+#define KMaxBufSize 250
+
+/*@{*/
+_LIT(KDataClassname, "RAnim");
+
+/// Fields
+_LIT(KFldAnimDll, "animdll");
+_LIT(KFldWin, "win");
+_LIT(KFldSprite, "sprite");
+_LIT(KFldType, "type");
+_LIT(KFldParam, "param");
+_LIT(KFldIpcArgs, "ipcargs");
+_LIT(KFldOpcode, "opcode");
+_LIT(KFldArgs, "args");
+_LIT(KFldIpcArg, "ipcargs%d");
+_LIT(KFldExpectedIpcArg, "expected_ipcargs%d");
+
+// enum
+_LIT(KEAnimWindows, "EKWindowAnim");
+_LIT(KEAnimSprite, "EKSpriteAnim");
+_LIT(KEAnimFreeTimer, "EKFreeTimerWindowAnim");
+
+
+_LIT(KEAnimCmdSync, "ECmdSync");
+_LIT(KEAnimCmdTestWithoutPara, "ECmdTestWithoutPara");
+_LIT(KEAnimCmdTestWithPara, "ECmdTestWithPara");
+_LIT(KEAnimCmdGetLast, "ECmdGetLast");
+_LIT(KEAnimCmdGetAnimInterval, "ECmdGetAnimInterval");
+
+
+// animate interval
+_LIT(KFldCheckAnimateInterval, "CheckAnimateInterval");
+_LIT(KFldAnimIpcArgSlot, "AnimIpcArgSlot");
+_LIT(KFldAnimIntervalMin, "AnimIntervalMin");
+_LIT(KFldAnimIntervalMax, "AnimIntervalMax");
+
+_LIT(KIpcArgNothing, "ENothing");
+
+/// Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructorGeneral, "~");
+_LIT(KCmdDestructor, "~RAnim");
+_LIT(KCmdConstruct, "Construct");
+_LIT(KCmdCommandReply, "CommandReply");
+_LIT(KCmdCommand, "Command");
+_LIT(KCmdAsyncCommandReply, "AsyncCommandReply");
+_LIT(KCmdDestroy, "Destroy");
+_LIT(KCmdClose, "Close");
+
+/// Logging
+_LIT(KLogErrNum, "Error=%d");
+_LIT(KLogErrMissingPara, "Missing parameter '%S'");
+_LIT(KLogInfoCmdnewL1, "execute new RAnim(RAnimDll &)");
+_LIT(KLogInfoCmdnewL2, "execute new RAnim()");
+_LIT(KLogErrConstruct, "Construct return err = %d");
+_LIT(KLogInfoCmdConstruct1, "execute RAnim::Construct(const RWindowBase &, TInt, const TDesC8 &)");
+_LIT(KLogInfoCmdConstruct2, "execute RAnim::Construct(const RWindowBase &, TInt, const TDesC8 &, const TIpcArgs &)");
+_LIT(KLogInfoCmdConstruct3, "execute RAnim::Construct(const RWsSprite &, TInt, const TDesC8 &)");
+_LIT(KLogInfoCmdConstruct4, "execute RAnim::Construct(const RWsSprite &, TInt, const TDesC8 &, const TIpcArgs &)");
+_LIT(KLogErrCommandReply, "CommandReply return err = %d");
+_LIT(KLogInfoCmdCommandReply1, "execute RAnim::CommandReply(TInt)");
+_LIT(KLogInfoCmdCommandReply2, "execute RAnim::CommandReply(TInt, const TPtrC8 &)");
+_LIT(KLogInfoCmdCommandReply3, "execute RAnim::CommandReply(TInt, const TDesC8 &, const TIpcArgs &)");
+_LIT(KLogErrCommand, "Command return err = %d");
+_LIT(KLogErrCheckIpcValue, "Ipc arg compare fail expected=%S actual=%S");
+_LIT(KLogErrIpcValue, "Ipc arg return value err");
+
+_LIT(KLogErrAnimInterval, "Animate interval error expected min=%d max=%d");
+
+_LIT(KLogInfoAnimInterval, "Animate interval actual min=%d max=%d");
+
+_LIT(KLogInfoCmdCommand1, "execute RAnim::Command(TInt, const TPtrC8 &)");
+_LIT(KLogInfoCmdCommand2, "execute RAnim::Command(TInt)");
+_LIT(KLogInfoCmdAsyncCommandReply1, "execute RAnim::AsyncCommandReply(TRequestStatus &, TInt, const TIpcArgs &)");
+
+_LIT(KLogInfoCmdClose1, "execute RAnim::Close()");
+_LIT(KLogInfoCmdDestroy1, "execute RAnim::Destroy()");
+_LIT(KLogInfoCmdDestructor1, "execute ~RAnim()");
+/*@}*/
+
+CT_DataAnim* CT_DataAnim::NewL()
+ {
+ CT_DataAnim* ret = new (ELeave) CT_DataAnim();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataAnim::CT_DataAnim()
+: iActiveCallback(NULL)
+ ,iAnim(NULL)
+ {
+ }
+
+void CT_DataAnim::ConstructL()
+ {
+ iActiveCallback = CActiveCallback::NewL(*this);
+ iSendBuf.CreateL(KMaxBufSize);
+
+ for (TInt i=0;i<KIpcArgNum;i++)
+ iIpcBuf[i].CreateL(KMaxBufSize);
+ }
+
+CT_DataAnim::~CT_DataAnim()
+ {
+ DestroyData();
+ delete iActiveCallback;
+ iActiveCallback = NULL;
+
+ iSendBuf.Close();
+
+ for (TInt i=0;i<KIpcArgNum;i++)
+ iIpcBuf[i].Close();
+ }
+
+TAny* CT_DataAnim::GetObject()
+ {
+ return iAnim;
+ }
+
+void CT_DataAnim::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iAnim = static_cast<T_RAnimChild*> (aAny);
+ }
+
+void CT_DataAnim::DisownObjectL()
+ {
+ iAnim = NULL;
+ }
+
+void CT_DataAnim::DestroyData()
+ {
+ DoCmdDestructor();
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataAnim::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructorGeneral || aCommand==KCmdDestructor )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( aCommand==KCmdConstruct )
+ {
+ DoCmdConstructL(aSection);
+ }
+ else if ( aCommand==KCmdCommandReply )
+ {
+ DoCmdCommandReply(aSection);
+ }
+ else if ( aCommand==KCmdCommand )
+ {
+ DoCmdCommand(aSection);
+ }
+ else if ( aCommand==KCmdAsyncCommandReply )
+ {
+ DoCmdAsyncCommandReply(aSection, aAsyncErrorIndex);
+ }
+ else if ( aCommand==KCmdDestroy )
+ {
+ DoCmdDestroy();
+ }
+ else if ( aCommand==KCmdClose )
+ {
+ DoCmdClose();
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+void CT_DataAnim::DoCmdnewL(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // Get test data for command input parameter(s)
+ TPtrC datDllName;
+ RAnimDll* animDll = NULL;
+ if ( GetStringFromConfig(aSection, KFldAnimDll, datDllName) )
+ {
+ animDll = static_cast<RAnimDll*>(GetDataObjectL(datDllName));
+ }
+
+ TInt err = KErrNone;
+ if ( animDll )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogInfoCmdnewL1);
+ iAnim = new (ELeave) T_RAnimChild(*animDll) ;
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogInfoCmdnewL2);
+ iAnim = new (ELeave) T_RAnimChild();
+ }
+ }
+
+TBool CT_DataAnim::GetIpcArg(const TDesC& aSection)
+ {
+ TBool argexist=EFalse;
+
+ TBuf <100> field;
+ TPtrC val;
+ for (TInt i=0;i<KIpcArgNum;i++)
+ {
+ field.Format(KFldIpcArg,i);
+ if ( GetStringFromConfig(aSection, field, val))
+ {
+ if (val.Compare(KIpcArgNothing)==0)
+ iIpcArgs.Set(i,TIpcArgs::ENothing);
+ else
+ {
+ iIpcBuf[i].Copy(val);
+ iIpcArgs.Set(i,&iIpcBuf[i]);
+ }
+ argexist=ETrue;
+ }
+ else
+ break;
+
+ }
+ return argexist;
+ }
+
+// check is the time interval of CAnim::Animate() is in specified scope
+TBool CT_DataAnim::CheckAnimateInterval(const TDesC& aSection)
+ {
+ TBool result=EFalse;
+
+ TInt slot,min,max,find;
+ TInt amin,amax;
+
+ _LIT(KSpace," ");
+
+ // get IPC args slot index
+ if ( GetIntFromConfig(aSection, KFldAnimIpcArgSlot,slot))
+ {
+ // get expected min/max interval of Animate()
+ if ( GetIntFromConfig(aSection, KFldAnimIntervalMin,min) &&
+ GetIntFromConfig(aSection, KFldAnimIntervalMax,max) )
+ {
+ find=iIpcBuf[slot].Find(KSpace); // get actual min/max interval of Animate()
+ if (find>0 )
+ {
+ // get actual min interval
+ TPtrC val1=iIpcBuf[slot].Left(find);
+ TLex lex1(val1);
+ lex1.Val(amin);
+
+ // get actual max interval
+ TPtrC val2=iIpcBuf[slot].Mid(find+1);
+ TLex lex2(val2);
+ lex2.Val(amax);
+
+ INFO_PRINTF3(KLogInfoAnimInterval,amin,amax);
+
+ // check is the interval in expected scope
+ if (amin<min || amax>max)
+ {
+ ERR_PRINTF3(KLogErrAnimInterval, min,max);
+ }
+ else
+ result=ETrue;
+ }
+ }
+ }
+
+ return result;
+ }
+TBool CT_DataAnim::CheckIpcArg(const TDesC& aSection)
+ {
+ TBool result=ETrue;
+
+ // check animate interval
+ TInt checkanim=0;
+ if ( GetIntFromConfig(aSection, KFldCheckAnimateInterval, checkanim)
+ && checkanim)
+ {
+ return CheckAnimateInterval(aSection);
+ }
+
+ TBuf <100> field;
+ TPtrC val;
+
+ // check ipc expected value
+ for (TInt i=0;i<KIpcArgNum;i++)
+ {
+ field.Format(KFldExpectedIpcArg,i);
+ if ( GetStringFromConfig(aSection, field, val) &&
+ val.Compare(iIpcBuf[i])!=0)
+ {
+ ERR_PRINTF3(KLogErrCheckIpcValue, &val, &iIpcBuf[i]);
+ result=EFalse;
+ break;
+ }
+ }
+ return result;
+ }
+
+void CT_DataAnim::DoCmdConstructL(const TDesC& aSection)
+ {
+ TInt err = KErrNone;
+
+ // Get test data for command input parameter(s)
+ TBool dataOk = ETrue;
+
+ // get "const RWindowBase &aDevice" or "const RWsSprite &aDevice"
+ TPtrC datWinName;
+ RWindowBase* win = NULL;
+ TPtrC datSpriteName;
+ RWsSprite* sprite = NULL;
+ if ( GetStringFromConfig(aSection, KFldWin, datWinName))
+ {
+ win = static_cast<RWindowBase*>(GetDataObjectL(datWinName));
+ }
+ else if ( GetStringFromConfig(aSection, KFldSprite, datSpriteName))
+ {
+ sprite = static_cast<RWsSprite*>(GetDataObjectL(datSpriteName));
+ }
+ if (!win && !sprite )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogErrMissingPara, &KFldWin);
+ ERR_PRINTF2(KLogErrMissingPara, &KFldSprite);
+ }
+
+ //get "TInt aType"
+ TInt datType;
+ if ( !ReadAnimType(aSection, KFldType, datType))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogErrMissingPara, &KFldType);
+ }
+
+ // get "const TDesC8 &aArgs"
+ TPtrC inputStr;
+ TBool argexist=EFalse;
+ if( GetStringFromConfig(aSection, KFldParam, inputStr))
+ {
+ CopyToSendBuf(inputStr);
+ argexist=ETrue;
+ }
+
+ if (!argexist)
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogErrMissingPara, &KFldParam);
+ }
+
+ // get "const TIpcArgs &aIpcArgs"
+ TBool ipcexist= EFalse;
+ if ( GetIpcArg(aSection))
+ ipcexist = ETrue;
+
+ if ( !dataOk )
+ {
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ if (win )
+ {
+ if (!ipcexist)
+ {
+ INFO_PRINTF1(KLogInfoCmdConstruct1);
+ err = iAnim->Construct(*win, datType, iSendBuf);
+ }
+ else
+ {
+ INFO_PRINTF1(KLogInfoCmdConstruct2);
+ err = iAnim->Construct(*win, datType, iSendBuf, iIpcArgs);
+ }
+ }
+ else
+ {
+ if (!ipcexist )
+ {
+ INFO_PRINTF1(KLogInfoCmdConstruct3);
+ err = iAnim->Construct(*sprite, datType, iSendBuf);
+ }
+ else
+ {
+ INFO_PRINTF1(KLogInfoCmdConstruct4);
+ err = iAnim->Construct(*sprite, datType, iSendBuf, iIpcArgs);
+ }
+ }
+
+ // Check the command return code
+ if(err != KErrNone)
+ {
+ ERR_PRINTF2(KLogErrConstruct, err);
+ SetError(err);
+ }
+ else if (ipcexist && ! CheckIpcArg(aSection))
+ {
+ ERR_PRINTF1(KLogErrIpcValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+TDesC8& CT_DataAnim::CopyToSendBuf(const TDesC& buf)
+ {
+ TUint8 len=buf.Length();
+
+ iSendBuf.Zero();
+ iSendBuf.Copy(&len,sizeof(len));
+ if (len>0)
+ iSendBuf.Append(buf);
+ return iSendBuf;
+ }
+
+void CT_DataAnim::DoCmdCommandReply(const TDesC& aSection)
+ {
+ TInt err = KErrNone;
+
+ // Get test data for command input parameter(s)
+ TBool dataOk = ETrue;
+
+ // get "TInt aOpcode"
+ TInt datOpcode;
+ if ( !ReadAnimCommand(aSection, KFldOpcode, datOpcode))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogErrMissingPara, &KFldOpcode);
+ }
+
+ // get "const TPtrC8 &aArgs" or "const TDesC8 &aArgs"
+ TPtrC inputStr;
+ TBool argexist=EFalse;
+ if( GetStringFromConfig(aSection, KFldArgs, inputStr))
+ {
+ CopyToSendBuf(inputStr);
+ argexist=ETrue;
+ }
+
+ // get "const TIpcArgs &aIpcArgs"
+ TBool ipcexist= EFalse;
+ if ( GetIpcArg(aSection))
+ ipcexist = ETrue;
+
+
+ if ( dataOk )
+ {
+ if (!argexist)
+ {
+ INFO_PRINTF1(KLogInfoCmdCommandReply1);
+ err = iAnim->CommandReply(datOpcode);
+ }
+ else if (ipcexist)
+ {
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ err = iAnim->CommandReply(datOpcode, iSendBuf, iIpcArgs);
+ }
+ else
+ {
+ INFO_PRINTF1(KLogInfoCmdCommandReply2);
+ err = iAnim->CommandReply(datOpcode, iSendBuf);
+ }
+
+ // Check the command return code
+ if(err != KErrNone)
+ {
+ ERR_PRINTF2(KLogErrCommandReply, err);
+ SetError(err);
+ }
+ else if (ipcexist && ! CheckIpcArg(aSection))
+ {
+ ERR_PRINTF1(KLogErrIpcValue);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ SetBlockResult(EFail);
+
+ }
+
+void CT_DataAnim::DoCmdCommand(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool dataOk = ETrue;
+
+ // get "TInt aOpcode"
+ TInt datOpcode;
+ if ( !ReadAnimCommand(aSection, KFldOpcode, datOpcode))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogErrMissingPara, &KFldOpcode);
+ }
+
+ // get "const TPtrC8 &aArgs" or "const TDesC8 &aArgs"
+ TPtrC inputStr;
+ TBool argexist=EFalse;
+ if( GetStringFromConfig(aSection, KFldArgs, inputStr))
+ {
+ CopyToSendBuf(inputStr);
+ argexist=ETrue;
+ }
+
+ if ( dataOk )
+ {
+ if (!argexist)
+ {
+ INFO_PRINTF1(KLogInfoCmdCommand2);
+ iAnim->Command(datOpcode);
+ }
+ else
+ {
+ INFO_PRINTF1(KLogInfoCmdCommand1);
+ iAnim->Command(datOpcode, iSendBuf);
+ }
+ }
+ else
+ SetBlockResult(EFail);
+
+ }
+
+void CT_DataAnim::DoCmdAsyncCommandReply(const TDesC& aSection, const TInt aAsyncErrorIndex)
+ {
+ // Get test data for command input parameter(s)
+ TBool dataOk = ETrue;
+
+ // get "TInt aOpcode"
+ TInt datOpcode;
+ if ( !ReadAnimCommand(aSection, KFldOpcode, datOpcode))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogErrMissingPara, &KFldOpcode);
+ }
+
+ // get "const TIpcArgs &aIpcArgs"
+ TBool ipcexist= EFalse;
+ if ( GetIpcArg(aSection))
+ ipcexist = ETrue;
+
+ if (!ipcexist)
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogErrMissingPara, &KFldIpcArgs);
+ }
+
+ if ( !dataOk )
+ {
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iAsyncCmdSection.Copy(aSection);
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogInfoCmdAsyncCommandReply1);
+ iAnim->AsyncCommandReply(iActiveCallback->iStatus, datOpcode, iIpcArgs);
+ iActiveCallback->Activate(aAsyncErrorIndex);
+ IncOutstanding();
+ }
+
+ }
+
+void CT_DataAnim::RunL(CActive* aActive, TInt aIndex)
+ {
+ TInt err = aActive->iStatus.Int();
+
+ if (! CheckIpcArg(iAsyncCmdSection))
+ {
+ ERR_PRINTF1(KLogErrIpcValue);
+ SetBlockResult(EFail);
+ }
+
+ SetAsyncError(aIndex, err);
+ DecOutstanding();
+ }
+
+void CT_DataAnim::DoCmdClose()
+ {
+ // Execute command and log parameters
+ if (iAnim != NULL)
+ {
+ INFO_PRINTF1(KLogInfoCmdClose1);
+ iAnim->Close();
+ }
+ }
+
+void CT_DataAnim::DoCmdDestroy()
+ {
+ // Execute command and log parameters
+ if (iAnim != NULL)
+ {
+ INFO_PRINTF1(KLogInfoCmdDestroy1);
+ iAnim->Destroy();
+ iAnim = NULL;
+ }
+ }
+
+void CT_DataAnim::DoCmdDestructor()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogInfoCmdDestructor1);
+ delete iAnim;
+ iAnim = NULL;
+ }
+
+
+TBool CT_DataAnim::ReadAnimCommand(const TDesC& aSectName, const TDesC& aKeyName, TInt& aCommand)
+ {
+ TPtrC str;
+ TBool ret=GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KEAnimCmdSync )
+ {
+ aCommand=ECmdSync;
+ }
+ else if ( str==KEAnimCmdTestWithoutPara )
+ {
+ aCommand=ECmdTestWithoutPara;
+ }
+ else if ( str==KEAnimCmdTestWithPara )
+ {
+ aCommand=ECmdTestWithPara;
+ }
+ else if ( str==KEAnimCmdGetLast )
+ {
+ aCommand=ECmdGetLast;
+ }
+ else if ( str==KEAnimCmdGetAnimInterval )
+ {
+ aCommand=ECmdGetAnimInterval;
+ }
+ else
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+TBool CT_DataAnim::ReadAnimType(const TDesC& aSectName, const TDesC& aKeyName, TInt& aType)
+ {
+ TPtrC str;
+ TBool ret=GetStringFromConfig(aSectName, aKeyName, str);
+ if ( ret )
+ {
+ if ( str==KEAnimWindows)
+ {
+ aType=EKWindowAnim;
+ }
+ else if ( str==KEAnimSprite )
+ {
+ aType=EKSpriteAnim;
+ }
+ else if ( str==KEAnimFreeTimer )
+ {
+ aType=EKFreeTimerWindowAnim;
+ }
+ else
+ ret=EFalse;
+ }
+
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataAnimDll.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,229 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataAnimDll.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+_LIT(KDataClassname, "RAnimDll");
+
+/// Fields
+_LIT(KFldWs, "ws");
+_LIT(KPlugInFileName, "filename");
+
+/// Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructorGeneral, "~");
+_LIT(KCmdDestructor, "~RAnimDll");
+_LIT(KCmdLoad, "Load");
+_LIT(KCmdDestroy, "Destroy");
+_LIT(KCmdClose, "Close");
+
+/// Logging
+_LIT(KLogErrNum, "Error=%d");
+_LIT(KLogErrMissingPara, "Missing parameter '%S'");
+_LIT(KLogErrLoad, "Load file error %d. File name: %S");
+_LIT(KLogInfoCmdnewL1, "execute new RAnimDll(RWsSession &)");
+_LIT(KLogInfoCmdnewL2, "execute new RAnimDll()");
+_LIT(KLogInfoCmdLoad1, "execute RAnimDll::Load(const TDesC &)");
+_LIT(KLogInfoCmdClose1, "execute RAnimDll::Close()");
+_LIT(KLogInfoCmdDestroy1, "execute RAnimDll::Destroy()");
+_LIT(KLogInfoCmdDestructor1,"execute ~RAnimDll()");
+/*@}*/
+
+CT_DataAnimDll* CT_DataAnimDll::NewL()
+ {
+ CT_DataAnimDll* ret = new (ELeave) CT_DataAnimDll();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataAnimDll::CT_DataAnimDll()
+: iAnimDll(NULL)
+ {
+ }
+
+void CT_DataAnimDll::ConstructL()
+ {
+ }
+
+CT_DataAnimDll::~CT_DataAnimDll()
+ {
+ DestroyData();
+ }
+
+TAny* CT_DataAnimDll::GetObject()
+ {
+ return iAnimDll;
+ }
+
+void CT_DataAnimDll::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iAnimDll = static_cast<RAnimDll*> (aAny);
+ }
+
+void CT_DataAnimDll::DisownObjectL()
+ {
+ iAnimDll = NULL;
+ }
+
+void CT_DataAnimDll::DestroyData()
+ {
+ DoCmdDestructor();
+ }
+
+MWsClientClass* CT_DataAnimDll::GetClientClass() const
+ {
+ return iAnimDll;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataAnimDll::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructorGeneral || aCommand==KCmdDestructor )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( aCommand==KCmdLoad )
+ {
+ DoCmdLoad(aSection);
+ }
+ else if ( aCommand==KCmdDestroy )
+ {
+ DoCmdDestroy();
+ }
+ else if ( aCommand==KCmdClose )
+ {
+ DoCmdClose();
+ }
+ else
+ {
+ ret=CT_DataWsClientClass::DoCommandL(*this, aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+void CT_DataAnimDll::DoCmdnewL(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // Get test data for command input parameter(s)
+ TPtrC wsName;
+ RWsSession* ws = NULL;
+ if ( GetStringFromConfig(aSection, KFldWs, wsName) )
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(wsName));
+ }
+
+ TInt err = KErrNone;
+ if ( ws!= NULL )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogInfoCmdnewL1);
+ TRAP( err, iAnimDll = new (ELeave) RAnimDll(*ws) );
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogInfoCmdnewL2);
+ TRAP(err, iAnimDll = new (ELeave) RAnimDll());
+ }
+
+ // Check the command return code
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogErrNum, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataAnimDll::DoCmdLoad(const TDesC& aSection)
+ {
+ TInt err = KErrNone;
+
+ // Get test data for command input parameter(s)
+ TPtrC fileName;
+ if(!GetStringFromConfig(aSection, KPlugInFileName(), fileName))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KPlugInFileName());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ if (iAnimDll != NULL)
+ {
+ INFO_PRINTF1(KLogInfoCmdLoad1);
+ err = iAnimDll->Load(fileName);
+ }
+
+ // Check the command return code
+ if(err != KErrNone)
+ {
+ ERR_PRINTF3(KLogErrLoad, err, &fileName);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataAnimDll::DoCmdClose()
+ {
+ // Execute command and log parameters
+ if (iAnimDll != NULL)
+ {
+ INFO_PRINTF1(KLogInfoCmdClose1);
+ iAnimDll->Close();
+ }
+ }
+
+void CT_DataAnimDll::DoCmdDestroy()
+ {
+ // Execute command and log parameters
+ if (iAnimDll != NULL)
+ {
+ INFO_PRINTF1(KLogInfoCmdDestroy1);
+ iAnimDll->Destroy();
+ iAnimDll = NULL;
+ }
+ }
+
+void CT_DataAnimDll::DoCmdDestructor()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogInfoCmdDestructor1);
+ delete iAnimDll;
+ iAnimDll = NULL;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataAnimForMClass.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,2331 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataAnimForMClass.h"
+#include "T_GraphicsUtil.h"
+#include "T_AnimDef.h"
+#include "../AnimPlugin/inc/T_AnimDef.h"
+#include <w32adll.h>
+#include <e32keys.h>
+#include "w32std.h"
+#define KMaxBufSize 250
+
+/*@{*/
+_LIT(KDataClassname, "RAnimForMClass");
+
+/// Fields
+
+_LIT(KFldWin, "win");
+_LIT(KFldWingrp, "wingrp");
+_LIT(KFldSprite, "sprite");
+_LIT(KFldType, "type");
+
+
+_LIT(KFldOpcode, "opcode");
+
+
+_LIT(KFldExpected, "expected");
+_LIT(KFldRect, "rect");
+_LIT(KFldState, "state");
+_LIT(KFldWs, "ws");
+_LIT(KFldWingrpId, "windowgroupid");
+_LIT(KFldOrdinalPosition, "pos");
+_LIT(KFldOrdinalPriority, "ordinalpriority");
+_LIT(KFldScreenNumb, "screennumber");
+_LIT(KFldFullOrdinPostn, "fullpos");
+_LIT(KFldExpectedPoint, "expectedpoint");
+_LIT(KFldGetEvent, "getevent");
+_LIT(KFldInterface, "interface");
+_LIT(KFldPostRawEvent, "rawevent");
+
+
+
+
+_LIT(KFldSyncMode, "animsync");
+_LIT(KFldInterval, "interval");
+_LIT(KFldNotifications, "notification");
+_LIT(KFldMessage, "message");
+_LIT(KFldHandleBitmap, "bitmap");
+_LIT(KFldHandleFont, "font");
+_LIT(KFldMemberIndex, "member_index");
+_LIT(KFldIsFullUpdate, "isfullupdate");
+_LIT(KFldIsActivate, "isactivate");
+_LIT(KFldSetReplyBufHandle1, "slot2");
+_LIT(KFldSetReplyBufHandle2, "slot3");
+_LIT(KFldPointPosition, "pos");
+_LIT(KFldRAnim, "anim");
+
+_LIT(KESyncNone , "ESyncNone");
+_LIT(KESyncFlash, "ESyncFlash");
+_LIT(KESyncSecond, "ESyncSecond");
+_LIT(KESyncMinute, "ESyncMinute");
+_LIT(KESyncDay, "ESyncDay");
+
+_LIT(KENone, "ENone");
+_LIT(KEPointerMove, "EPointerMove");
+_LIT(KEPointerSwitchOn, "EPointerSwitchOn");
+_LIT(KEKeyDown, "EKeyDown");
+_LIT(KEKeyUp, "EKeyUp");
+_LIT(KERedraw, "ERedraw");
+_LIT(KESwitchOn, "ESwitchOn");
+_LIT(KEActive, "EActive");
+_LIT(KEInactive, "EInactive");
+_LIT(KEUpdateModifiers, "EUpdateModifiers");
+_LIT(KEButton1Down, "EButton1Down");
+_LIT(KEButton1Up, "EButton1Up");
+_LIT(KEButton2Down, "EButton2Down");
+_LIT(KEButton2Up, "EButton2Up");
+_LIT(KEButton3Down, "EButton3Down");
+_LIT(KEButton3Up, "EButton3Up");
+_LIT(KESwitchOff, "ESwitchOff");
+_LIT(KEKeyRepeat, "EKeyRepeat");
+_LIT(KECaseOpen, "ECaseOpen");
+_LIT(KECaseClose, "ECaseClose");
+_LIT(KERestartSystem, "ERestartSystem");
+
+
+
+/// Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructorGeneral, "~");
+_LIT(KCmdDestructor, "~RAnimForMClass");
+_LIT(KCmdConstruct, "Construct");
+_LIT(KCmdCommandReply, "CommandReply");
+_LIT(KCmdDestroy, "Destroy");
+_LIT(KCmdClose, "Close");
+
+/// Logging
+_LIT(KLogErrMissingPara, "Missing parameter '%S'");
+
+
+_LIT(KLogErrConstruct, "Construct return err = %d");
+_LIT(KLogInfoCmdConstruct1, "execute RAnimForMClass::Construct(const RWindowBase &, TInt, const TDesC8 &)");
+
+_LIT(KLogInfoCmdConstruct3, "execute RAnimForMClass::Construct(const RWsSprite &, TInt, const TDesC8 &)");
+
+_LIT(KLogErrCommandReply, "CommandReply return err = %d");
+_LIT(KLogInfoCmdCommandReply1, "execute RAnimForMClass::CommandReply(TInt),opcode=%d");
+
+_LIT(KLogInfoCmdCommandReply3, "execute RAnimForMClass::CommandReply(TInt, const TDesC8 &, const TIpcArgs &),opcode=%d");
+
+_LIT(KLogInfoCmdDestroy, "execute RAnimForMClass::Destroy()");
+_LIT(KLogInfoCmdDestructor1, "execute ~RAnimForMClass()");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KlogDateTime, "DateTime");
+/*@}*/
+
+CT_DataAnimForMClass* CT_DataAnimForMClass::NewL()
+ {
+ CT_DataAnimForMClass* ret = new (ELeave) CT_DataAnimForMClass();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataAnimForMClass::CT_DataAnimForMClass()
+: iActiveCallback(NULL)
+ ,iAnim(NULL)
+ {
+ }
+
+void CT_DataAnimForMClass::ConstructL()
+ {
+ iSendBuf.CreateL(KMaxBufSize);
+ iSendBuf.FillZ(1);
+
+ for (TInt i=0;i<KIpcArgNum;i++)
+ iIpcBuf[i].CreateL(KMaxBufSize);
+ }
+
+CT_DataAnimForMClass::~CT_DataAnimForMClass()
+ {
+ INFO_PRINTF1(KLogInfoCmdDestructor1);
+ DestroyData();
+ iSendBuf.Close();
+
+ for (TInt i=0;i<KIpcArgNum;i++)
+ iIpcBuf[i].Close();
+ }
+
+TAny* CT_DataAnimForMClass::GetObject()
+ {
+ return iAnim;
+ }
+
+void CT_DataAnimForMClass::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iAnim = static_cast<T_RAnimChild*> (aAny);
+ }
+
+void CT_DataAnimForMClass::DisownObjectL()
+ {
+ iAnim = NULL;
+ }
+
+void CT_DataAnimForMClass::DestroyData()
+ {
+ DoCmdDestroy();
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @return ETrue if the command is processed
+*/
+TBool CT_DataAnimForMClass::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection,const TInt)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructorGeneral || aCommand==KCmdDestructor )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( aCommand==KCmdConstruct )
+ {
+ DoCmdConstructL(aSection);
+ }
+ else if ( aCommand==KCmdCommandReply )
+ {
+ DoCmdCommandReplyL(aSection);
+ }
+ else if ( aCommand==KCmdDestroy )
+ {
+ DoCmdDestroy();
+ }
+ else if ( aCommand==KCmdClose )
+ {
+ DoCmdClose();
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+void CT_DataAnimForMClass::DoCmdnewL(const TDesC& aSection)
+ {
+ DestroyData();
+ TPtrC datRAnimName ;
+ if ( GetStringFromConfig(aSection, KFldRAnim, datRAnimName))
+ {
+ iAnim = static_cast<T_RAnimChild*>(GetDataObjectL(datRAnimName));
+ }
+ else
+ ERR_PRINTF2(KLogErrMissingPara, &KFldWin);
+ }
+
+void CT_DataAnimForMClass::ResetIpcArg()
+ {
+ for (TInt i=0; i<KIpcArgNum; i++)
+ {
+ iIpcArgs.Set(i, TIpcArgs::ENothing);
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdConstructL(const TDesC& aSection)
+ {
+ TInt err = KErrNone;
+
+ // Get test data for command input parameter(s)
+ TBool dataOk = ETrue;
+
+ // Get "const RWindowBase &aDevice" or "const RWsSprite &aDevice"
+ TPtrC datWinName;
+ RWindowBase* win = NULL;
+ TPtrC datSpriteName;
+ RWsSprite* sprite = NULL;
+ if ( GetStringFromConfig(aSection, KFldWin, datWinName))
+ {
+ win = static_cast<RWindowBase*>(GetDataObjectL(datWinName));
+ }
+ else if ( GetStringFromConfig(aSection, KFldSprite, datSpriteName))
+ {
+ sprite = static_cast<RWsSprite*>(GetDataObjectL(datSpriteName));
+ }
+ if (!win && !sprite )
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogErrMissingPara, &KFldWin);
+ ERR_PRINTF2(KLogErrMissingPara, &KFldSprite);
+ }
+
+ //Get "TInt aType"
+ TInt datType;
+ if ( !CT_GraphicsUtil::ReadAnimType(*this,aSection, KFldType, datType))
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogErrMissingPara, &KFldType);
+ }
+
+ // Get "const TDesC8 &aArgs"
+ TPtrC inputStr;
+
+ // get "const TIpcArgs &aIpcArgs"
+
+ if ( !dataOk )
+ {
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ if (win)
+ {
+ INFO_PRINTF1(KLogInfoCmdConstruct1);
+ if (iAnim != NULL)
+ err = iAnim->Construct(*win, datType, iSendBuf);
+ }
+
+ else
+ {
+ INFO_PRINTF1(KLogInfoCmdConstruct3);
+ if (iAnim != NULL)
+ err = iAnim->Construct(*sprite, datType, iSendBuf);
+ }
+
+ // Check the command return code
+ if(err != KErrNone)
+ {
+ ERR_PRINTF2(KLogErrConstruct, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdCommandReplyL(const TDesC& aSection)
+ {
+
+ // Get test data for command input parameter(s)
+ TBool dataOk = ETrue;
+
+ // Get "TInt aOpcode"
+ TInt datOpcode;
+ if ( !CT_GraphicsUtil::ReadAnimCommand(*this, aSection, KFldOpcode,
+ datOpcode))//ReadAnimCommand():Convert datOpcode from string type to Int type
+ {
+ dataOk = EFalse;
+ ERR_PRINTF2(KLogErrMissingPara, &KFldOpcode);
+ }
+
+ if (!dataOk)
+ {
+ _LIT(KFailed, "Can not read the Operation code from the config file. Failed. ");
+ INFO_PRINTF1(KFailed);
+ SetBlockResult(EFail);
+ }
+ switch (datOpcode)
+ {
+ //Util
+ case ECmdRetrieveResult:
+ DoCmdRetrieveResult(aSection, datOpcode);
+ break;
+ case ECmdUtilEatupMemory:
+ DoCmdEatupMemory(datOpcode);
+ break;
+ case ECmdUtilFreeEatenMemory:
+ DoCmdFreeEatenMemory(datOpcode);
+ break;
+ // The MAnimGeneralFunctioins
+ case ECmdGeneralAnimate:
+ DoCmdGeneralAnimate(aSection, datOpcode);
+ break;
+ case ECmdGeneralClient:
+ DoCmdGeneralClient(aSection, datOpcode);
+ break;
+ case ECmdGeneralFlashStateOn:
+ DoCmdGeneralFlashStateOn(aSection, datOpcode);
+ break;
+ case ECmdGeneralPanic:
+ DoCmdGeneralPanic(aSection, datOpcode) ;
+ break;
+ case ECmdGeneralScreenDevice:
+ DoCmdGeneralScreenDevice(aSection, datOpcode) ;
+ break;
+ case ECmdGeneralExtendedInterface:
+ DoCmdGeneralExtendedInterface(aSection, datOpcode) ;
+ break;
+ case ECmdGeneralWindowExtension:
+ DoCmdGeneralWindowExtension(aSection, datOpcode) ;
+ break;
+ case ECmdGeneralNumOfExtInterfaces:
+ DoCmdGeneralNumOfExtInterfaces(aSection, datOpcode) ;
+ break;
+ case ECmdGeneralEventExtension:
+ DoCmdGeneralEventExtension(aSection, datOpcode) ;
+ break;
+ case ECmdGeneralGetRawEvents:
+ DoCmdGeneralGetRawEvents(aSection, datOpcode);
+ break;
+ case ECmdGeneralPostRawEvent:
+ DoCmdGeneralPostRawEvent(aSection, datOpcode);
+ break;
+ case ECmdGeneralPostKeyEvent:
+ DoCmdGeneralPostKeyEventL(aSection, datOpcode);
+ break;
+ case ECmdGeneralSetSync:
+ DoCmdGeneralSetSync(aSection, datOpcode);
+ break;
+ case ECmdGeneralSync:
+ DoCmdGeneralSync(aSection, datOpcode);
+ break;
+ case ECmdGeneralSetInterval:
+ DoCmdGeneralSetInterval(aSection, datOpcode);
+ break;
+ case ECmdGeneralSetNextInterval:
+ DoCmdGeneralSetNextInterval(aSection, datOpcode);
+ break;
+ case ECmdGeneralSystemTime:
+ DoCmdGeneralSystemTime(aSection, datOpcode);
+ break;
+ case ECmdGeneralRegisterForNotis:
+ DoCmdGeneralRegisterForNotis(aSection, datOpcode);
+ break;
+ case ECmdGeneralMessage:
+ DoCmdGeneralMessage(aSection, datOpcode);
+ break;
+ case ECmdGeneralDuplicateBitmapL:
+ DoCmdGeneralDuplicateBitmapL(aSection, datOpcode);
+ break;
+ case ECmdGeneralDuplicateFontL:
+ DoCmdGeneralDuplicateFontL(aSection, datOpcode);
+ break;
+ case ECmdGeneralCloseFont:
+ DoCmdGeneralCloseFontL(aSection, datOpcode);
+ break;
+ case ECmdGeneralReplyBuf8:
+ DoCmdGeneralReplyBuf8(aSection, datOpcode);
+ break;
+ case ECmdGeneralReplyBuf16:
+ DoCmdGeneralReplyBuf16(aSection, datOpcode);
+ break;
+ // the MAnimSpriteFunctioins
+ case ECmdSpriteGetSpriteMember:
+ DoCmdSpriteGetSpriteMember(aSection, datOpcode);
+ break;
+ case ECmdSpriteUpdateMember:
+ DoCmdSpriteUpdateMember(aSection, datOpcode) ;
+ break;
+ case ECmdSpriteActivate:
+ DoCmdSpriteActivate(aSection, datOpcode) ;
+ break;
+ case ECmdSpriteSpriteCanBeSeen:
+ DoCmdSpriteSpriteCanBeSeen(aSection, datOpcode) ;
+ break;
+ case ECmdSpriteSizeChangedL:
+ DoCmdSpriteSizeChangedL(aSection, datOpcode) ;
+ break;
+ case ECmdSpriteSetPosition:
+ DoCmdSpriteSetPosition(aSection, datOpcode) ;
+ break;
+ //MAnimWindowFunctions
+ case ECmdWindowActivateGc:
+ {
+ DoWindowActivateGc(datOpcode);
+ break;
+ }
+ case ECmdWindowSetRect:
+ case ECmdWindowIsStarted:
+ {
+ DoWindowSetRect(datOpcode, aSection);
+ break;
+ }
+ case ECmdWindowWindowSize:
+ {
+ DoWindowWindowSizeL(datOpcode, aSection);
+ break;
+ }
+ case ECmdWindowIsHidden:
+ {
+ DoWindowIsHidden(datOpcode, aSection);
+ break;
+ }
+ case ECmdWindowSetVisible:
+ {
+ DoWindowSetVisible(datOpcode, aSection);
+ break;
+ }
+ case ECmdWindowInvalidate:
+ {
+ DoWindowInvalidate(datOpcode, aSection);
+ break;
+ }
+ case ECmdWindowParameters:
+ {
+ DoWindowParametersL(datOpcode, aSection);
+ break;
+ }
+ case ECmdWindowVisibleRegion:
+ {
+ DoWindowVisibleRegion(datOpcode, aSection);
+ break;
+
+ }
+ //MAnimGeneralFunctionsWindowExtension
+ case ECmdGfweScreens:
+ {
+ DoGeneralExtScreensL(datOpcode, aSection);
+ break;
+ }
+ case ECmdGfweFocusScreens:
+ {
+ DoGeneralExtFocusScreensL(datOpcode, aSection);
+ break;
+ }
+ case ECmdGfweSetFocusScreen:
+ {
+ DoGeneralExtSetFocusScreen(datOpcode, aSection);
+ break;
+ }
+ case ECmdGfweWindowGroups:
+ {
+ DoGeneralExtWindowGroupsL(datOpcode, aSection);
+ break;
+ }
+ case ECmdGfweWindowGroupInfo:
+ {
+ DoGeneralExtWindowGroupInfoL(datOpcode, aSection);
+ break;
+ }
+ case ECmdGfweWindowGroupName:
+ {
+ DoGeneralExtWindowGroupNameL(datOpcode, aSection);
+ break;
+ }
+ case ECmdGfweSetOrdinalPosition:
+ {
+ DoGeneralExtSetOrdinalPositionL(datOpcode, aSection);
+ break;
+ }
+ //MAnimFreeTimerWindowFunctions
+ case ECmdFreeTimerWinDeactivateGc:
+ {
+ DoFreeTimerWinDeactivateGc(datOpcode);
+ break;
+ }
+ case ECmdFreeTimerWinUpdate:
+ {
+ DoFreeTimerWinUpdate(datOpcode);
+ break;
+ }
+ default:
+ {
+ _LIT(KFailed2, "Unsupported operation code. ");
+ INFO_PRINTF1(KFailed2);
+ break;
+ }
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdClose()
+ {
+ iAnim = NULL ;
+ }
+
+void CT_DataAnimForMClass::DoCmdDestroy()
+ {
+ INFO_PRINTF1(KLogInfoCmdDestroy);
+ iAnim = NULL ;
+ }
+
+void CT_DataAnimForMClass::DoCmdDestructor()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogInfoCmdDestructor1);
+ iAnim = NULL;
+ }
+
+//*************************MAnimWindowFunctions verifying********************************
+void CT_DataAnimForMClass::DoWindowActivateGc(TInt aOpcode)
+ {
+ INFO_PRINTF2(KLogInfoCmdCommandReply1, aOpcode);
+ TInt err=iAnim->CommandReply(aOpcode);
+ INFO_PRINTF2(KLogErrCommandReply, err);
+
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogErrCommandReply, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataAnimForMClass::DoWindowSetRect(TInt aOpcode, const TDesC& aSection)
+ {
+ switch (aOpcode)
+ {
+ case ECmdWindowSetRect:
+ {
+ TPtrC8 ptr;
+ TRect sendRect;
+ if (!GetRectFromConfig(aSection, KFldRect, sendRect))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldRect());
+ SetBlockResult(EFail);
+ }
+ TPckgBuf<TRect> sendVal(sendRect);
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &sendVal);
+
+ INFO_PRINTF2(KLogInfoCmdCommandReply3, aOpcode);
+ TInt err=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ INFO_PRINTF2(KLogErrCommandReply, err);
+
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogErrCommandReply, err);
+ SetError(err);
+ }
+ ResetIpcArg();
+ break;
+ }
+ case ECmdWindowIsStarted:
+ {
+ INFO_PRINTF2(KLogInfoCmdCommandReply1, aOpcode);
+ TInt err=iAnim->CommandReply(aOpcode);
+ INFO_PRINTF2(KLogErrCommandReply, err);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogErrCommandReply, err);
+ SetError(err);
+ }
+ break;
+ }
+ }
+ }
+
+void CT_DataAnimForMClass::DoWindowWindowSizeL(TInt aOpcode,const TDesC& aSection)
+ {
+ TPtrC8 ptr;
+ TPtrC datWinName;
+ RWindowBase* win= NULL;
+ if (GetStringFromConfig(aSection, KFldWin, datWinName))
+ {
+ win = static_cast<RWindowBase*>(GetDataObjectL(datWinName));
+ }
+ TSize expected=win->Size();
+ TSize resultBuf;
+ TPckgBuf<TSize> retrndPck(expected);
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &retrndPck);
+ INFO_PRINTF2(KLogInfoCmdCommandReply3, aOpcode);
+ TInt err=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ INFO_PRINTF2(KLogErrCommandReply, err);
+
+ resultBuf=retrndPck();
+ if (expected!=resultBuf)
+ {
+ ERR_PRINTF5(_L("The returned value is not as expected, expected: (%d,%d), actual: (%d,%d)"), expected.iWidth,expected.iHeight, resultBuf.iWidth,resultBuf.iHeight);
+ SetBlockResult(EFail);
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoWindowIsHidden(TInt aOpcode,const TDesC& aSection)
+ {
+ TBool expectedVal;
+
+ if (!GetBoolFromConfig(aSection, KFldExpected, expectedVal))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF2(KLogInfoCmdCommandReply1, aOpcode);
+ TInt actual=iAnim->CommandReply(aOpcode);
+ INFO_PRINTF2(KLogErrCommandReply, actual);
+ if (actual!=expectedVal)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedVal, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataAnimForMClass::DoWindowSetVisible(TInt aOpcode,const TDesC& aSection)
+ {
+ TBool setVisible;
+ TPtrC8 ptr;
+
+ if (!GetBoolFromConfig(aSection, KFldState, setVisible))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldState());
+ SetBlockResult(EFail);
+ }
+
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ TPckgBuf<TBool> setVisiblePck(setVisible);
+ iIpcArgs.Set(1, &setVisiblePck);
+ INFO_PRINTF2(KLogInfoCmdCommandReply3, aOpcode);
+ TInt err=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ INFO_PRINTF2(KLogErrCommandReply, err);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogErrCommandReply, err);
+ SetError(err);
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoWindowInvalidate(TInt aOpcode,const TDesC& aSection)
+ {
+ TPtrC datWinName;
+ TPtrC8 ptr;
+ TRect rectVal;
+ if (!GetRectFromConfig(aSection, KFldRect, rectVal))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldRect());
+ SetBlockResult(EFail);
+ }
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ TPckgBuf<TRect> rectValPck(rectVal);
+ iIpcArgs.Set(1, &rectValPck);
+ INFO_PRINTF2(KLogInfoCmdCommandReply3, aOpcode);
+ TInt err=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ INFO_PRINTF2(KLogErrCommandReply, err);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogErrCommandReply, err);
+ SetError(err);
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoWindowParametersL(TInt aOpcode,const TDesC& aSection)
+ {
+ RWindowBase* win= NULL;
+ TSize expectedSize;
+ TInt expectedDisplyMd;
+ TPtrC val;
+ TPtrC8 ptr;
+ TPtrC datWinName;
+ TPckgBuf<TRect> retrndWindowPostn;
+ TPckgBuf<TInt> retrndDisplyMd;
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &retrndWindowPostn);
+ iIpcArgs.Set(2, &retrndDisplyMd);
+
+ //Send command to server
+ TInt err=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ INFO_PRINTF2(KLogErrCommandReply, err);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogErrCommandReply, err);
+ SetError(err);
+ }
+ else
+ {
+ //Get the window's Size and Displaymode
+ if (GetStringFromConfig(aSection, KFldWin, datWinName))
+ {
+ win = static_cast<RWindowBase*>(GetDataObjectL(datWinName));
+ }
+ expectedSize=win->Size();
+ expectedDisplyMd=win->DisplayMode();
+
+ TRect retrndWinInf=retrndWindowPostn();
+ TSize retrndSize=retrndWinInf.Size();
+ TInt retrndDisplyM=retrndDisplyMd();
+
+ if (retrndSize!=expectedSize)
+ {
+ ERR_PRINTF5(_L("The value is not as expected! expected: (%d,%d), actual: (%d,%d)"), expectedSize.iWidth,expectedSize.iHeight, retrndSize.iWidth,retrndSize.iHeight);
+ SetBlockResult(EFail);
+ }
+ if (retrndDisplyM!=expectedDisplyMd)
+ {
+ ERR_PRINTF3(_L("The value is not as expected! expected: %d, actual: %d"), expectedDisplyMd, retrndDisplyM);
+ SetBlockResult(EFail);
+ }
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoWindowVisibleRegion(TInt aOpcode,const TDesC& aSection)
+ {
+ TInt expecteValue;
+ TInt actual;
+
+ if (!GetIntFromConfig(aSection, KFldExpected, expecteValue))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ actual=iAnim->CommandReply(aOpcode);
+ INFO_PRINTF2(KLogErrCommandReply, actual);
+ if (actual!=expecteValue)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expecteValue, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+//****************MAnimGeneralFunctionsWindowExtension verifying*******************************
+
+void CT_DataAnimForMClass::DoGeneralExtScreensL(TInt aOpcode,const TDesC& aSection)
+ {
+ RWsSession* ws;
+ TPtrC datWsName;
+ if (GetStringFromConfig(aSection, KFldWs, datWsName))
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(datWsName));
+ }
+ TInt actualScreenNumb=iAnim->CommandReply(aOpcode);
+ INFO_PRINTF2(KLogErrCommandReply, actualScreenNumb);
+ }
+
+void CT_DataAnimForMClass::DoGeneralExtFocusScreensL(TInt aOpcode,const TDesC& aSection)
+ {
+ RWsSession* ws;
+ TPtrC datWsName;
+ TInt expectedVal;
+
+ TInt actual=iAnim->CommandReply(aOpcode);
+ INFO_PRINTF2(_L("FocuseScreens is %d"),actual);
+
+ //If there is no expected value set in ini file, get the focus screen;
+ if (!GetIntFromConfig(aSection, KFldExpected, expectedVal))
+ {
+ if (GetStringFromConfig(aSection, KFldWs, datWsName))
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(datWsName));
+ }
+
+ expectedVal=ws->GetFocusScreen();
+ }
+
+ if (actual!=expectedVal)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedVal, actual);
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataAnimForMClass::DoGeneralExtSetFocusScreen(TInt aOpcode,const TDesC& aSection)
+ {
+ TInt screenNo;
+ TPtrC8 ptr;
+ TPtrC datWsName;
+
+ if (!GetIntFromConfig(aSection, KFldScreenNumb, screenNo))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldScreenNumb());
+ SetBlockResult(EFail);
+ }
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ TPckgBuf<TInt> screenNoPck(screenNo);
+ iIpcArgs.Set(1, &screenNoPck);
+ TInt actual=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ INFO_PRINTF2(KLogErrCommandReply, actual);
+
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoGeneralExtWindowGroupsL(TInt aOpcode,const TDesC& aSection)
+ {
+ TPtrC8 ptr;
+ TInt screenNo;
+ TPtrC datWsName;
+ RWsSession* ws;
+ if (!GetIntFromConfig(aSection, KFldScreenNumb, screenNo))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldScreenNumb());
+ SetBlockResult(EFail);
+ }
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ TPckgBuf<TInt> screenNoPck(screenNo);
+ iIpcArgs.Set(1, &screenNoPck);
+ TInt actual=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ INFO_PRINTF2(KLogErrCommandReply, actual);
+
+ if (!GetStringFromConfig(aSection, KFldWs, datWsName))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldWs());
+ SetBlockResult(EFail);
+ }
+ ws = static_cast<RWsSession*>(GetDataObjectL(datWsName));
+ TInt expectedVal=ws->NumWindowGroups();
+
+ if (actual!=expectedVal)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedVal, actual);
+ SetBlockResult(EFail);
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoGeneralExtWindowGroupInfoL(TInt aOpcode,const TDesC& aSection)
+ {
+ TInt screenNo;
+ TPtrC8 ptr;
+ TPtrC datWingrpName;
+ TInt retrnPck;
+ TInt expectedGrpInfo;
+ RWindowGroup* wingrp;
+ //Get window group object in order to verify the window group's name's existance.
+ if (!GetStringFromConfig(aSection, KFldWingrp, datWingrpName))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldWingrp());
+ SetBlockResult(EFail);
+ }
+ wingrp = static_cast<RWindowGroup*>(GetDataObjectL(datWingrpName));
+
+ //Get screen number from ini file and set to IPC slot 1.
+ if (!GetIntFromConfig(aSection, KFldScreenNumb, screenNo))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldScreenNumb());
+ SetBlockResult(EFail);
+ }
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ TPckgBuf<TInt> screenNoPck(screenNo);
+ iIpcArgs.Set(1, &screenNoPck);
+
+ //Get fullOrdipostion from ini or by using FullOrdinalPosition method and set to IPC slot 2.
+ TInt fullOrdiPostion;
+ if (!GetIntFromConfig(aSection, KFldFullOrdinPostn, fullOrdiPostion))
+ {
+ fullOrdiPostion=wingrp->FullOrdinalPosition();
+ }
+ TPckgBuf<TInt> fullOrdiPostionPck(fullOrdiPostion);
+ iIpcArgs.Set(2, &fullOrdiPostionPck);
+
+ //Set IPC slot 3 to receive ID of the TWindowGroupInfo.
+ TPckgBuf<TInt> retrnWinGrpInfo;
+ iIpcArgs.Set(3, &retrnWinGrpInfo);
+
+ TInt actual=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ INFO_PRINTF2(KLogErrCommandReply, actual);
+ TBool expectedVal;
+ if (!GetBoolFromConfig(aSection, KFldExpected, expectedVal))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ if (actual!=expectedVal)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedVal, actual);
+ SetBlockResult(EFail);
+ }
+ if (actual!=EFalse)
+ {
+ retrnPck=retrnWinGrpInfo();//Get returned window group ID
+
+ expectedGrpInfo=wingrp->WindowGroupId();
+ if (retrnPck!=expectedGrpInfo)
+ {
+ ERR_PRINTF3(
+ _L("The returned value is not as expected, expected: %d, actual: %d"),
+ expectedGrpInfo, retrnPck);
+ SetBlockResult(EFail);
+ }
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoGeneralExtWindowGroupNameL(TInt aOpcode,const TDesC& aSection)
+ {
+ TBuf<32> getWindowName;
+ TBool expectedVal;
+ TInt screenNo;
+ TInt fullOrdiPostion;
+ //Get Screen number from ini and set to IPC slot 1.
+ if (!GetIntFromConfig(aSection, KFldScreenNumb, screenNo))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldScreenNumb);
+ SetBlockResult(EFail);
+ }
+ TPtrC8 ptr;
+ TPckgBuf<TInt> screenNoPck(screenNo);
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &screenNoPck);
+
+ TPtrC datWingrpName;
+ RWindowGroup* wingrp;
+ //Get window group object
+ if (!GetStringFromConfig(aSection, KFldWingrp, datWingrpName))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldWingrp());
+ SetBlockResult(EFail);
+ }
+ wingrp = static_cast<RWindowGroup*>(GetDataObjectL(datWingrpName));
+ //Get fullOrdinary position and set to IPC slot 2.
+ if (!GetIntFromConfig(aSection, KFldFullOrdinPostn, fullOrdiPostion))
+ {
+ fullOrdiPostion=wingrp->FullOrdinalPosition();
+ }
+
+ TPckgBuf<TInt> fullOrdiPostionPck(fullOrdiPostion);
+ iIpcArgs.Set(2, &fullOrdiPostionPck);
+ //Set IPC slot 3 to receive the window name returned from server side.
+ TBuf<32> retrnWindowName;
+ iIpcArgs.Set(3, &retrnWindowName);
+
+ TInt actual=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ INFO_PRINTF2(KLogErrCommandReply, actual);
+ if (!GetBoolFromConfig(aSection, KFldExpected, expectedVal))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ if (actual!=expectedVal)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedVal, actual);
+ SetBlockResult(EFail);
+ }
+ //If commandreply returns ETrue then check the window group's name.
+ if (actual)
+ {
+ TInt result=wingrp->Name(getWindowName);
+ if (result!=KErrNone)
+ {
+ ERR_PRINTF1(_L("Failed to get the window group's name!"));
+ SetError(result);
+ }
+ INFO_PRINTF3(_L("Check the group name is expected. expected: %d,actual: %d"),&getWindowName,&retrnWindowName);
+ if (getWindowName!=retrnWindowName)
+ {
+ ERR_PRINTF1(_L("The returned window group name is not expected"));
+ SetBlockResult(EFail);
+ }
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoGeneralExtSetOrdinalPositionL(TInt aOpcode,const TDesC& aSection)
+ {
+ TInt expectedVal;
+ TPtrC8 ptr;
+ TInt wingrpid;
+ TInt newOrdinPrio;
+ TInt newOrdinaPostn;
+ TPtrC datWingrpName;
+ RWindowGroup* wingrp;
+ if (GetStringFromConfig(aSection, KFldWingrp, datWingrpName))
+ {
+ wingrp = static_cast<RWindowGroup*>(GetDataObjectL(datWingrpName));
+ }
+ //Before sending command, get window group ID from wrapper or ini as arg(IPC slot 1)
+ if (!GetIntFromConfig(aSection, KFldWingrpId, wingrpid))
+ {
+ wingrpid=wingrp->WindowGroupId();
+ INFO_PRINTF2(_L("RWindowTreeNode::WindowGroupId = %d"), wingrpid);
+ }
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ TPckgBuf<TInt> wingrpidPck(wingrpid);
+ iIpcArgs.Set(1, &wingrpidPck);
+
+ //Get Group Id from wrapper or ini and send to server as IPC slot2
+ if (!GetIntFromConfig(aSection, KFldOrdinalPosition, newOrdinaPostn))
+ {
+ newOrdinaPostn = wingrp->OrdinalPosition();
+ INFO_PRINTF2(_L("RWindowTreeNode::FullOrdinalPosition = %d"), newOrdinaPostn);
+ }
+ TPckgBuf<TInt> newOrdinaPostnPck(newOrdinaPostn);
+ iIpcArgs.Set(2, &newOrdinaPostnPck);
+
+ //Get new ordinal priority of the window as arg(IPC slot 3) from ini file;
+ if (!GetIntFromConfig(aSection, KFldOrdinalPriority, newOrdinPrio))
+ {
+ newOrdinPrio = wingrp->OrdinalPriority();
+ INFO_PRINTF2(_L("RWindowTreeNode::FullOrdinalPriority = %d"), newOrdinPrio);
+ }
+ TPckgBuf<TInt> newOrdinPrioPck(newOrdinPrio);
+ iIpcArgs.Set(3, &newOrdinPrioPck);
+
+ TInt err=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ if (!GetIntFromConfig(aSection, KFldExpected, expectedVal))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+
+ if (err!=expectedVal)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedVal, err);
+ SetBlockResult(EFail);
+ }
+ //Get the new OrdinalPostion and Priority using window group methods;
+ if (err!=KErrNotFound)
+ {
+ TInt retrnOrdinPostn=wingrp->OrdinalPosition();
+ TInt retrnOrdinPrio=wingrp->OrdinalPriority();
+
+ if (retrnOrdinPostn!=newOrdinaPostn)
+ {
+ ERR_PRINTF3(
+ _L("The returned ordinalposition is not as expected, expected: %d, actual: %d"),
+ newOrdinaPostn, retrnOrdinPostn);
+ SetBlockResult(EFail);
+ }
+
+ if (retrnOrdinPrio!=newOrdinPrio)
+ {
+ ERR_PRINTF3(
+ _L("The returned ordinalpriority is not as expected, expected: %d, actual: %d"),
+ newOrdinPrio, retrnOrdinPrio);
+ SetBlockResult(EFail);
+ }
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoGeneralExtIsFocusableL(TInt aOpcode, const TDesC& aSection)
+ {
+ TInt screenNub;
+ TBool expectedVal;
+ TInt sendFullOrdinPstn;
+ if (!GetIntFromConfig(aSection, KFldScreenNumb, screenNub))
+ {
+ ERR_PRINTF2(KLogErrMissingPara, &KFldScreenNumb);
+ }
+ TPtrC8 ptr;
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ TPckgBuf<TInt> screenNubPck(screenNub);
+ iIpcArgs.Set(1, &screenNubPck);
+
+ TPtrC datWingrpName;
+ RWindowGroup* wingrp;
+ if (GetStringFromConfig(aSection, KFldWingrp, datWingrpName))
+ {
+ wingrp = static_cast<RWindowGroup*>(GetDataObjectL(datWingrpName));
+ }
+
+ //Get animation window's FullOrdinalPosition as arg(IPC slot 2)
+
+ sendFullOrdinPstn = wingrp->FullOrdinalPosition();
+ INFO_PRINTF2(_L("RWindowTreeNode::FullOrdinalPosition = %d"), sendFullOrdinPstn);
+ TPckgBuf<TInt> sendFullOrdinPstnPck(sendFullOrdinPstn);
+ iIpcArgs.Set(2, &sendFullOrdinPstnPck);
+
+ //Check the CommandReply return value
+ TInt err=iAnim->CommandReply(aOpcode, ptr, iIpcArgs);
+ if (!GetBoolFromConfig(aSection, KFldExpected, expectedVal))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+
+ if (err!=expectedVal)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedVal, err);
+ SetBlockResult(EFail);
+ }
+ ResetIpcArg();
+ }
+
+//*******************MAnimFreeTimerWindowFunction verifying*******************************
+void CT_DataAnimForMClass::DoFreeTimerWinDeactivateGc(TInt aOpcode)
+ {
+ INFO_PRINTF2(_L("Excute %d"), aOpcode);
+ TPtrC8 ptr;
+ TInt err=iAnim->CommandReply(aOpcode, ptr);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(KLogErrCommandReply, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataAnimForMClass::DoFreeTimerWinUpdate(TInt aOpcode)
+ {
+ INFO_PRINTF1(KLogInfoCmdCommandReply1);
+
+ TInt err=iAnim->CommandReply(aOpcode);
+
+ if(err!=KErrNone)
+ {
+ ERR_PRINTF2(_L("CommandReply failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+//------------------------------------------------------------------------------------
+void CT_DataAnimForMClass::DoCmdRetrieveResult(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TInt result = iAnim->CommandReply(datOpcode);
+ TBool expectdVal;
+ //Get expected value from ini file.
+ if(!GetBoolFromConfig(aSectName,KFldExpected,expectdVal))
+ {
+ if ( result != KErrNone)
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ else // success
+ {
+ INFO_PRINTF1(_L("Retrieve Result event return ETrue"));
+ }
+ }
+ if(result!=expectdVal)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectdVal, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Retrieve Result equals to the expected value"));
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdGeneralAnimate(const TDesC& aSectName, const TInt& datOpcode )
+ {
+ //Get the datetime from the ini file
+ TDateTime dateTime ;
+ if(!GetDateTimeFromConfig(aSectName, dateTime))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KlogDateTime);
+ SetBlockResult(EFail);
+ }
+ TPckgBuf<TDateTime> sendPckg(dateTime);
+ iIpcArgs.Set(0,TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &sendPckg);
+
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ // Send the command to notify the server
+ TInt ret = iAnim->CommandReply(datOpcode, iSendBuf, iIpcArgs);
+
+ // Check the command return code
+ if(ret == KErrNone)
+ {
+ ERR_PRINTF2( KLogErrCommandReply, ret);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("General Animate invoked succesffully and return successfully "));
+ }
+ ResetIpcArg();
+ }
+
+
+void CT_DataAnimForMClass::DoCmdGeneralClient(const TDesC& /*aSectName*/, const TInt& datOpcode )
+ {
+ // Send the command to notify the server
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ TInt ret = iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ // Check the return thread id equals to the client thread or not.
+ TInt clientThreadId = RThread().Id().Id();
+
+ if ( ret == clientThreadId )
+ {
+ INFO_PRINTF1(_L("General client invoked succesffully"));
+ }
+ else
+ {
+ ERR_PRINTF2( KLogErrCommandReply, ret);
+ SetBlockResult (EFail);
+ }
+ }
+
+
+void CT_DataAnimForMClass::DoCmdGeneralFlashStateOn(const TDesC& aSectName, const TInt& datOpcode )
+ {
+ // Send the command to notify the server.
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ TBool expected(EFalse);
+ TInt ret = -1 ;
+
+ if ( !GetBoolFromConfig(aSectName,KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldExpected);
+ SetBlockResult(EFail);
+ }
+
+ ret = iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+ //If ret return -1, the result value can not be trusted(Please refer to the code in AnimPlugin::WinAnim).
+ //So it need another calling untill the ret return a ETrue or EFalse.
+ while(ret == -1)
+ {
+ User::After(100000);
+ ret = iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+ }
+
+
+ // Check if the return is ETrue (1) or EFalse(0)
+ if ( ret == static_cast<TInt>(expected) )
+ {
+ INFO_PRINTF1(_L("GeneralFlashStateOn invoked succesffully. Return code equals to expected vaule "));
+ }
+ else
+ {
+ ERR_PRINTF2( KLogErrCommandReply, ret);
+ SetBlockResult (EFail);
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdGeneralPanic(const TDesC& /*aSectName*/ , const TInt& datOpcode)
+ {
+ //Send the command to notify the server.
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ TInt err = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ //The client will be paniced by the server
+ INFO_PRINTF1(_L("GeneralPanic invoked successfully"));
+ }
+
+void CT_DataAnimForMClass::DoCmdGeneralScreenDevice(const TDesC& /*aSectName*/ , const TInt& datOpcode )
+ {
+ //Send the command to notify the server .
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ TInt ret = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ //Check if the return code is 0(Success) or not.
+ if ( ret == KErrNone )
+ {
+ INFO_PRINTF1(_L("GeneralScreenDevice invoked succesffully."));
+ }
+ else
+ {
+ ERR_PRINTF2( KLogErrCommandReply, ret);
+ SetBlockResult (EFail);
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdGeneralWindowExtension(const TDesC& /*aSectName*/, const TInt& datOpcode)
+ {
+ // Send the command to notify the server .
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ TInt ret = iAnim->CommandReply(datOpcode, iSendBuf, iIpcArgs);
+
+ // Check if the return code is 0(Success) or not.
+ if (ret == KErrNone)
+ {
+ INFO_PRINTF1(_L("GeneralWindowExtension invoked succesffully."));
+ }
+ else
+ {
+ ERR_PRINTF2( KLogErrCommandReply, ret);
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdGeneralEventExtension( const TDesC& /*aSectName*/,const TInt& datOpcode)
+ {
+ // Send the command to notify the server .
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ TInt ret = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ // Check if the return code is 0(Success) or not.
+ if ( ret == KErrNone )
+ {
+ INFO_PRINTF1(_L("GeneralEventExtension invoked succesffully."));
+ }
+ else
+ {
+ ERR_PRINTF2( KLogErrCommandReply, ret);
+ SetBlockResult (EFail);
+ }
+ }
+
+ void CT_DataAnimForMClass::DoCmdGeneralExtendedInterface(const TDesC& aSectName , const TInt& datOpcode )
+ {
+ TInt interface ;
+ //Get interface from ini file and set it as IpcArgs 1.
+ if ( !GetIntFromConfig(aSectName,KFldInterface, interface) )
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldInterface);
+ SetBlockResult (EFail);
+ }
+ TPckgBuf<TInt> sendPckg(interface);
+ iIpcArgs.Set(0,TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &sendPckg);
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ //Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ // Check the command return code
+ if ( interface == 0 )
+ {
+ TInt expected ;
+
+ if ( !GetIntFromConfig(aSectName,KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldInterface);
+ SetBlockResult (EFail);
+ }
+ if ( result != expected ) /*so far, the expected value is 2.*/
+ {
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("extended interface return is okay when the input paramter is 0"));
+ }
+ }
+ else if( interface == 1 )
+ {
+ if ( result == 0) // server return 0 stands for okay.
+ {
+ INFO_PRINTF1(_L("extended interface return is okay when the input paramter is 1"));
+ }
+ else
+ {
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ }
+ else if( interface == 2 )
+ {
+ if ( result == 0) // server return 0 stands for okay.
+ {
+ INFO_PRINTF1(_L("extended interface return is okay when the input paramter is 2"));
+ }
+ else
+ {
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ }
+ else
+ {
+ if ( result == 0) // server return 0 stands for okay.
+ {
+ INFO_PRINTF1(_L("extended interface return is a NULL pointer when the input paramter is OUT of 0~2"));
+ }
+ else
+ {
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoCmdGeneralNumOfExtInterfaces(const TDesC& aSectName,const TInt& datOpcode)
+ {
+ // Send the command to notify the server.
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ TInt result = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs);
+
+ INFO_PRINTF2(KLogErrCommandReply, result);
+
+ // Check the return code
+ TInt expected;
+ if ( !GetIntFromConfig(aSectName,KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldInterface);
+ SetBlockResult (EFail);
+ }
+ if (result != expected) // so far ,the expected value is 2.
+ {
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("NumberofExtendedInterfaces return is okay when the input paramter is 0"));
+ }
+ }
+
+
+ void CT_DataAnimForMClass::DoCmdGeneralGetRawEvents(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TBool bGetEvent;
+ //Get the rawevent parameter from ini file and set it as the IpcArgs 1 .
+ if ( !GetBoolFromConfig(aSectName,KFldGetEvent ,bGetEvent))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldGetEvent);
+ SetBlockResult(EFail);
+ }
+ iIpcArgs.Set(0,TIpcArgs::ENothing);
+ TPckgBuf<TBool> sendPckg(bGetEvent);
+ iIpcArgs.Set(1, &sendPckg);
+
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ // Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ //Check the result is 0(Success) or not.
+ if (result != KErrNone )
+ {
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("GetRawEvents return is okay "));
+ }
+ }
+
+ void CT_DataAnimForMClass::DoCmdGeneralPostRawEvent(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TRawEvent rawEvent;
+ TPtrC str;
+ //Get the post rawevent parameter from ini file and set it as the IpcArgs 1 .
+ if (!GetStringFromConfig(aSectName,KFldPostRawEvent,str))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldPostRawEvent);
+ SetBlockResult(EFail);
+ }
+ TRawEvent::TType type;
+ if ( str == KENone )
+ type = TRawEvent::ENone;
+ else if ( str == KEPointerMove )
+ type = TRawEvent::EPointerMove;
+ else if ( str == KEPointerSwitchOn)
+ type = TRawEvent::EPointerSwitchOn;
+ else if ( str == KEKeyDown )
+ type = TRawEvent::EKeyDown;
+ else if ( str == KEKeyUp )
+ type = TRawEvent::EKeyUp;
+ else if ( str == KERedraw)
+ type = TRawEvent::ERedraw;
+ else if ( str == KESwitchOn )
+ type = TRawEvent::ESwitchOn;
+ else if ( str == KEActive)
+ type = TRawEvent::EActive;
+ else if ( str == KEInactive)
+ type = TRawEvent::EInactive;
+ else if ( str == KEUpdateModifiers)
+ type = TRawEvent::EUpdateModifiers;
+ else if ( str == KEButton1Down)
+ type = TRawEvent::EButton1Down;
+ else if ( str == KEButton1Up)
+ type = TRawEvent::EButton1Up;
+ else if ( str == KEButton2Down)
+ type = TRawEvent::EButton2Down;
+ else if ( str == KEButton2Up)
+ type = TRawEvent::EButton2Up;
+ else if ( str == KEButton3Down)
+ type = TRawEvent::EButton3Down;
+ else if ( str == KEButton3Up)
+ type = TRawEvent::EButton3Up;
+ else if ( str == KESwitchOff)
+ type = TRawEvent::ESwitchOff;
+ else if ( str == KEKeyRepeat)
+ type = TRawEvent::EKeyRepeat;
+ else if ( str == KECaseOpen)
+ type = TRawEvent::ECaseOpen;
+ else if ( str == KECaseClose)
+ type = TRawEvent::ECaseClose;
+ else if ( str == KERestartSystem)
+ type = TRawEvent::ERestartSystem;
+
+ rawEvent.Set(type);
+ TPckgBuf<TRawEvent> sendPckg(rawEvent);
+
+ iIpcArgs.Set(0,TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &sendPckg);
+
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ //Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ //Check the result is 0(Success) or not.
+ if (result != KErrNone )
+ {
+ ERR_PRINTF2(KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("PostRawEvent return is okay "));
+ }
+ }
+
+
+ void CT_DataAnimForMClass::DoCmdGeneralPostKeyEventL(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ /*
+ * 1.Use WinAnim plugin dll to post a key event.
+ * 2.Use an RWindowGroup object to capture the key event.
+ * */
+
+ TKeyEvent keyEvent;
+ TKeyCode aKeyCode;
+ _LIT( KCode , "Code");
+ //Get the keycode from the ini file.
+ if (!CT_GraphicsUtil::ReadKeyCode(*this, aSectName, KCode , aKeyCode))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KCode);
+ SetBlockResult(EFail);
+ }
+ // The keyEvent will be set as the IpcArg 1 .
+ TInt captureKey = aKeyCode;
+ keyEvent.iCode = aKeyCode;
+ keyEvent.iScanCode =aKeyCode;
+ keyEvent.iModifiers = 0;
+ keyEvent.iRepeats = 0;
+
+ _LIT(KWindowGroup, "windowgroup");
+ _LIT(KWsSession, "session");
+ RWindowGroup* group = NULL;
+ RWsSession* session = NULL;
+ TPtrC datName;
+ if ( GetStringFromConfig(aSectName, KWindowGroup , datName) )
+ {
+ group = static_cast<RWindowGroup*>(GetDataObjectL(datName));
+ }
+
+ if ( GetStringFromConfig(aSectName, KWsSession , datName) )
+ {
+ session = static_cast<RWsSession*>(GetDataObjectL(datName));
+ }
+ group->CaptureKey(captureKey, 0, 0);
+ TPckgBuf<TKeyEvent> sendPckg(keyEvent);
+ iIpcArgs.Set(0,TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &sendPckg);
+ TInt err = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ //Check the result is 0(Success) or not.
+ if (err != KErrNone )
+ {
+ ERR_PRINTF2(KLogErrCommandReply, err);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("PostKeyEvent return is okay "));
+ }
+ TRequestStatus myStatus;
+ session->EventReady(&myStatus);
+ TBool bStop = ETrue;
+ TWsEvent we;
+ while(bStop)
+ {
+ User::WaitForRequest(myStatus);
+ session->GetEvent(we);
+ if(we.Type() == EEventKey)
+ {
+ bStop = EFalse;
+ TInt rst = we.Key()->iCode;
+ if(rst != captureKey)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), captureKey, rst);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ _LIT(KSuccess, "PostKeyEvent successfully");
+ INFO_PRINTF1(KSuccess);
+ }
+ }
+ else
+ {
+ session->EventReady(&myStatus);
+ }
+ }//end while
+ }
+
+ void CT_DataAnimForMClass::DoCmdGeneralSetSync(const TDesC& aSectName , const TInt& datOpcode )
+ {
+ MAnimGeneralFunctions::TAnimSync syncmode ;
+ TPtrC str;
+ // Get the syncmode to be set from ini file and set it as IpcArg 1.
+ if ( !GetStringFromConfig(aSectName,KFldSyncMode ,str))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldSyncMode);
+ SetBlockResult (EFail);
+ }
+ if (str == KESyncNone )
+ syncmode = MAnimGeneralFunctions::ESyncNone ;
+ else if ( str == KESyncFlash)
+ syncmode = MAnimGeneralFunctions::ESyncFlash ;
+ else if ( str == KESyncSecond)
+ syncmode = MAnimGeneralFunctions::ESyncSecond ;
+ else if ( str == KESyncMinute)
+ syncmode = MAnimGeneralFunctions::ESyncMinute ;
+ else if ( str == KESyncDay)
+ syncmode = MAnimGeneralFunctions::ESyncDay ;
+ iIpcArgs.Set(0,TIpcArgs::ENothing);
+ TPckgBuf<MAnimGeneralFunctions::TAnimSync> sendPckg(syncmode);
+ iIpcArgs.Set(1, &sendPckg);
+
+ INFO_PRINTF1(KLogInfoCmdCommandReply3) ;
+ //Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ //Check the result is 0(Success) or not.
+ if (result != KErrNone )
+ {
+ ERR_PRINTF2(KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("SetSync return is okay "));
+ }
+ }
+
+ void CT_DataAnimForMClass::DoCmdGeneralSync(const TDesC& aSectName , const TInt& datOpcode )
+ {
+ TInt expectedsyncmode ;
+ TPtrC str;
+ // Get the expected syncmode from ini file.
+ if ( !GetStringFromConfig(aSectName,KFldExpected ,str))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ if (str == KESyncNone )
+ expectedsyncmode = MAnimGeneralFunctions::ESyncNone ;
+ else if ( str == KESyncFlash)
+ expectedsyncmode = MAnimGeneralFunctions::ESyncFlash ;
+ else if ( str == KESyncSecond)
+ expectedsyncmode = MAnimGeneralFunctions::ESyncSecond ;
+ else if ( str == KESyncMinute)
+ expectedsyncmode = MAnimGeneralFunctions::ESyncMinute ;
+ else if ( str == KESyncDay)
+ expectedsyncmode = MAnimGeneralFunctions::ESyncDay ;
+
+ iIpcArgs.Set( 0, TIpcArgs::ENothing);
+ INFO_PRINTF1(KLogInfoCmdCommandReply3) ;
+ //Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ //Check the command return code .
+ if ( result != expectedsyncmode )
+ {
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("GeneralSync invoked successfully"));
+ }
+ }
+
+ void CT_DataAnimForMClass::DoCmdGeneralSetInterval(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ // Get the interval from ini file and set it as IpcArg 1.
+ TInt interval ;
+ if ( !GetIntFromConfig(aSectName,KFldInterval ,interval))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldInterval);
+ SetBlockResult(EFail);
+ }
+ iIpcArgs.Set(0,TIpcArgs::ENothing);
+ TPckgBuf<TInt> sendPckg(interval) ;
+ iIpcArgs.Set(1, &sendPckg );
+ INFO_PRINTF1(KLogInfoCmdCommandReply3) ;
+ //Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ //Check the result is 0(Success) or not.
+ if ( result != KErrNone )
+ {
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("GeneralSetInterval invoked successfully"));
+ }
+ }
+
+ void CT_DataAnimForMClass::DoCmdGeneralSetNextInterval(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ //Read the interval from ini file
+ TInt interval;
+ if ( !GetIntFromConfig(aSectName,KFldInterval ,interval))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldInterval);
+ return;
+ }
+ TPckgBuf<TInt> sendPckg1(interval);
+
+ TInt nextinterval ;
+ _LIT( KNextInterval , "nextinterval");
+ //Read the next interval from ini file
+ if ( !GetIntFromConfig(aSectName,KNextInterval ,nextinterval))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KNextInterval);
+ SetBlockResult(EFail);
+ }
+ TPckgBuf<TInt> sendPckg2(nextinterval) ;
+ iIpcArgs.Set(0,TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &sendPckg1);
+ iIpcArgs.Set(2, &sendPckg2);
+ INFO_PRINTF1(KLogInfoCmdCommandReply3) ;
+ //Send the command to notify the server.
+ TInt result = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+
+ //Check the result is 0(Success) or not.
+ if ( result != KErrNone )
+ {
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("GeneralSetNextInterval invoked successfully"));
+ }
+ }
+
+
+ void CT_DataAnimForMClass::DoCmdGeneralSystemTime(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ MAnimGeneralFunctions::TAnimSync syncmode;
+ TPtrC str;
+ _LIT(KExpected , "expected");
+ _LIT( KSyncMode , "animsync");
+ // Get the syncmode from ini file and set it as IpcArg 1.
+ if ( !GetStringFromConfig(aSectName,KSyncMode ,str))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KSyncMode);
+ SetBlockResult(EFail);
+ }
+ if (str == KESyncNone )
+ syncmode = MAnimGeneralFunctions::ESyncNone;
+ else if ( str == KESyncFlash)
+ syncmode = MAnimGeneralFunctions::ESyncFlash;
+ else if ( str == KESyncSecond)
+ syncmode = MAnimGeneralFunctions::ESyncSecond;
+ else if ( str == KESyncMinute)
+ syncmode = MAnimGeneralFunctions::ESyncMinute;
+ else if ( str == KESyncDay)
+ syncmode = MAnimGeneralFunctions::ESyncDay;
+ iIpcArgs.Set(0,TIpcArgs::ENothing);
+ TPckgBuf<MAnimGeneralFunctions::TAnimSync> sendPckg(syncmode);
+ iIpcArgs.Set(1, &sendPckg);
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ TInt result = iAnim->CommandReply(datOpcode, iSendBuf , iIpcArgs );
+ TBool expected;
+ if ( !GetBoolFromConfig(aSectName,KExpected ,expected))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KExpected);
+ return;
+ }
+ if(result != static_cast<TInt>(expected))
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expected, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("GeneralSystemTime invoked is okay."));
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdGeneralRegisterForNotis(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TInt notifications;
+ TEventCode expectedCode;
+ // Get the notifications value from ini file and set it as IpcArg 1.
+ if ( !GetIntFromConfig(aSectName,KFldNotifications ,notifications))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldNotifications);
+ SetBlockResult(EFail);
+ }
+
+ if(!CT_GraphicsUtil::ReadEventCode(*this, aSectName, KFldExpected, expectedCode))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldExpected);
+ return;
+ }
+
+ TPckgBuf<TInt> sendPckg(notifications);
+ TPckgBuf<TEventCode> sendPckg2(expectedCode);
+ iIpcArgs.Set(0, TIpcArgs::ENothing );
+ iIpcArgs.Set(1, &sendPckg );
+ iIpcArgs.Set(2, &sendPckg2);
+
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ //Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ //Check the result is 0(Success) or not.
+ if ( result != KErrNone )
+ {
+ ERR_PRINTF2( KLogErrCommandReply, result);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("RegisterForNotis invoked successfully"));
+ }
+ }
+
+
+void CT_DataAnimForMClass::DoCmdGeneralMessage(const TDesC& aSectName ,const TInt& datOpcode)
+ {
+ TPtrC str , expectedStr;
+ TBuf<100> returnStr;
+ // Get the sending message value from ini file and set it as IpcArg 1.
+ if ( !GetStringFromConfig(aSectName,KFldMessage ,str))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldMessage);
+ SetBlockResult(EFail);
+ }
+ // Get the expected message value from ini file .
+ if ( !GetStringFromConfig(aSectName,KFldExpected ,expectedStr))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ iIpcArgs.Set(0, TIpcArgs::ENothing );
+ iIpcArgs.Set(1, &str);
+ iIpcArgs.Set(2, &returnStr);
+
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ //Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ if(expectedStr.Compare(returnStr))
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %S, actual: %S"), &expectedStr, &returnStr);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("GeneralMessage invoked successfully"));
+ }
+ ResetIpcArg();
+ }
+
+
+void CT_DataAnimForMClass::DoCmdGeneralDuplicateBitmapL(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TPtrC str ;
+ TInt bmHandle;
+ CFbsBitmap* bmp;
+ // Get the object name of CFbsBitmap from ini file.
+ if ( !GetStringFromConfig(aSectName,KFldHandleBitmap,str))
+ {
+ //giving a non-existed value to take the nagative case.
+ bmHandle = 9999;
+ }
+ else
+ {
+ bmp = static_cast<CFbsBitmap*>(GetDataObjectL(str));
+ bmHandle = bmp->Handle();
+ }
+
+ iIpcArgs.Set(0, TIpcArgs::ENothing );
+ TPckgBuf<TInt> sendPckg(bmHandle);
+ iIpcArgs.Set(1, &sendPckg );
+ //Send the command to notify the server
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ //Print info
+ _LIT(KSuccess,"GeneralDuplicateBitmapL invoked successfully");
+ INFO_PRINTF1(KSuccess);
+ ResetIpcArg();
+ }
+
+
+void CT_DataAnimForMClass::DoCmdGeneralDuplicateFontL(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TPtrC str;
+ TInt fntHandle;
+ CFbsFont* fnt;
+ TInt typeId;
+ // Get the object name of CFbsFont from ini file.
+ if ( !GetStringFromConfig(aSectName,KFldHandleFont,str))
+ {
+ //giving a non-existed value to take the nagative case.
+ fntHandle = 9999;
+ }
+ else
+ {
+ fnt = static_cast<CFbsFont*>(GetDataObjectL(str));
+ typeId = fnt->TypeUid().iUid; //this is the expected value.
+ fntHandle = fnt->Handle();
+ }
+ TInt result = 0;
+ TPckgBuf<TInt> sendPckg(fntHandle);
+ TPckgBuf<TInt> getPckg(result);
+
+ iIpcArgs.Set(0, TIpcArgs::ENothing );
+ iIpcArgs.Set(1, &sendPckg);
+ iIpcArgs.Set(2, &getPckg);
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ //Send the command to notify the server .
+ iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+ result = getPckg();
+
+ //Check the result
+ if(result == typeId)
+ {
+ INFO_PRINTF1(_L("GeneralDuplicateFontL invoked successfully"));
+ }
+ else
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), typeId, result);
+ SetError(KErrNoMemory);
+ }
+ ResetIpcArg();
+ }
+
+
+void CT_DataAnimForMClass::DoCmdGeneralCloseFontL(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TPtrC str ;
+ // Get the object name of CFbsFont from ini file.
+ if ( !GetStringFromConfig(aSectName,KFldHandleFont,str))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldHandleFont);
+ SetBlockResult(EFail);
+ }
+ CFbsFont* fnt = static_cast<CFbsFont*>(GetDataObjectL(str));
+ TInt typeId = fnt->TypeUid().iUid; //this is the expected value .
+ TInt fntHandle = fnt->Handle();
+ TInt result = 0;
+ TPckgBuf<TInt> sendPckg(fntHandle);
+ TPckgBuf<TInt> getPckg(result);
+
+ iIpcArgs.Set(0, TIpcArgs::ENothing );
+ iIpcArgs.Set(1, &sendPckg );
+ iIpcArgs.Set(2, &getPckg);
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+ result = getPckg();
+ if(result == typeId)
+ {
+ _LIT(KSuccess,"GeneralDuplicateFontL invoked successfully");
+ INFO_PRINTF1(KSuccess);
+ }
+ else
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), typeId, result);
+ SetBlockResult (EFail);
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoCmdGeneralReplyBuf8(const TDesC& aSectName, const TInt& datOpcode)
+ {
+ TPtrC str2;
+
+ if ( !GetStringFromConfig(aSectName,KFldSetReplyBufHandle1,str2))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldSetReplyBufHandle1);
+ SetBlockResult(EFail);
+ }
+ TBuf8<100> slot2;
+ slot2.Append(str2);
+
+ TPtrC str3;
+
+ if ( !GetStringFromConfig(aSectName,KFldSetReplyBufHandle2,str3))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldSetReplyBufHandle2);
+ return ;
+ }
+ TBuf8<100> slot3;
+ slot3.Append(str3);
+
+ TBuf8<100> result;
+
+ iIpcArgs.Set(0, TIpcArgs::ENothing );
+ iIpcArgs.Set(1, &result);
+ iIpcArgs.Set(2, &slot2);
+ iIpcArgs.Set(3, &slot3);
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ if(!result.Compare(slot3) && result.Compare(slot2))
+ {
+ _LIT(KSuccess,"GeneralDuplicateFontL invoked successfully");
+ INFO_PRINTF1(KSuccess);
+ }
+ else
+ {
+ ERR_PRINTF2(_L("The returned value is not as expected, result: %S"), &result);
+ SetBlockResult (EFail);
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoCmdGeneralReplyBuf16(const TDesC& aSectName, const TInt& datOpcode)
+ {
+ TPtrC str2;
+
+ if ( !GetStringFromConfig(aSectName,KFldSetReplyBufHandle1,str2))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldSetReplyBufHandle1);
+ SetBlockResult(EFail);
+ }
+ TBuf16<100> slot2(str2);
+
+ TPtrC str3;
+
+ if ( !GetStringFromConfig(aSectName,KFldSetReplyBufHandle2,str3))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldSetReplyBufHandle2);
+ return ;
+ }
+ TBuf16<100> slot3(str3);
+
+ TBuf16<100> result;
+
+ iIpcArgs.Set(0, TIpcArgs::ENothing );
+ iIpcArgs.Set(1, &result);
+ iIpcArgs.Set(2, &slot2);
+ iIpcArgs.Set(3, &slot3);
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ if(!result.Compare(slot3) && result.Compare(slot2))
+ {
+ _LIT(KSuccess,"GeneralDuplicateFontL invoked successfully");
+ INFO_PRINTF1(KSuccess);
+ }
+ else
+ {
+ ERR_PRINTF2(_L("The returned value is not as expected, result: %S"), &result);
+ SetBlockResult (EFail);
+ }
+ ResetIpcArg();
+ }
+//-------------------------------------------------The MAnimSpriteFunctions ----------------------------------------
+void CT_DataAnimForMClass::DoCmdSpriteGetSpriteMember(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TInt memberindex ;
+ // Get the sprite member index from ini file and set it as IpcArg 1 .
+ if ( !GetIntFromConfig(aSectName,KFldMemberIndex ,memberindex))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldMemberIndex);
+ SetBlockResult(EFail);
+ }
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ TPckgBuf<TInt> pckg(memberindex);
+ TPckgBuf<TPoint> returnPckg;
+ iIpcArgs.Set(1,&pckg);
+ iIpcArgs.Set(2,&returnPckg);
+
+ // Send the command to notify the server .
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ TPoint result=returnPckg();
+ // Verify the result and the expected .
+ TPtrC spritename;
+ TPoint expectedPoint;
+ // Get the expected point value from ini file.
+ if ( !GetPointFromConfig(aSectName, KFldExpectedPoint, expectedPoint))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpectedPoint);
+ return;
+ }
+
+ if ( result != expectedPoint)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected.x: %d, expect.y: %d"), expectedPoint.iX , expectedPoint.iY);
+ ERR_PRINTF3(_L("The returned value is not as expected, result.x: %d, result.y: %d"), result.iX , result.iY);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Get Sprite Member successfully"));
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoCmdSpriteUpdateMember(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TInt memberindex ;
+ TRect rect ;
+ TBool isfullupdate ;
+ //Get the sprite member index from ini file and set it as IpcArg 1.
+ if ( ! GetIntFromConfig(aSectName,KFldMemberIndex ,memberindex))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldMemberIndex);
+ SetBlockResult(EFail);
+ }
+ //Get the rect value from ini file and set it as IpcArg 2.
+ if ( ! GetRectFromConfig(aSectName,KFldRect ,rect))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldRect);
+ SetBlockResult(EFail);
+ }
+ //Get the isfullupdate flag from ini file and set it as IpcArg 3.
+ if ( ! GetBoolFromConfig(aSectName,KFldIsFullUpdate ,isfullupdate))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldIsFullUpdate);
+ SetBlockResult(EFail);
+ }
+
+ TPckgBuf<TInt> memberPckg(memberindex);
+ TPckgBuf<TRect> rectPckg(rect);
+ TPckgBuf<TBool> updatePckg(isfullupdate);
+
+
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &memberPckg);
+ iIpcArgs.Set(2, &rectPckg);
+ iIpcArgs.Set(3, &updatePckg);
+
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ //Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ //Check the result is 0(Success) or not.
+ if (result != KErrNone )
+ {
+ ERR_PRINTF2(KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("UpdateSpriteMember return is okay "));
+ }
+ }
+
+
+void CT_DataAnimForMClass::DoCmdSpriteActivate(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TBool isactive;
+ // Get the isactive flag from ini file and set as IpcArg 1.
+ if ( !GetBoolFromConfig(aSectName,KFldIsActivate ,isactive))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldIsActivate);
+ SetBlockResult(EFail);
+ }
+ TPckgBuf<TBool> sendPkg(isactive) ;
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ iIpcArgs.Set(1,&sendPkg);
+
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ //Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ //Check the result is 0(Success) or not.
+ if (result != KErrNone )
+ {
+ ERR_PRINTF2(KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("SpriteActive return is okay "));
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdSpriteSpriteCanBeSeen(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ TBool expected;
+ // Get the expected boolean value from the ini file.
+ if ( !GetBoolFromConfig(aSectName, KFldExpected, expected))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ TPckgBuf<TBool> resultPkg(EFalse) ;
+
+
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ iIpcArgs.Set(1,&resultPkg);
+
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ //Send the command to notify the server .
+ iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ //Verify the result and the expected
+ TBool result = resultPkg() ;
+
+ if ( result != expected )
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expected, (TInt)result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("SpriteCanBeSeen return is okay "));
+ }
+ ResetIpcArg();
+ }
+
+void CT_DataAnimForMClass::DoCmdSpriteSizeChangedL(const TDesC& /*aSectName*/ , const TInt& datOpcode)
+ {
+ //Send the command to notify the server .
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ TInt result = iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ //Check the result is 0(Success) or not.
+ if (result != KErrNone )
+ {
+ ERR_PRINTF2(KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("SpriteSizeChangedL return is okay"));
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdSpriteSetPosition(const TDesC& aSectName , const TInt& datOpcode)
+ {
+ // Get the point value from ini file and set as IpcArg 1.
+ TPoint point ;
+ if ( !GetPointFromConfig(aSectName, KFldPointPosition, point))
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldPointPosition);
+ SetBlockResult(EFail);
+ }
+ TPckgBuf<TPoint> pkg(point) ;
+ iIpcArgs.Set(0, TIpcArgs::ENothing);
+ iIpcArgs.Set(1, &pkg) ;
+ INFO_PRINTF1(KLogInfoCmdCommandReply3);
+ //Send the command to notify the server .
+ TInt result = iAnim->CommandReply(datOpcode,iSendBuf,iIpcArgs);
+
+ //Check the result is 0(Success) or not.
+ if (result != KErrNone )
+ {
+ ERR_PRINTF2(KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("SpriteSetPosition return is okay"));
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdEatupMemory(const TInt& datOpcode)
+ {
+ TInt result = iAnim->CommandReply(datOpcode);
+ if (result != KErrNone )
+ {
+ ERR_PRINTF2(KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("EatupMemory return is okay"));
+ }
+ }
+
+void CT_DataAnimForMClass::DoCmdFreeEatenMemory(const TInt& datOpcode)
+ {
+ TInt result = iAnim->CommandReply(datOpcode);
+ if (result != KErrNone )
+ {
+ ERR_PRINTF2(KLogErrCommandReply, result);
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("FreeEatenMemory return is okay"));
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataBackedUpWindow.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,288 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataBackedUpWindow.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+_LIT(KDataClassname, "RBackedUpWindow");
+
+//Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdConstruct, "Construct");
+_LIT(KCmdBitmapHandle, "BitmapHandle");
+_LIT(KCmdUpdateScreen, "UpdateScreen");
+_LIT(KCmdUpdateBackupBitmap, "UpdateBackupBitmap");
+_LIT(KCmdMaintainBackup, "MaintainBackup");
+
+// Fields
+_LIT(KFldDisplayMode, "displaymode");
+_LIT(KFldHandle, "handle");
+_LIT(KFldParent, "parent");
+_LIT(KFldRegion, "region");
+_LIT(KFldWs, "ws");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataBackedUpWindow* CT_DataBackedUpWindow::NewL()
+ {
+ CT_DataBackedUpWindow* ret=new (ELeave) CT_DataBackedUpWindow();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataBackedUpWindow::CT_DataBackedUpWindow()
+: CT_DataDrawableWindow()
+, iBackedUpWindow(NULL)
+ {
+ }
+
+void CT_DataBackedUpWindow::ConstructL()
+ {
+ }
+
+CT_DataBackedUpWindow::~CT_DataBackedUpWindow()
+ {
+ DestroyData();
+ }
+
+void CT_DataBackedUpWindow::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iBackedUpWindow = static_cast<RBackedUpWindow*> (aAny);
+ }
+
+void CT_DataBackedUpWindow::DestroyData()
+ {
+ delete iBackedUpWindow;
+ iBackedUpWindow=NULL;
+ }
+
+void CT_DataBackedUpWindow::DisownObjectL()
+ {
+ iBackedUpWindow = NULL;
+ }
+
+RDrawableWindow* CT_DataBackedUpWindow::GetDrawableWindow() const
+ {
+ return iBackedUpWindow;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataBackedUpWindow::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructor )
+ {
+ DestroyData();
+ }
+ else if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( aCommand==KCmdConstruct )
+ {
+ DoCmdConstructL(aSection);
+ }
+ else if ( aCommand==KCmdBitmapHandle )
+ {
+ DoCmdBitmapHandle();
+ }
+ else if ( aCommand==KCmdUpdateScreen )
+ {
+ DoCmdUpdateScreenL(aSection);
+ }
+ else if ( aCommand==KCmdUpdateBackupBitmap )
+ {
+ DoCmdUpdateBackupBitmap();
+ }
+ else if ( aCommand==KCmdMaintainBackup )
+ {
+ DoCmdMaintainBackup();
+ }
+ else
+ {
+ ret=CT_DataDrawableWindow::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+
+void CT_DataBackedUpWindow::DoCmdnewL(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // Get test data for command input parameter(s)
+ TPtrC wsName;
+ RWsSession* ws=NULL;
+ if ( GetStringFromConfig(aSection, KFldWs, wsName) )
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(wsName));
+ }
+
+ TInt err=KErrNone;
+ if ( ws!=NULL )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new RBackedUpWindow(RWsSession)"));
+ TRAP( err, iBackedUpWindow = new (ELeave) RBackedUpWindow(*ws));
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new RBackedUpWindow()"));
+ TRAP( err, iBackedUpWindow = new (ELeave) RBackedUpWindow());
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataBackedUpWindow::DoCmdConstructL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPtrC parentName;
+ RWindowTreeNode* parent=NULL;
+ if ( GetStringFromConfig(aSection, KFldParent, parentName) )
+ {
+ parent = static_cast<RWindowTreeNode*>(GetDataObjectL(parentName));
+ }
+ if ( parent==NULL )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldParent);
+ SetBlockResult(EFail);
+ }
+
+ TDisplayMode datDisplayMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldDisplayMode, datDisplayMode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDisplayMode);
+ SetBlockResult(EFail);
+ }
+
+ TInt datHandle;
+ if ( !GetIntFromConfig(aSection, KFldHandle, datHandle) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldHandle);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Construct(RWindowTreeNode, TDisplayMode, TUint32)"));
+ TInt returnCode = iBackedUpWindow->Construct(*parent, datDisplayMode, datHandle);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataBackedUpWindow::DoCmdBitmapHandle()
+ {
+ // Execute command and log parameters
+ TInt handle=iBackedUpWindow->BitmapHandle();
+ INFO_PRINTF2(_L("BitmapHandle() %d"), handle);
+ SetHandle(handle);
+ }
+
+
+void CT_DataBackedUpWindow::DoCmdUpdateScreenL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ RRegion region(1);
+ CleanupClosePushL(region);
+
+ if ( GetRegionFromConfig(aSection, KFldRegion, region) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute UpdateScreen(TRegion)"));
+ iBackedUpWindow->UpdateScreen(region);
+
+ // No command return value and output parameter to display and check
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute UpdateScreen()"));
+ iBackedUpWindow->UpdateScreen();
+
+ // No command return value and output parameter to display and check
+ }
+
+ CleanupStack::PopAndDestroy(®ion);
+ }
+
+
+void CT_DataBackedUpWindow::DoCmdUpdateBackupBitmap()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute UpdateBackupBitmap()"));
+ iBackedUpWindow->UpdateBackupBitmap();
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataBackedUpWindow::DoCmdMaintainBackup()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute MaintainBackup()"));
+ iBackedUpWindow->MaintainBackup();
+
+ // No command return value and output parameter to display and check
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataBlankWindow.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,284 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataBlankWindow.h"
+
+/*@{*/
+_LIT(KDataClassname, "RBlankWindow");
+
+//Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdConstruct, "Construct");
+_LIT(KCmdSetColor, "SetColor");
+_LIT(KCmdSetSize, "SetSize");
+_LIT(KCmdSetExtent, "SetExtent");
+
+// Fields
+_LIT(KFldColor, "color");
+_LIT(KFldHandle, "handle");
+_LIT(KFldParent, "parent");
+_LIT(KFldPoint, "point");
+_LIT(KFldSize, "size");
+_LIT(KFldWs, "ws");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataBlankWindow* CT_DataBlankWindow::NewL()
+ {
+ CT_DataBlankWindow* ret=new (ELeave) CT_DataBlankWindow();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataBlankWindow::CT_DataBlankWindow()
+: CT_DataWindowBase()
+, iBlankWindow(NULL)
+ {
+ }
+
+void CT_DataBlankWindow::ConstructL()
+ {
+ }
+
+CT_DataBlankWindow::~CT_DataBlankWindow()
+ {
+ DestroyData();
+ }
+
+void CT_DataBlankWindow::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iBlankWindow = static_cast<RBlankWindow*> (aAny);
+ }
+
+void CT_DataBlankWindow::DisownObjectL()
+ {
+ iBlankWindow = NULL;
+ }
+
+void CT_DataBlankWindow::DestroyData()
+ {
+ delete iBlankWindow;
+ iBlankWindow=NULL;
+ }
+
+RWindowBase* CT_DataBlankWindow::GetWindowBase() const
+ {
+ return iBlankWindow;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataBlankWindow::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructor )
+ {
+ DestroyData();
+ }
+ else if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( aCommand==KCmdConstruct )
+ {
+ DoCmdConstructL(aSection);
+ }
+ else if ( aCommand==KCmdSetColor )
+ {
+ DoCmdSetColor(aSection);
+ }
+ else if ( aCommand==KCmdSetSize )
+ {
+ DoCmdSetSize(aSection);
+ }
+ else if ( aCommand==KCmdSetExtent )
+ {
+ DoCmdSetExtent(aSection);
+ }
+ else
+ {
+ ret=CT_DataWindowBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+
+void CT_DataBlankWindow::DoCmdnewL(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // Get test data for command input parameter(s)
+ TPtrC wsName;
+ RWsSession* ws=NULL;
+ if ( GetStringFromConfig(aSection, KFldWs, wsName) )
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(wsName));
+ }
+
+ TInt err;
+ if ( ws != NULL )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new RBlankWindow(RWsSession)"));
+ TRAP( err, iBlankWindow = new (ELeave) RBlankWindow(*ws) );
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new RBlankWindow()"));
+ TRAP( err, iBlankWindow = new (ELeave) RBlankWindow() );
+ }
+
+ if ( err != KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+
+ // No command output parameter to display and check
+ }
+
+
+void CT_DataBlankWindow::DoCmdConstructL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPtrC parentName;
+ RWindowTreeNode* parent=NULL;
+ if ( GetStringFromConfig(aSection, KFldParent, parentName) )
+ {
+ parent = static_cast<RWindowTreeNode*>(GetDataObjectL(parentName));
+ }
+ if ( parent==NULL )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldParent);
+ SetBlockResult(EFail);
+ }
+
+ TInt datHandle;
+ if ( !GetIntFromConfig(aSection, KFldHandle, datHandle) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldHandle);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Construct(RWindowTreeNode, TUint32)"));
+ TInt returnCode = iBlankWindow->Construct(*parent, datHandle);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode != KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataBlankWindow::DoCmdSetColor(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRgb datColor;
+ if ( GetRgbFromConfig(aSection, KFldColor, datColor) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetColor(TRgb)"));
+ iBlankWindow->SetColor(datColor);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetColor()"));
+ iBlankWindow->SetColor();
+ }
+ }
+
+
+void CT_DataBlankWindow::DoCmdSetSize(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TSize datSize;
+ if ( !GetSizeFromConfig(aSection, KFldSize, datSize) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSize);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetSize(TSize)"));
+ iBlankWindow->SetSize(datSize);
+ }
+ }
+
+
+void CT_DataBlankWindow::DoCmdSetExtent(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPoint datPoint;
+ if ( !GetPointFromConfig(aSection, KFldPoint, datPoint) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint);
+ SetBlockResult(EFail);
+ }
+
+ TSize datSize;
+ if ( !GetSizeFromConfig(aSection, KFldSize, datSize) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSize);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetExtent(TPoint, TSize)"));
+ iBlankWindow->SetExtent(datPoint, datSize);
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataDirectScreenAccess.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,439 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <apgtask.h>
+#include "T_GraphicsUtil.h"
+#include "T_DataDirectScreenAccess.h"
+#include "T_DataFbsScreenDevice.h"
+#include "T_DataFbsBitGc.h"
+
+_LIT(KDataClassname, "CDirectScreenAccess");
+_LIT(KCmdDestructor, "~CDirectScreenAccess");
+_LIT(KCmdDestructorGeneral, "~");
+
+//command
+_LIT( KCmdNewL, "NewL" );
+_LIT( KCmdStart, "StartL" );
+_LIT( KCmdGc, "Gc" );
+_LIT( KCmdScreenDevice, "ScreenDevice" );
+_LIT( KCmdDrawRegion, "DrawingRegion" );
+_LIT( KCmdSetPriority, "SetPriority" );
+_LIT( KCmdBringAppFg, "Util_BringAppFg" );
+
+// Fields
+_LIT( KRWsSessionObj, "ws");
+_LIT( KCWsScreenDeviceObj, "scrdev");
+_LIT( KRWindowObj, "win");
+_LIT( KAppName, "app");
+_LIT( KPriorityObj, "Priority");
+_LIT( KFldGc, "gc");
+_LIT( KFldScreenDevice, "ScreenDevice");
+_LIT( KFldDrawRegion, "region1");
+_LIT( KWantedReasonObj, "reason");
+
+//Error
+_LIT( KErrNewL, "Create CDirectScreenAccess object failed.");
+_LIT( KErrGc, "Execute CDirectScreenAccess::Gc failed. return value is NULL");
+_LIT( KErrScreenDevice, "Execute CDirectScreenAccess::ScreenDevices failed. return value is NULL");
+_LIT( KErrDrawRegion, "Execute CDirectScreenAccess::DrawRegion failed. return value is NULL");
+_LIT( KErrDrawRegionSetting, "Set DrawRegion failed.");
+_LIT( KErrAbortNowReason, "the AbortNow's reason do not match the expected value.");
+_LIT( KErrRestartReason, "the Restart's reason do not match the expected value.");
+_LIT( KLogMissingParameter, "Missing parameter '%S'");
+_LIT( KLogMissingWrapper,"Missing Wrapper class '%S'");
+
+//info
+_LIT( KInfoNewL, "NewL() has been called.");
+_LIT( KInfoStartL, "StartL() has been called");
+_LIT( KInfoGc, "Gc() has been called" );
+_LIT( KInfoScreenDevice, "ScreenDevice() has been called" );
+_LIT( KInfoDrawRegion, "DrawingRegion() has been called" );
+_LIT( KInfoSetPriority, "SetPriority() has been called" );
+_LIT( KInfoAbortNow, "AbortNow has been called, with the reason=%d");
+_LIT( KInfoRestart, "Restart has been called, with the reason=%d");
+_LIT( KInfoDestructor, "execute ~CDirectScreenAccess()");
+
+const RDirectScreenAccess::TTerminationReasons KDefaultReason = RDirectScreenAccess::ETerminateRegion;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+/**
+ * Protected constructor. First phase construction
+ */
+CT_DataDirectScreenAccess::CT_DataDirectScreenAccess() :
+ iDirectScreenAccess(NULL),
+ iWantedReason(KDefaultReason)
+ {
+ }
+/**
+ * Public destructor
+ */
+CT_DataDirectScreenAccess::~CT_DataDirectScreenAccess()
+ {
+ DestroyData();
+ }
+
+/**
+ * Two phase constructor
+ */
+CT_DataDirectScreenAccess* CT_DataDirectScreenAccess::NewL()
+ {
+ CT_DataDirectScreenAccess* self = new (ELeave) CT_DataDirectScreenAccess();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+/**
+ * Second phase construction
+ */
+void CT_DataDirectScreenAccess::ConstructL()
+ {
+ //nothing to do here.
+ }
+
+/**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+void CT_DataDirectScreenAccess::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iDirectScreenAccess = static_cast<CDirectScreenAccess*> (aAny);
+ }
+
+/**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+void CT_DataDirectScreenAccess::DisownObjectL()
+ {
+ iDirectScreenAccess = NULL;
+ }
+
+void CT_DataDirectScreenAccess::DestroyData()
+ {
+ delete iDirectScreenAccess;
+ iDirectScreenAccess = NULL;
+ }
+
+/**
+ * Process a command read from the ini file
+ *
+ * @param aCommand the command to process
+ * @param aSection the entry in the ini file requiring the command to be processed
+ * @param aAsyncErrorIndex index of command. used for async calls
+ *
+ * @return ETrue if the command is processed
+ */
+TBool CT_DataDirectScreenAccess::DoCommandL(const TTEFFunction& aCommand,
+ const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool result = ETrue;
+
+ if ( !aCommand.Compare( KCmdNewL ) || !aCommand.Compare( KDataClassname ) )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( !aCommand.Compare(KCmdDestructor) || !aCommand.Compare(KCmdDestructorGeneral ) )
+ {
+ DoCmdDestructor();
+ }
+ else if ( !aCommand.Compare( KCmdStart ) )
+ {
+ DoCmdStartL(aSection);
+ }
+ else if ( !aCommand.Compare( KCmdGc ) )
+ {
+ DoCmdGcL(aSection);
+ }
+ else if ( !aCommand.Compare( KCmdScreenDevice ) )
+ {
+ DoCmdScreenDeviceL(aSection);
+ }
+ else if ( !aCommand.Compare( KCmdDrawRegion ) )
+ {
+ DoCmdDrawRegion(aSection);
+ }
+ else if ( !aCommand.Compare( KCmdSetPriority ) )
+ {
+ DoCmdSetPriority(aSection);
+ }
+ else if ( !aCommand.Compare( KCmdBringAppFg ) )
+ {
+ DoCmdBringAppFgL(aSection);
+ }
+ else
+ {
+ CDataWrapperActive::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return result;
+ }
+
+/**
+ * test AbortNow()
+ */
+void CT_DataDirectScreenAccess::AbortNow(RDirectScreenAccess::TTerminationReasons aReason)
+ {
+ INFO_PRINTF2(KInfoAbortNow , aReason);
+ DecOutstanding();
+ if( iWantedReason != aReason )
+ {
+ ERR_PRINTF1(KErrAbortNowReason);
+ SetBlockResult(EFail);
+ }
+
+ }
+
+/**
+ * Test Restart()
+ */
+void CT_DataDirectScreenAccess::Restart(RDirectScreenAccess::TTerminationReasons aReason)
+ {
+ INFO_PRINTF2(KInfoRestart , aReason);
+ DecOutstanding();
+ if( iWantedReason != aReason )
+ {
+ ERR_PRINTF1(KErrRestartReason);
+ SetBlockResult(EFail);
+ }
+
+ }
+
+/**
+ * Helper method to get RWsSession
+ */
+RWsSession* CT_DataDirectScreenAccess::GetRWSessionL(const TDesC& aSection)
+ {
+ RWsSession* iClient( NULL ); //Window Session Client
+ TPtrC objectName;
+
+ if ( GetStringFromConfig(aSection, KRWsSessionObj(), objectName) )
+ {
+ iClient = static_cast<RWsSession*>(GetDataObjectL(objectName));
+ }
+
+ return iClient;
+ }
+
+/**
+ * Helper method to get CWsScreenDevice
+ */
+CWsScreenDevice* CT_DataDirectScreenAccess::GetDevicesL(const TDesC& aSection)
+ {
+ CWsScreenDevice* device = NULL;
+
+ if ( !CT_GraphicsUtil::GetWsScreenDeviceL(*this, aSection, KCWsScreenDeviceObj, device) )
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KCWsScreenDeviceObj);
+ SetBlockResult(EFail);
+ }
+
+ return device;
+ }
+
+
+/**
+ * Helper method to get RWindow
+ */
+RWindow* CT_DataDirectScreenAccess::GetWindowL(const TDesC& aSection)
+ {
+ RWindow* window( NULL );
+ TPtrC objectName;
+
+ if( GetStringFromConfig(aSection, KRWindowObj, objectName))
+ {
+ window = static_cast<RWindow*>(GetDataObjectL(objectName));
+ }
+
+ return window;
+
+ }
+
+
+/**
+* Test NewL()
+*/
+void CT_DataDirectScreenAccess::DoCmdnewL(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ DestroyData();
+ INFO_PRINTF1(KInfoNewL);
+ iDirectScreenAccess = CDirectScreenAccess::NewL(*GetRWSessionL(aSection),
+ *GetDevicesL(aSection), *GetWindowL(aSection), *this );
+
+ if(!iDirectScreenAccess)
+ {
+ ERR_PRINTF1(KErrNewL);
+ SetBlockResult(EFail);
+ }
+
+ }
+
+/**
+* Test Destructor()
+*/
+void CT_DataDirectScreenAccess::DoCmdDestructor()
+ {
+ INFO_PRINTF1(KInfoDestructor);
+ delete iDirectScreenAccess;
+ iDirectScreenAccess = NULL;
+ }
+
+/**
+* Test StartL()
+*/
+void CT_DataDirectScreenAccess::DoCmdStartL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(KInfoStartL);
+ if ( !CT_GraphicsUtil::ReadTerminateReason(*this , aSection , KWantedReasonObj, iWantedReason) )
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KWantedReasonObj);
+ SetBlockResult(EFail);
+ }
+
+ iDirectScreenAccess->StartL();
+ IncOutstanding();
+ }
+
+/**
+* Test Gc()
+*/
+void CT_DataDirectScreenAccess::DoCmdGcL(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KInfoGc);
+
+ TPtrC aGcName;
+ if(GetStringFromConfig(aSection, KFldGc, aGcName) )
+ {
+ CFbsBitGc* iGc = iDirectScreenAccess->Gc();
+ if(!iGc)
+ {
+ INFO_PRINTF1(KErrGc);
+ SetError(KErrNotFound);
+ }
+ else
+ {
+ SetDataObjectL(aGcName , iGc);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldGc);
+ }
+
+ }
+
+/**
+* Test ScreenDevice()
+*/
+void CT_DataDirectScreenAccess::DoCmdScreenDeviceL(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KInfoScreenDevice);
+ TPtrC aScreenDeviceName;
+ if(GetStringFromConfig(aSection, KFldScreenDevice, aScreenDeviceName))
+ {
+ CFbsScreenDevice* aScreenDevice = iDirectScreenAccess->ScreenDevice();
+ if(!aScreenDevice)
+ {
+ ERR_PRINTF1(KErrScreenDevice);
+ SetError(KErrNotFound);
+ }
+ else
+ {
+ SetDataObjectL(aScreenDeviceName , aScreenDevice);
+ }
+
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KFldScreenDevice);
+ }
+
+ }
+
+/**
+* Test DrawRegion()
+*/
+void CT_DataDirectScreenAccess::DoCmdDrawRegion(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KInfoDrawRegion);
+ TRegion* region;
+ region = iDirectScreenAccess->DrawingRegion();
+
+ if(!region)
+ {
+ ERR_PRINTF1(KErrDrawRegion);
+ SetError(KErrNotFound);
+ }
+ // Compare the region.
+ // read the exepected region size
+ TRect temp;
+ if( GetRectFromConfig(aSection ,KFldDrawRegion, temp ))
+ {
+ //compare the region
+ TRect temp2 = (*region)[0];
+
+ if(temp != temp2)
+ {
+ ERR_PRINTF1(KErrDrawRegionSetting);
+ SetBlockResult(EFail);
+ }
+ }
+
+ }
+
+/**
+* Test AbortNow() and Restart() by SetPriority()
+*/
+void CT_DataDirectScreenAccess::DoCmdSetPriority(const TDesC& aSection)
+ {
+ INFO_PRINTF1(KInfoSetPriority);
+ CActive::TPriority priority;
+ IncOutstanding();
+ if ( !CT_GraphicsUtil::ReadPriority(*this , aSection , KPriorityObj, priority) )
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KPriorityObj);
+ SetBlockResult(EFail);
+ }
+ iDirectScreenAccess->SetPriority(priority);
+ }
+
+/**
+* Test AbortNow() and Restart() by bring a app to foreground
+*/
+void CT_DataDirectScreenAccess::DoCmdBringAppFgL(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ TPtrC sessionKeyName(KRWsSessionObj);
+ TPtrC appKeyName(KAppName);
+ IncOutstanding();
+ if ( !CT_GraphicsUtil::BringAppForegroundL(*this , aSection , sessionKeyName, appKeyName) )
+ {
+ ERR_PRINTF2(KLogMissingParameter , &sessionKeyName);
+ SetBlockResult(EFail);
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataDrawableWindow.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataDrawableWindow.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdScroll, "Scroll");
+_LIT(KCmdGetDrawRect, "GetDrawRect");
+
+// Fields
+_LIT(KFldClipRect, "cliprect");
+_LIT(KFldOffset, "offset");
+_LIT(KFldRect, "rect");
+_LIT(KFldExpected, "expected");
+
+/// Logging
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogMissingExpectedValue, "Missing expected value '%S'");
+_LIT(KLogNotAsExpectedValue, "'%S' is not as expected value");
+
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataDrawableWindow::CT_DataDrawableWindow()
+: CT_DataWindowBase()
+ {
+ }
+
+RWindowBase* CT_DataDrawableWindow::GetWindowBase() const
+ {
+ return GetDrawableWindow();
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataDrawableWindow::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdScroll )
+ {
+ DoCmdScroll(aSection);
+ }
+ else if ( aCommand==KCmdGetDrawRect )
+ {
+ DoCmdGetDrawRect(aSection);
+ }
+ else
+ {
+ ret=CT_DataWindowBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+
+void CT_DataDrawableWindow::DoCmdScroll(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPoint datOffset;
+
+ if ( !GetPointFromConfig(aSection, KFldOffset, datOffset) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldOffset);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TRect datRect;
+ TBool hasRect = GetRectFromConfig(aSection, KFldRect, datRect);
+
+ TRect datClipRect;
+
+ // Execute command and log parameters
+ if ( GetRectFromConfig(aSection, KFldClipRect, datClipRect) )
+ {
+ if ( hasRect )
+ {
+ INFO_PRINTF1(_L("execute Scroll(TRect, TPoint, TRect)"));
+ GetDrawableWindow()->Scroll(datClipRect, datOffset, datRect);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute Scroll(TRect, TPoint)"));
+ GetDrawableWindow()->Scroll(datClipRect, datOffset);
+ }
+ }
+ else
+ {
+ if ( hasRect )
+ {
+ INFO_PRINTF1(_L("execute Scroll(TPoint, TRect)"));
+ GetDrawableWindow()->Scroll(datOffset, datRect);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute Scroll(TPoint)"));
+ GetDrawableWindow()->Scroll(datOffset);
+ }
+ }
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataDrawableWindow::DoCmdGetDrawRect(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute GetDrawRect()"));
+ TRect actual=GetDrawableWindow()->GetDrawRect();
+ LogRect(_L("GetDrawableWindow()"), actual);
+
+ // Diaplay command return value, check if it matches the expected value
+ TRect expected;
+ if ( !GetRectFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF2(KLogNotAsExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataDsaSession.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,342 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_GraphicsUtil.h"
+#include "T_DataDsaSession.h"
+
+_LIT(KDataClassname, "RDirectScreenAccess");
+//command
+_LIT( KCmdnewL, "new" );
+_LIT( KCmdConstruct, "Construct" );
+_LIT( KCmdClose, "Close" );
+_LIT( KCmdRequest, "Request" );
+_LIT( KCmdCompleted, "Completed" );
+_LIT( KCmdCancel, "Cancel" );
+_LIT( KCmdEatupMemory, "Util_EatupMemory" );
+_LIT( KCmdFreeEatenMemory, "Util_FreeEatenMemory" );
+// Fields
+_LIT( KRWsSessionObj, "ws");
+_LIT( KRWindowObj, "win");
+_LIT( KFldRegion, "region1");
+_LIT( KFldMemLeft, "memleft");
+
+//Error
+_LIT( KErrNewL, "Create RDirectScreenAccess() failed.");
+_LIT( KErrRequestRegionMatch, "Execute RDirectScreenAccess::Request() failed, Error: region size not match.");
+_LIT( KLogMissingParameter, "Missing parameter '%S'");
+_LIT( KLogError, "Error=%d");
+_LIT( KStraySignal, "Stray signal");
+
+//Info
+_LIT( KRdsaNew1, "RDSA::new() has been called");
+_LIT( KRdsaNew2, "RDSA::new(session) has been called");
+_LIT( KInfoConstruct, "Construct() has been called" );
+_LIT( KInfoClose, "Close() has been called" );
+_LIT( KInfoRequest, "Request() has been called" );
+_LIT( KInfoCompleted, "Completed() has been called" );
+_LIT( KInfoCancel, "Cancel() has been called" );
+_LIT( KRunRequestReady, "RunRequestReady %d");
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+CT_DataDsaSession::CT_DataDsaSession() :
+ iDsaSession(NULL),
+ iActiveRequestReady(NULL)
+ {
+ }
+
+void CT_DataDsaSession::ConstructL()
+ {
+ iActiveRequestReady = CActiveCallback::NewL(*this);
+ }
+
+CT_DataDsaSession::~CT_DataDsaSession()
+ {
+ this->DestroyData();
+ }
+
+CT_DataDsaSession* CT_DataDsaSession::NewL()
+ {
+ CT_DataDsaSession* self = new (ELeave) CT_DataDsaSession();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+void CT_DataDsaSession::SetObjectL(TAny* aAny)
+ {
+ this->DestroyData();
+ iDsaSession = static_cast<RDirectScreenAccess*>(aAny);
+ }
+
+void CT_DataDsaSession::DisownObjectL()
+ {
+ iDsaSession = NULL;
+ }
+
+void CT_DataDsaSession::DestroyData()
+ {
+ delete iDsaSession;
+ iDsaSession = NULL;
+ delete iActiveRequestReady;
+ iActiveRequestReady = NULL;
+ }
+
+MWsClientClass* CT_DataDsaSession::GetClientClass() const
+ {
+ return iDsaSession;
+ }
+
+/**
+ * Process a command read from the ini file
+ *
+ * @param aCommand the command to process
+ * @param aSection the entry in the ini file requiring the command to be processed
+ * @param aAsyncErrorIndex index of command. used for async calls
+ *
+ * @return ETrue if the command is processed
+ */
+TBool CT_DataDsaSession::DoCommandL(const TTEFFunction& aCommand, const
+ TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool result( ETrue );
+ INFO_PRINTF1(aCommand);
+
+ if ( !aCommand.Compare( KCmdnewL ) || !aCommand.Compare( KDataClassname ) )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( !aCommand.Compare( KCmdConstruct ) )
+ {
+ DoCmdConstruct();
+ }
+ else if ( !aCommand.Compare( KCmdClose ) )
+ {
+ DoCmdClose();
+ }
+ else if ( !aCommand.Compare( KCmdRequest) )
+ {
+ DoCmdRequestL(aSection , aAsyncErrorIndex);
+ }
+ else if ( !aCommand.Compare( KCmdCompleted ) )
+ {
+ DoCmdCompleted();
+ }
+ else if ( !aCommand.Compare( KCmdCancel ) )
+ {
+ DoCmdCancel();
+ }
+ else if ( !aCommand.Compare(KCmdEatupMemory))
+ {
+ DoCmdEatupMemory(aSection);
+ }
+ else if (!aCommand.Compare(KCmdFreeEatenMemory))
+ {
+ DoCmdFreeEatenMemory();
+ }
+ else
+ {
+ result = EFalse;
+ }
+
+ return result;
+ }
+
+/**
+ * Helper method to get RWsSession
+ */
+RWsSession* CT_DataDsaSession::GetRWSessionL(const TDesC& aSection)
+ {
+ RWsSession* iClient = NULL; //Window Session Client
+ TPtrC objectName;
+
+ if ( GetStringFromConfig(aSection, KRWsSessionObj(), objectName) )
+ {
+ iClient = static_cast<RWsSession*>(GetDataObjectL(objectName));
+ }
+
+ return iClient;
+ }
+
+/**
+ * Test NewL();
+ */
+void CT_DataDsaSession::DoCmdnewL(const TDesC& aSection)
+ {
+ RWsSession* session = GetRWSessionL(aSection);
+
+ if(!session)
+ {
+ //no parameter.
+ iDsaSession = new (ELeave) RDirectScreenAccess();
+ INFO_PRINTF1(KRdsaNew1);
+ }
+ else
+ {
+ //with parameter
+ iDsaSession = new (ELeave) RDirectScreenAccess(*session);
+ INFO_PRINTF1(KRdsaNew2);
+ }
+
+ if(!iDsaSession)
+ {
+ ERR_PRINTF1(KErrNewL);
+ SetBlockResult(EFail);
+ }
+
+ }
+
+
+/**
+ * Test ConstructL();
+ */
+void CT_DataDsaSession::DoCmdConstruct()
+ {
+ INFO_PRINTF1(KInfoConstruct);
+ TInt result = iDsaSession->Construct();
+
+ if(result)
+ {
+ ERR_PRINTF2(KLogError, result);
+ SetBlockResult(EFail);
+ }
+
+ }
+
+
+/**
+ * Test Close();
+ */
+void CT_DataDsaSession::DoCmdClose()
+ {
+ INFO_PRINTF1(KInfoClose);
+ iDsaSession->Close();
+ }
+
+
+/**
+ * Test RequestL();
+ */
+void CT_DataDsaSession::DoCmdRequestL(const TDesC& aSection, const TInt aAsyncErrorIndex)
+ {
+ INFO_PRINTF1(KInfoRequest);
+ RWindowBase* iWindow = NULL;
+ TPtrC objectName;
+
+ if ( GetStringFromConfig(aSection, KRWindowObj(), objectName))
+ {
+ iWindow = static_cast<RWindowBase*> (GetDataObjectL(objectName));
+ }
+
+ if(!iWindow)
+ {
+ ERR_PRINTF2(KLogMissingParameter , &KRWindowObj);
+ SetBlockResult(EFail);
+ }
+
+ RRegion* aRegion = NULL;
+
+ TInt result = iDsaSession->Request(aRegion, iActiveRequestReady->iStatus, *iWindow);
+ if(result)
+ {
+ ERR_PRINTF2(KLogError, result);
+ SetError(result);
+ }
+ else
+ {
+ TRect temp;
+ if( GetRectFromConfig(aSection ,KFldRegion, temp ) && aRegion->Count())
+ {
+ //compare the region
+ TRect temp2 = (*aRegion)[0];
+ if(temp != temp2)
+ {
+ ERR_PRINTF1(KErrRequestRegionMatch);
+ SetBlockResult(EFail);
+ }
+
+ }
+
+ iActiveRequestReady->Activate(aAsyncErrorIndex);
+ IncOutstanding();
+ }
+
+ }
+
+/**
+ * Test Completed();
+ */
+void CT_DataDsaSession::DoCmdCompleted()
+ {
+ INFO_PRINTF1(KInfoCompleted);
+ iDsaSession->Completed();
+ }
+
+/**
+ * Test Cancel();
+ */
+void CT_DataDsaSession::DoCmdCancel()
+ {
+ INFO_PRINTF1(KInfoCancel);
+ iDsaSession->Cancel();
+ }
+
+void CT_DataDsaSession::DoCmdEatupMemory(const TDesC& aSection)
+ {
+ CT_GraphicsUtil::EatupMemory(*this,aSection,KFldMemLeft);
+ }
+void CT_DataDsaSession::DoCmdFreeEatenMemory()
+ {
+ CT_GraphicsUtil::FreeEatenMemory(*this);
+ }
+
+void CT_DataDsaSession::RunL(CActive* aActive, TInt aIndex)
+ {
+ if ( iActiveRequestReady == aActive )
+ {
+ RunRequestReady(aIndex);
+ }
+ else
+ {
+ ERR_PRINTF1(KStraySignal);
+ SetBlockResult(EFail);
+ }
+
+ }
+
+void CT_DataDsaSession::RunRequestReady( const TInt aIndex)
+ {
+ DecOutstanding();
+ TInt err = iActiveRequestReady->iStatus.Int();
+ INFO_PRINTF2(KRunRequestReady, err);
+
+ if ( KErrNone != err )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetAsyncError(aIndex, err);
+ }
+
+ }
+
+void CT_DataDsaSession::DoCancel(CActive* /*aActive*/, TInt /*aIndex*/)
+ {
+ //nothing.
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataFrame.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,349 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_GraphicsUtil.h"
+#include "T_DataFrame.h"
+#include <fbs.h>
+
+/*@{*/
+//Commands
+_LIT(KCmdNew, "NewL");
+_LIT(KCmdDestroy, "~");
+_LIT(KCmdFrameInfo, "FrameInfo");
+_LIT(KCmdSetFrameInfo, "SetFrameInfo");
+_LIT(KCmdBitmap, "Bitmap");
+_LIT(KCmdSetBitmap, "SetBitmap");
+_LIT(KCmdMask, "Mask");
+_LIT(KCmdSetMask, "SetMask");
+// Fields
+_LIT(KFldFrameInfo, "frameinfostate");
+_LIT(KFldTFrame, "frame%d");
+_LIT(KFldUid, "uid");
+_LIT(KFldTWsGraphicId, "graphicid");
+_LIT(KFldSecureId, "secureid");
+_LIT(KFldSetMask, "setmask");
+_LIT(KFldSetFrameInfo, "setframeinfo");
+_LIT(KFldSetBitmap, "setbitmap");
+_LIT(KFldMask, "expected_mask");
+_LIT(KFldBitmap, "expected_bitmap");
+_LIT(KFldGotMask, "got_mask");
+_LIT(KFldGotBitmap, "got_bitmap");
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+
+_LIT(KLogNew, "execute CT_DataFrame::NewL()");
+_LIT(KLogFrameInfo, "execute CT_DataFrame::FrameInfo()");
+_LIT(KLogSetFrameInfo, "execute CT_DataFrame::SetFrameInfo(const TFrameInfo &aFrameInfo)");
+_LIT(KLogBitmap, "execute CT_DataFrame::Bitmap()");
+_LIT(KLogSetBitmap, "execute CT_DataFrame::SetBitmap(CFbsBitmap *aBitmap)");
+_LIT(KLogMask, "execute CT_DataFrame::Mask()");
+_LIT(KLogSetMask, "execute CT_DataFrame::SetMask(CFbsBitmap *aMask)");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataFrame::CT_DataFrame()
+: CDataWrapperBase(),iFrame(NULL)
+ {
+ }
+
+CT_DataFrame* CT_DataFrame::NewL()
+ {
+ CT_DataFrame* ret=new (ELeave) CT_DataFrame();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+void CT_DataFrame::ConstructL()
+ {
+ }
+
+CT_DataFrame::~CT_DataFrame()
+ {
+ DoCmdDestroy();
+ }
+
+/**
+ * Called by TEF framework to set object.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataFrame::SetObjectL(TAny* aAny)
+ {
+ DoCmdDestroy();
+ iFrame = static_cast<CWsGraphicBitmapAnimation::CFrame*> (aAny);
+ }
+
+/**
+ * Called by TEF framework to disown the object.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataFrame::DisownObjectL()
+ {
+ iFrame = NULL;
+ }
+
+/**
+ * Destroy the object which has been constructed.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataFrame::DoCmdDestroy()
+ {
+ delete iFrame;
+ iFrame = NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataFrame::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdNew )
+ {
+ DoCmdNewL();
+ }
+ else if ( aCommand==KCmdDestroy )
+ {
+ DoCmdDestroy();
+ }
+ else if ( aCommand==KCmdFrameInfo )
+ {
+ DoCmdFrameInfo(aSection);
+ }
+ else if ( aCommand==KCmdSetFrameInfo )
+ {
+ DoCmdSetFrameInfo(aSection);
+ }
+ else if ( aCommand==KCmdBitmap )
+ {
+ DoCmdBitmapL(aSection);
+ }
+ else if ( aCommand==KCmdSetBitmap )
+ {
+ DoCmdSetBitmapL(aSection);
+ }
+ else if ( aCommand==KCmdMask )
+ {
+ DoCmdMaskL(aSection);
+ }
+ else if ( aCommand==KCmdSetMask )
+ {
+ DoCmdSetMaskL(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+/**
+ * Process new command
+ *
+ * @return: None
+ */
+void CT_DataFrame::DoCmdNewL()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogNew);
+ TInt err=KErrNone;
+ TRAP( err, iFrame=CWsGraphicBitmapAnimation::CFrame::NewL());
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ // No command return value and output parameter to display and check
+ }
+
+/**
+ * Process FrameInfo command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataFrame::DoCmdFrameInfo(const TDesC& aSection)
+ {
+ INFO_PRINTF1(KLogFrameInfo);
+ TFrameInfo frameinfo = iFrame->FrameInfo();
+
+ // Get test data for command input parameter(s)
+ TFrameInfo expected;
+ if ( CT_GraphicsUtil::GetFrameInfo(*this, aSection, expected) )
+ {
+ if( frameinfo.iFlags!= expected.iFlags)
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+ * Process SetFrameInfo command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataFrame::DoCmdSetFrameInfo(const TDesC& aSection)
+ {
+ TFrameInfo frameinfo;
+
+ if ( CT_GraphicsUtil::GetFrameInfo(*this,aSection, frameinfo) )
+ {
+ INFO_PRINTF1(KLogSetFrameInfo);
+ iFrame->SetFrameInfo(frameinfo);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter,KFldSetFrameInfo);
+ SetBlockResult(EFail);
+ }
+ }
+
+/**
+ * Process Bitmap command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+*/
+ void CT_DataFrame::DoCmdBitmapL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(KLogBitmap);
+ CFbsBitmap* bitmap=const_cast<CFbsBitmap*>(iFrame->Bitmap());
+
+ TPtrC gotBitmap;
+ if(GetStringFromConfig(aSection,KFldGotBitmap,gotBitmap))
+ {
+ SetDataObjectL(gotBitmap,bitmap);
+ }
+
+ // Get test data for command input parameter(s)
+ CFbsBitmap* expected=NULL;
+ if ( CT_GraphicsUtil::GetFbsBitmapL(*this,aSection, KFldBitmap, expected) )
+ {
+ if ( bitmap!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+ * Process SetBitmap command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+*/
+ void CT_DataFrame::DoCmdSetBitmapL(const TDesC& aSection)
+ {
+ CFbsBitmap* bitmap=NULL;
+
+ if ( CT_GraphicsUtil::GetFbsBitmapL(*this,aSection, KFldSetBitmap, bitmap) )
+ {
+ INFO_PRINTF1(KLogSetBitmap);
+ iFrame->SetBitmap(bitmap);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter,KFldSetBitmap);
+ SetBlockResult(EFail);
+ }
+ }
+
+/**
+ * Process Mask command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+*/
+ void CT_DataFrame::DoCmdMaskL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(KLogMask);
+ CFbsBitmap* mask=const_cast<CFbsBitmap*>(iFrame->Mask());
+
+ TPtrC gotMask;
+ if(GetStringFromConfig(aSection,KFldGotMask,gotMask))
+ {
+ SetDataObjectL(gotMask,mask);
+ }
+
+ // Get test data for command input parameter(s)
+ CFbsBitmap* expected=NULL;
+ if ( CT_GraphicsUtil::GetFbsBitmapL(*this,aSection, KFldMask, expected) )
+ {
+ if ( mask!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+ * Process SetMask command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+*/
+ void CT_DataFrame::DoCmdSetMaskL(const TDesC& aSection)
+ {
+ CFbsBitmap* bitmap=NULL;
+
+ if ( CT_GraphicsUtil::GetFbsBitmapL(*this,aSection, KFldSetMask, bitmap) )
+ {
+ INFO_PRINTF1(KLogSetMask);
+ iFrame->SetMask(bitmap);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter,KFldSetMask);
+ SetBlockResult(EFail);
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataSoundPlugIn.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,474 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/**
+@test
+@internalComponent
+
+This contains CT_DataSoundPlugIn
+*/
+
+#include "T_DataSoundPlugIn.h"
+
+/*@{*/
+/// Parameters
+_LIT(KExpectedBool, "expected_bool");
+_LIT(KEnabled, "enabled");
+_LIT(KPlugInFileName, "filename");
+_LIT(KOpcode, "opcode");
+_LIT(KPackagedArgs, "args");
+_LIT(KUid, "uid");
+_LIT(KChangableBool, "isChangeable");
+
+/// Commands
+_LIT(KCmdNew, "new");
+_LIT(KCmdConstruct, "Construct");
+_LIT(KCmdClose, "Close");
+_LIT(KCmdDestroy, "Destroy");
+_LIT(KCmdIsLoaded, "IsLoaded");
+_LIT(KCmdUnload, "Unload");
+_LIT(KCmdLoad, "Load");
+_LIT(KCmdSetKeyClick, "SetKeyClick");
+_LIT(KCmdKeyClickEnabled, "KeyClickEnabled");
+_LIT(KCmdSetPenClick, "SetPenClick");
+_LIT(KCmdPenClickEnabled, "PenClickEnabled");
+_LIT(KCmdCommandReply, "CommandReply");
+
+// Fields
+_LIT(KFldWs, "ws");
+
+// Log
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+
+/*@}*/
+
+/**
+* Two phase constructor
+*/
+CT_DataSoundPlugIn* CT_DataSoundPlugIn::NewL()
+ {
+ CT_DataSoundPlugIn* ret = new (ELeave) CT_DataSoundPlugIn();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+/**
+* Protected constructor. First phase construction
+*/
+CT_DataSoundPlugIn::CT_DataSoundPlugIn()
+: iSoundPlugIn(NULL)
+ {
+ }
+
+/**
+* Second phase construction
+*/
+void CT_DataSoundPlugIn::ConstructL()
+ {
+ }
+
+/**
+* Protected destructor.
+*/
+CT_DataSoundPlugIn::~CT_DataSoundPlugIn()
+ {
+ Cleanup();
+ }
+
+void CT_DataSoundPlugIn::Cleanup()
+ {
+ delete iSoundPlugIn;
+ iSoundPlugIn = NULL;
+ }
+/**
+ * Return a pointer to the object that the data wraps. Not implemented, returns NULL.
+ *
+ * @return pointer to the object that the data wraps. Not implemented, returns NULL.
+ */
+ TAny* CT_DataSoundPlugIn::GetObject()
+ {
+ return NULL;
+ }
+
+ MWsClientClass* CT_DataSoundPlugIn::GetClientClass() const
+ {
+ return iSoundPlugIn;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aDataWrapper test step requiring command to be processed
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataSoundPlugIn::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool retVal=ETrue;
+
+ if(aCommand == KCmdNew)
+ {
+ DoCmdNewL(aSection);
+ }
+ else if(aCommand == KCmdConstruct)
+ {
+ DoCmdConstruct(aSection);
+ }
+ else if(aCommand == KCmdClose)
+ {
+ DoCmdClose();
+ }
+ else if(aCommand == KCmdDestroy)
+ {
+ DoCmdDestroy();
+ }
+ else if(aCommand == KCmdIsLoaded)
+ {
+ DoCmdIsLoaded(aSection);
+ }
+ else if(aCommand == KCmdUnload)
+ {
+ DoCmdUnload();
+ }
+ else if(aCommand == KCmdLoad)
+ {
+ DoCmdLoad(aSection);
+ }
+ else if(aCommand == KCmdSetKeyClick)
+ {
+ DoCmdSetKeyClick(aSection);
+ }
+ else if(aCommand == KCmdKeyClickEnabled)
+ {
+ DoCmdKeyClickEnabled(aSection);
+ }
+ else if(aCommand == KCmdSetPenClick)
+ {
+ DoCmdSetPenClick(aSection);
+ }
+ else if(aCommand == KCmdPenClickEnabled)
+ {
+ DoCmdPenClickEnabled(aSection);
+ }
+ else if(aCommand == KCmdCommandReply)
+ {
+ DoCmdCommandReply(aSection);
+ }
+ else
+ {
+ retVal = EFalse;
+ }
+
+ return retVal;
+ }
+
+/** RSoundPlugIn::RSoundPlugIn() Call */
+void CT_DataSoundPlugIn::DoCmdNewL(const TDesC& aSection)
+ {
+ // Cleanup if already created
+ Cleanup();
+
+ TPtrC wsName;
+ RWsSession* ws = NULL;
+ if(GetStringFromConfig(aSection, KFldWs, wsName))
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(wsName));
+ }
+
+
+ TInt err = KErrNone;
+
+ if(ws == NULL)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new RSoundPlugIn()"));
+ TRAP(err, iSoundPlugIn = new (ELeave) RSoundPlugIn);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new RSoundPlugIn(RWsSession)"));
+ TRAP(err, iSoundPlugIn = new (ELeave) RSoundPlugIn(*ws));
+ }
+
+ // Check error code
+ if(err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Error creation instance: %d"), err);
+ SetError(err);
+ }
+ }
+
+/** RSoundPlugIn::Construct() Call */
+void CT_DataSoundPlugIn::DoCmdConstruct(const TDesC& aSection)
+ {
+ TInt err = KErrNone;
+
+ if(0 == aSection.Length())
+ {
+ INFO_PRINTF1(_L("Calls RSoundPlugIn::Construct() with TUid::Null()"));
+
+ // Call Construct()
+ err = iSoundPlugIn->Construct();
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Calls RSoundPlugIn::Construct() with a plug-in DLL's third UID"));
+
+ // Get UID from parameters
+ TInt uid;
+ if(!GetIntFromConfig(aSection, KUid(), uid))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KUid());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ //Call Construct()
+ err = iSoundPlugIn->Construct(TUid::Uid(uid));
+ }
+ }
+
+ // Check error code
+ if(err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Calls Construct() error %d"), err);
+ SetError(err);
+ }
+ }
+
+
+/** RSoundPlugIn::Close() Call */
+void CT_DataSoundPlugIn::DoCmdClose()
+ {
+ INFO_PRINTF1(_L("Calls RSoundPlugIn::Close()"));
+
+ // Call Close()
+ iSoundPlugIn->Close();
+ }
+
+/** RSoundPlugIn::Destroy() Call */
+void CT_DataSoundPlugIn::DoCmdDestroy()
+ {
+ INFO_PRINTF1(_L("Calls RSoundPlugIn::Destroy()"));
+
+ // Call Destroy()
+ iSoundPlugIn->Destroy();
+ iSoundPlugIn = NULL;
+ }
+
+/** RSoundPlugIn::IsLoaded() Call */
+void CT_DataSoundPlugIn::DoCmdIsLoaded(const TDesC& aSection)
+ {
+ TBool actualValue,actualChangeable;
+ TBool setChangable = EFalse;
+ TBool expectedValue = EFalse;
+
+ if ( !GetBoolFromConfig(aSection, KExpectedBool(), expectedValue))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KExpectedBool());
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ actualValue = iSoundPlugIn->IsLoaded (actualChangeable);
+ INFO_PRINTF2(_L("Calls RSoundPlugIn::IsLoaded() %d"), actualValue);
+
+ if ( expectedValue != actualValue)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedValue, actualValue);
+ SetBlockResult (EFail);
+ }
+ else if (actualValue)
+ {
+ if ( !GetBoolFromConfig(aSection, KChangableBool(), setChangable))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KChangableBool());
+ SetBlockResult (EFail);
+ }
+ else
+ {
+ if (actualChangeable)
+ actualChangeable=ETrue;
+ if (actualChangeable != setChangable)
+ {
+ ERR_PRINTF3(_L("The IsChangeable is not as expected, expected: %d, actual: %d"), setChangable, actualChangeable);
+ SetBlockResult (EFail);
+ }
+ }
+ }
+ }
+ }
+
+/** RSoundPlugIn::Unload() Call */
+void CT_DataSoundPlugIn::DoCmdUnload()
+ {
+ INFO_PRINTF1(_L("Calls RSoundPlugIn::Unload()"));
+
+ // Call Unload to get actual return value
+ TInt err = iSoundPlugIn->Unload();
+ if(err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Call Unload() error %d"), err);
+ SetError(err);
+ }
+ }
+
+/** RSoundPlugIn::Load() Call */
+void CT_DataSoundPlugIn::DoCmdLoad(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls RSoundPlugIn::Load()"));
+
+ // Get file name from parameters
+ TPtrC fileName;
+ if(!GetStringFromConfig(aSection, KPlugInFileName(), fileName))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KPlugInFileName());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Call Load()
+ TInt err = iSoundPlugIn->Load(fileName);
+
+ // Check error code
+ if(err != KErrNone)
+ {
+ ERR_PRINTF3(_L("Load file error %d. File name: %S"), err, &fileName);
+ SetError(err);
+ }
+ }
+ }
+
+/** RSoundPlugIn::SetKeyClick() Call */
+void CT_DataSoundPlugIn::DoCmdSetKeyClick(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls RSoundPlugIn::SetKeyClick()"));
+
+ // Get bool value from parameters
+ TBool keyClickEnabled = ETrue;
+ if(!GetBoolFromConfig(aSection, KEnabled(), keyClickEnabled))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KEnabled());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Call SetKeyClick()
+ iSoundPlugIn->SetKeyClick(keyClickEnabled);
+ }
+ }
+
+/** RSoundPlugIn::KeyClickEnabled() Call */
+void CT_DataSoundPlugIn::DoCmdKeyClickEnabled(const TDesC& aSection)
+ {
+ // Call KeyClickEnabled() to get actual value
+ TBool actualValue = iSoundPlugIn->KeyClickEnabled();
+ INFO_PRINTF2(_L("Calls RSoundPlugIn::KeyClickEnabled() %d"), actualValue);
+
+ // Get expected value from parameters
+ TBool expectedValue = EFalse;
+ if(GetBoolFromConfig(aSection, KExpectedBool(), expectedValue))
+ {
+ if(expectedValue != actualValue)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedValue, actualValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** RSoundPlugIn::SetPenClick() Call */
+void CT_DataSoundPlugIn::DoCmdSetPenClick(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls RSoundPlugIn::SetPenClick()"));
+
+ // Get bool value from parameters
+ TBool penClickEnabled = ETrue;
+ if(!GetBoolFromConfig(aSection, KEnabled(), penClickEnabled))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KEnabled());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Call SetPenClick()
+ iSoundPlugIn->SetPenClick(penClickEnabled);
+ }
+ }
+
+/** RSoundPlugIn::PenClickEnabled() Call */
+void CT_DataSoundPlugIn::DoCmdPenClickEnabled(const TDesC& aSection)
+ {
+ // Call PenClickEnabled() to get actual value
+ TBool actualValue = iSoundPlugIn->PenClickEnabled();
+ INFO_PRINTF2(_L("Calls RSoundPlugIn::PenClickEnabled() %d"), actualValue);
+
+ // Get expected value from parameters
+ TBool expectedValue = EFalse;
+ if(GetBoolFromConfig(aSection, KExpectedBool(), expectedValue))
+ {
+ if(expectedValue != actualValue)
+ {
+ ERR_PRINTF3(_L("The returned value is not as expected, expected: %d, actual: %d"), expectedValue, actualValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/** RSoundPlugIn::DoCmdCommandReply() Call */
+void CT_DataSoundPlugIn::DoCmdCommandReply(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls RSoundPlugIn::DoCmdCommandReply()"));
+
+ TBool dataOK = ETrue;
+
+ // Get Opcode from parameters
+ TInt opcode = 0;
+ if(!GetIntFromConfig(aSection, KOpcode(), opcode))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KOpcode());
+ SetBlockResult(EFail);
+ dataOK = EFalse;
+ }
+
+ // Get packeaged args from parameters
+ TPtrC theString;
+ if(!GetStringFromConfig(aSection, KPackagedArgs(), theString))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KPackagedArgs());
+ SetBlockResult(EFail);
+ dataOK = EFalse;
+ }
+
+ if(dataOK)
+ {
+ // Call CommandReply()
+ TInt err = iSoundPlugIn->CommandReply(opcode, TPckgC<TDesC>(theString));
+
+ // Check error code
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("CommandReply failed with error %d"), err);
+ SetError(err);
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWindow.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,747 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWindow.h"
+#include "T_GraphicsUtil.h"
+#include <coemain.h>
+
+/*@{*/
+_LIT(KDataClassname, "RWindow");
+
+//Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdConstruct, "Construct");
+_LIT(KCmdBeginRedraw, "BeginRedraw");
+_LIT(KCmdEndRedraw, "EndRedraw");
+_LIT(KCmdInvalidate, "Invalidate");
+_LIT(KCmdGetInvalidRegion, "GetInvalidRegion");
+_LIT(KCmdSetBackgroundColor, "SetBackgroundColor");
+_LIT(KCmdSetSize, "SetSize");
+_LIT(KCmdSetExtent, "SetExtent");
+_LIT(KCmdHandleTransparencyUpdate, "HandleTransparencyUpdate");
+_LIT(KCmdSetTransparencyFactor, "SetTransparencyFactor");
+_LIT(KCmdSetTransparencyBitmap, "SetTransparencyBitmap");
+_LIT(KCmdSetTransparencyWsBitmap, "SetTransparencyWsBitmap");
+_LIT(KCmdSetNonTransparent, "SetNonTransparent");
+_LIT(KCmdEnableRedrawStore, "EnableRedrawStore");
+_LIT(KCmdSetTransparencyAlphaChannel, "SetTransparencyAlphaChannel");
+_LIT(KCmdSetTransparentRegion, "SetTransparentRegion");
+_LIT(KCmdSetTransparencyPolicy, "SetTransparencyPolicy");
+_LIT(KCmdIsRedrawStoreEnabled, "IsRedrawStoreEnabled");
+_LIT(KCmdEnableOSB, "EnableOSB");
+_LIT(KCmdSave, "Save");
+
+// Fields
+_LIT(KFldColor, "color");
+_LIT(KFldEnabled, "enabled");
+_LIT(KFldExpected, "expected");
+_LIT(KFldFlag, "flag");
+_LIT(KFldHandle, "handle");
+_LIT(KFldParent, "parent");
+_LIT(KFldPoint, "point");
+_LIT(KFldPolicy, "policy");
+_LIT(KFldRect, "rect");
+_LIT(KFldRegion, "region");
+_LIT(KFldSize, "size");
+_LIT(KFldTransparencyBitmap, "transparencybitmap");
+_LIT(KFldTransparencyFactor, "transparencyfactor");
+_LIT(KFldWs, "ws");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogMissingExpectedValue, "Missing expected value '%S'");
+_LIT(KLogNotExpectedValueInt, "'%S' is not as expected=%d, actual=%d");
+
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWindow* CT_DataWindow::NewL()
+ {
+ CT_DataWindow* ret=new (ELeave) CT_DataWindow();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWindow::CT_DataWindow()
+: CT_DataDrawableWindow()
+, iWindow(NULL)
+ {
+ }
+
+void CT_DataWindow::ConstructL()
+ {
+ }
+
+CT_DataWindow::~CT_DataWindow()
+ {
+ DestroyData();
+ }
+
+void CT_DataWindow::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWindow = static_cast<RWindow*> (aAny);
+ }
+
+void CT_DataWindow::DisownObjectL()
+ {
+ iWindow = NULL;
+ }
+
+void CT_DataWindow::DestroyData()
+ {
+ delete iWindow;
+ iWindow=NULL;
+ }
+
+RDrawableWindow* CT_DataWindow::GetDrawableWindow() const
+ {
+ return iWindow;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWindow::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructor )
+ {
+ DestroyData();
+ }
+ else if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( aCommand==KCmdConstruct )
+ {
+ DoCmdConstructL(aSection);
+ }
+ else if ( aCommand==KCmdBeginRedraw )
+ {
+ DoCmdBeginRedraw(aSection);
+ }
+ else if ( aCommand==KCmdEndRedraw )
+ {
+ DoCmdEndRedraw();
+ }
+ else if ( aCommand==KCmdInvalidate )
+ {
+ DoCmdInvalidate(aSection);
+ }
+ else if ( aCommand==KCmdGetInvalidRegion )
+ {
+ DoCmdGetInvalidRegionL(aSection);
+ }
+ else if ( aCommand==KCmdSetBackgroundColor )
+ {
+ DoCmdSetBackgroundColor(aSection);
+ }
+ else if ( aCommand==KCmdSetSize )
+ {
+ DoCmdSetSize(aSection);
+ }
+ else if ( aCommand==KCmdSetExtent )
+ {
+ DoCmdSetExtent(aSection);
+ }
+ else if ( aCommand==KCmdHandleTransparencyUpdate )
+ {
+ DoCmdHandleTransparencyUpdate();
+ }
+ else if ( aCommand==KCmdSetTransparencyFactor )
+ {
+ DoCmdSetTransparencyFactor(aSection);
+ }
+ else if ( aCommand==KCmdSetTransparencyBitmap )
+ {
+ DoCmdSetTransparencyBitmapL(aSection);
+ }
+ else if ( aCommand==KCmdSetTransparencyWsBitmap )
+ {
+ DoCmdSetTransparencyWsBitmapL(aSection);
+ }
+ else if ( aCommand==KCmdSetNonTransparent )
+ {
+ DoCmdSetNonTransparent();
+ }
+ else if ( aCommand==KCmdEnableRedrawStore )
+ {
+ DoCmdEnableRedrawStore(aSection);
+ }
+ else if ( aCommand==KCmdSetTransparencyAlphaChannel )
+ {
+ DoCmdSetTransparencyAlphaChannel();
+ }
+ else if ( aCommand==KCmdSetTransparentRegion )
+ {
+ DoCmdSetTransparentRegionL(aSection);
+ }
+ else if ( aCommand==KCmdSetTransparencyPolicy )
+ {
+ DoCmdSetTransparencyPolicy(aSection);
+ }
+ else if ( aCommand==KCmdIsRedrawStoreEnabled )
+ {
+ DoCmdIsRedrawStoreEnabled(aSection);
+ }
+ else if ( aCommand==KCmdEnableOSB )
+ {
+ DoCmdEnableOSB(aSection);
+ }
+ else if ( aCommand==KCmdSave )
+ {
+ DoCmdSave();
+ }
+ else
+ {
+ ret=CT_DataDrawableWindow::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+
+void CT_DataWindow::DoCmdnewL(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // Get test data for command input parameter(s)
+ TPtrC wsName;
+ RWsSession* ws=NULL;
+ if ( GetStringFromConfig(aSection, KFldWs, wsName) )
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(wsName));
+ }
+
+ TInt err=KErrNone;
+ if ( ws!=NULL )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new RWindow(RWsSession)"));
+ TRAP( err, iWindow = new (ELeave) RWindow(*ws));
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new RWindow()"));
+ TRAP( err, iWindow = new (ELeave) RWindow());
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWindow::DoCmdConstructL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPtrC parentName;
+ RWindowTreeNode* parent=NULL;
+ if ( GetStringFromConfig(aSection, KFldParent, parentName) )
+ {
+ parent = static_cast<RWindowTreeNode*>(GetDataObjectL(parentName));
+ }
+ if ( parent==NULL )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldParent);
+ SetBlockResult(EFail);
+ }
+
+ TInt datHandle;
+ if ( !GetIntFromConfig(aSection, KFldHandle, datHandle) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldHandle);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Construct(RWindowTreeNode, TUint32)"));
+ TInt returnCode = iWindow->Construct(*parent, datHandle);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindow::DoCmdBeginRedraw(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRect datRect;
+
+ if ( GetRectFromConfig(aSection, KFldRect, datRect) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute BeginRedraw(TRect)"));
+ iWindow->BeginRedraw(datRect);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute BeginRedraw()"));
+ iWindow->BeginRedraw();
+ }
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindow::DoCmdEndRedraw()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute EndRedraw()"));
+ iWindow->EndRedraw();
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindow::DoCmdInvalidate(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRect datRect;
+
+ if ( GetRectFromConfig(aSection, KFldRect, datRect) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Invalidate(TRect)"));
+ iWindow->Invalidate(datRect);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Invalidate()"));
+ iWindow->Invalidate();
+ }
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindow::DoCmdGetInvalidRegionL(const TDesC& aSection)
+ {
+ RRegion region(1);
+ CleanupClosePushL(region);
+
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute GetInvalidRegion(RRegion)"));
+ iWindow->GetInvalidRegion(region);
+
+ // Diaplay command return value, check if it matches the expected value
+ LogRegion(_L("GetInvalidRegion()"), region);
+
+ RRegion expectedRegion(1);
+ CleanupClosePushL(expectedRegion);
+ if ( GetRegionFromConfig(aSection, KFldExpected, expectedRegion) )
+ {
+ region.SubRegion(expectedRegion);
+ if ( !region.IsEmpty() )
+ {
+ ERR_PRINTF1(_L("Region not as expected"));
+ LogRegion(_L("Region mismatch"), region);
+ SetBlockResult(EFail);
+ }
+ }
+
+ CleanupStack::PopAndDestroy(2, ®ion);
+ }
+
+
+void CT_DataWindow::DoCmdSetBackgroundColor(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRgb datColor;
+
+ if ( GetRgbFromConfig(aSection, KFldColor, datColor) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetBackgroundColor(TRgb)"));
+ iWindow->SetBackgroundColor(datColor);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetBackgroundColor()"));
+ iWindow->SetBackgroundColor();
+ }
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindow::DoCmdSetSize(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TSize datSize;
+ if ( !GetSizeFromConfig(aSection, KFldSize, datSize) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSize);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetSize(TSize)"));
+ iWindow->SetSize(datSize);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindow::DoCmdSetExtent(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPoint datPoint;
+ if ( !GetPointFromConfig(aSection, KFldPoint, datPoint) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint);
+ SetBlockResult(EFail);
+ }
+
+ TSize datSize;
+ if ( !GetSizeFromConfig(aSection, KFldSize, datSize) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSize);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetExtent(TPoint, TSize)"));
+ iWindow->SetExtent(datPoint, datSize);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindow::DoCmdHandleTransparencyUpdate()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute HandleTransparencyUpdate()"));
+ iWindow->HandleTransparencyUpdate();
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindow::DoCmdSetTransparencyFactor(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRgb datTransparencyFactor;
+
+ if ( !GetRgbFromConfig(aSection, KFldTransparencyFactor, datTransparencyFactor) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldTransparencyFactor);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetTransparencyFactor(TRgb)"));
+ TInt returnCode = iWindow->SetTransparencyFactor(datTransparencyFactor);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindow::DoCmdSetTransparencyBitmapL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ CFbsBitmap* transparencyBitmap = NULL;
+
+ if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldTransparencyBitmap, transparencyBitmap) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldTransparencyBitmap);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetTransparencyBitmap(CFbsBitmap)"));
+ TInt returnCode = iWindow->SetTransparencyBitmap(*transparencyBitmap);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindow::DoCmdSetTransparencyWsBitmapL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ CWsBitmap* transparencyBitmap = NULL;
+
+ if ( !CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldTransparencyBitmap, transparencyBitmap) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldTransparencyBitmap);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetTransparencyWsBitmap(CWsBitmap)"));
+ TInt returnCode = iWindow->SetTransparencyWsBitmap(*transparencyBitmap);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindow::DoCmdSetNonTransparent()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetNonTransparent()"));
+ iWindow->SetNonTransparent();
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindow::DoCmdEnableRedrawStore(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datEnabled;
+
+ if ( !GetBoolFromConfig(aSection, KFldEnabled, datEnabled) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldEnabled);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute EnableRedrawStore(TBool)"));
+ iWindow->EnableRedrawStore(datEnabled);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindow::DoCmdSetTransparencyAlphaChannel()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetTransparencyAlphaChannel()"));
+ TInt returnCode = iWindow->SetTransparencyAlphaChannel();
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+
+
+void CT_DataWindow::DoCmdSetTransparentRegionL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ RRegion region(1);
+ CleanupClosePushL(region);
+
+ if ( !GetRegionFromConfig(aSection, KFldRegion, region) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRegion);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetTransparentRegion(TRegion)"));
+ TInt returnCode = iWindow->SetTransparentRegion(region);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+
+ CleanupStack::PopAndDestroy(®ion);
+ }
+
+
+void CT_DataWindow::DoCmdSetTransparencyPolicy(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TWsTransparencyPolicy datPolicy;
+
+ if ( !CT_GraphicsUtil::ReadWsTransparencyPolicy(*this, aSection, KFldPolicy, datPolicy) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPolicy);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetTransparencyPolicy(TWsTransparencyPolicy)"));
+ TInt returnCode = iWindow->SetTransparencyPolicy(datPolicy);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindow::DoCmdIsRedrawStoreEnabled(const TDesC& aSection)
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute IsRedrawStoreEnabled()"));
+ TBool actualResult = iWindow->IsRedrawStoreEnabled();
+
+ // Diaplay command return value, check if it matches the expected value
+ TBool expectResult;
+ if ( !GetBoolFromConfig(aSection, KFldExpected, expectResult) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else if ( actualResult != expectResult )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, expectResult, actualResult);
+ SetBlockResult(EFail);
+ }
+
+ // No command output parameter to display and check
+ }
+
+
+void CT_DataWindow::DoCmdEnableOSB(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datFlag;
+
+ if ( !GetBoolFromConfig(aSection, KFldFlag, datFlag) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFlag);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute EnableOSB(TBool)"));
+ iWindow->EnableOSB(datFlag);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindow::DoCmdSave()
+{
+ RWsSession iWs;
+ CWsScreenDevice* iDeviceScreen;
+ CFbsBitmap* iBitmap=new(ELeave)CFbsBitmap();
+
+ User::LeaveIfError(iWs.Connect());
+ iDeviceScreen = new (ELeave) CWsScreenDevice(iWs); // make device for this session
+ User::LeaveIfError(iDeviceScreen->Construct()); // and complete its construction
+
+ //Create a bitmap from specified rect
+ iBitmap->Create(iDeviceScreen->SizeInPixels(),EColor16M);
+ iDeviceScreen->CopyScreenToBitmap(iBitmap);
+ iBitmap->Save(_L("c:\\logs\\testexecute\\screen.mbm")); //Save as an mbm
+
+ //Get rid of everything allocated
+ if (iDeviceScreen)
+ delete iDeviceScreen;
+ if (iBitmap)
+ delete iBitmap;
+ // finish with window server
+ iWs.Close();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWindowBase.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,1211 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWindowBase.h"
+#include "T_GraphicsUtil.h"
+
+
+/*@{*/
+//Commands
+_LIT(KCmdActivate, "Activate");
+_LIT(KCmdSetPosition, "SetPosition");
+_LIT(KCmdSetSizeErr, "SetSizeErr");
+_LIT(KCmdSetExtentErr, "SetExtentErr");
+_LIT(KCmdSize, "Size");
+_LIT(KCmdInquireOffset, "InquireOffset");
+_LIT(KCmdPointerFilter, "PointerFilter");
+_LIT(KCmdSetPointerGrab, "SetPointerGrab");
+_LIT(KCmdClaimPointerGrab, "ClaimPointerGrab");
+_LIT(KCmdSetPointerCapture, "SetPointerCapture");
+_LIT(KCmdSetPointerCapturePriority, "SetPointerCapturePriority");
+_LIT(KCmdGetPointerCapturePriority, "GetPointerCapturePriority");
+_LIT(KCmdSetVisible, "SetVisible");
+_LIT(KCmdSetShadowHeight, "SetShadowHeight");
+_LIT(KCmdSetShadowDisabled, "SetShadowDisabled");
+_LIT(KCmdPosition, "Position");
+_LIT(KCmdAbsPosition, "AbsPosition");
+_LIT(KCmdSetCornerType, "SetCornerType");
+_LIT(KCmdSetShape, "SetShape");
+_LIT(KCmdSetRequiredDisplayMode, "SetRequiredDisplayMode");
+_LIT(KCmdDisplayMode, "DisplayMode");
+_LIT(KCmdEnableBackup, "EnableBackup");
+_LIT(KCmdRequestPointerRepeatEvent, "RequestPointerRepeatEvent");
+_LIT(KCmdCancelPointerRepeatEventRequest, "CancelPointerRepeatEventRequest");
+_LIT(KCmdAllocPointerMoveBuffer, "AllocPointerMoveBuffer");
+_LIT(KCmdFreePointerMoveBuffer, "FreePointerMoveBuffer");
+_LIT(KCmdEnablePointerMoveBuffer, "EnablePointerMoveBuffer");
+_LIT(KCmdDisablePointerMoveBuffer, "DisablePointerMoveBuffer");
+_LIT(KCmdRetrievePointerMoveBuffer, "RetrievePointerMoveBuffer");
+_LIT(KCmdDiscardPointerMoveBuffer, "DiscardPointerMoveBuffer");
+_LIT(KCmdAddKeyRect, "AddKeyRect");
+_LIT(KCmdRemoveAllKeyRects, "RemoveAllKeyRects");
+_LIT(KCmdPasswordWindow, "PasswordWindow");
+_LIT(KCmdFadeBehind, "FadeBehind");
+_LIT(KCmdIsFaded, "IsFaded");
+_LIT(KCmdIsNonFading, "IsNonFading");
+_LIT(KCmdMoveToGroup, "MoveToGroup");
+
+// Fields
+_LIT(KFldActivatedByPointerSwitchOn, "activatedbypointerswitchon");
+_LIT(KFldBackupType, "backuptype");
+_LIT(KFldCornerFlags, "cornerflags");
+_LIT(KFldCornerType, "cornertype");
+_LIT(KFldExpected, "expected");
+_LIT(KFldExpectedNumOfPoints, "expected_numofpoints");
+_LIT(KFldFade, "fade");
+_LIT(KFldFlags, "flags");
+_LIT(KFldHeight, "height");
+_LIT(KFldIdentifier, "identifier");
+_LIT(KFldIdentifier_Name, "identifier_name");
+_LIT(KFldMaxPoints, "maxpoints");
+_LIT(KFldMode, "mode");
+_LIT(KFldPasswordMode, "passwordmode");
+_LIT(KFldPoint, "point");
+_LIT(KFldPriority, "priority");
+_LIT(KFldRect, "rect");
+_LIT(KFldRegion, "region");
+_LIT(KFldScanCode, "scancode");
+_LIT(KFldSendUpEvent, "sendupevent");
+_LIT(KFldSize, "size");
+_LIT(KFldState, "state");
+_LIT(KFldTime, "time");
+_LIT(KFldWindow, "window");
+_LIT(KFldFilterMask, "filterMask");
+_LIT(KFldFilter, "filter");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogMissingExpectedValue, "Missing expected value '%S'");
+_LIT(KLogNotAsExpectedValue, "'%S' is not as expected value");
+_LIT(KLogNotExpectedValueInt, "'%S' is not as expected=%d, actual=%d");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWindowBase::CT_DataWindowBase()
+: CT_DataWindowTreeNode()
+ {
+ }
+
+RWindowTreeNode* CT_DataWindowBase::GetWindowTreeNode() const
+ {
+ return GetWindowBase();
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWindowBase::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdActivate )
+ {
+ DoCmdActivate();
+ }
+ else if ( aCommand==KCmdSetPosition )
+ {
+ DoCmdSetPosition(aSection);
+ }
+ else if ( aCommand==KCmdSetSizeErr )
+ {
+ DoCmdSetSizeErr(aSection);
+ }
+ else if ( aCommand==KCmdSetExtentErr )
+ {
+ DoCmdSetExtentErr(aSection);
+ }
+ else if ( aCommand==KCmdSize )
+ {
+ DoCmdSize(aSection);
+ }
+ else if ( aCommand==KCmdInquireOffset )
+ {
+ DoCmdInquireOffsetL(aSection);
+ }
+ else if ( aCommand==KCmdPointerFilter )
+ {
+ DoCmdPointerFilter(aSection);
+ }
+ else if ( aCommand==KCmdSetPointerGrab )
+ {
+ DoCmdSetPointerGrab(aSection);
+ }
+ else if ( aCommand==KCmdClaimPointerGrab )
+ {
+ DoCmdClaimPointerGrab(aSection);
+ }
+ else if ( aCommand==KCmdSetPointerCapture )
+ {
+ DoCmdSetPointerCapture(aSection);
+ }
+ else if ( aCommand==KCmdSetPointerCapturePriority )
+ {
+ DoCmdSetPointerCapturePriority(aSection);
+ }
+ else if ( aCommand==KCmdGetPointerCapturePriority )
+ {
+ DoCmdGetPointerCapturePriority(aSection);
+ }
+ else if ( aCommand==KCmdSetVisible )
+ {
+ DoCmdSetVisible(aSection);
+ }
+ else if ( aCommand==KCmdSetShadowHeight )
+ {
+ DoCmdSetShadowHeight(aSection);
+ }
+ else if ( aCommand==KCmdSetShadowDisabled )
+ {
+ DoCmdSetShadowDisabled(aSection);
+ }
+ else if ( aCommand==KCmdPosition )
+ {
+ DoCmdPosition(aSection);
+ }
+ else if ( aCommand==KCmdAbsPosition )
+ {
+ DoCmdAbsPosition(aSection);
+ }
+ else if ( aCommand==KCmdSetCornerType )
+ {
+ DoCmdSetCornerType(aSection);
+ }
+ else if ( aCommand==KCmdSetShape )
+ {
+ DoCmdSetShapeL(aSection);
+ }
+ else if ( aCommand==KCmdSetRequiredDisplayMode )
+ {
+ DoCmdSetRequiredDisplayMode(aSection);
+ }
+ else if ( aCommand==KCmdDisplayMode )
+ {
+ DoCmdDisplayMode(aSection);
+ }
+ else if ( aCommand==KCmdEnableBackup )
+ {
+ DoCmdEnableBackup(aSection);
+ }
+ else if ( aCommand==KCmdRequestPointerRepeatEvent )
+ {
+ DoCmdRequestPointerRepeatEvent(aSection);
+ }
+ else if ( aCommand==KCmdCancelPointerRepeatEventRequest )
+ {
+ DoCmdCancelPointerRepeatEventRequest();
+ }
+ else if ( aCommand==KCmdAllocPointerMoveBuffer )
+ {
+ DoCmdAllocPointerMoveBuffer(aSection);
+ }
+ else if ( aCommand==KCmdFreePointerMoveBuffer )
+ {
+ DoCmdFreePointerMoveBuffer();
+ }
+ else if ( aCommand==KCmdEnablePointerMoveBuffer )
+ {
+ DoCmdEnablePointerMoveBuffer();
+ }
+ else if ( aCommand==KCmdDisablePointerMoveBuffer )
+ {
+ DoCmdDisablePointerMoveBuffer();
+ }
+ else if ( aCommand==KCmdRetrievePointerMoveBuffer )
+ {
+ DoCmdRetrievePointerMoveBufferL(aSection);
+ }
+ else if ( aCommand==KCmdDiscardPointerMoveBuffer )
+ {
+ DoCmdDiscardPointerMoveBuffer();
+ }
+ else if ( aCommand==KCmdAddKeyRect )
+ {
+ DoCmdAddKeyRect(aSection);
+ }
+ else if ( aCommand==KCmdRemoveAllKeyRects )
+ {
+ DoCmdRemoveAllKeyRects();
+ }
+ else if ( aCommand==KCmdPasswordWindow )
+ {
+ DoCmdPasswordWindow(aSection);
+ }
+ else if ( aCommand==KCmdFadeBehind )
+ {
+ DoCmdFadeBehind(aSection);
+ }
+ else if ( aCommand==KCmdIsFaded )
+ {
+ DoCmdIsFaded(aSection);
+ }
+ else if ( aCommand==KCmdIsNonFading )
+ {
+ DoCmdIsNonFading(aSection);
+ }
+ else if ( aCommand==KCmdMoveToGroup )
+ {
+ DoCmdMoveToGroupL(aSection);
+ }
+ else
+ {
+ ret=CT_DataWindowTreeNode::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+
+void CT_DataWindowBase::DoCmdActivate()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Activate()"));
+ GetWindowBase()->Activate();
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowBase::DoCmdSetPosition(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPoint datPoint;
+
+ if ( !GetPointFromConfig(aSection, KFldPoint, datPoint) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetPosition(TPoint)"));
+ GetWindowBase()->SetPosition(datPoint);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdSetSizeErr(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TSize datSize;
+
+ if ( !GetSizeFromConfig(aSection, KFldSize, datSize) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSize);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetSizeErr(TSize)"));
+ TInt returnCode = GetWindowBase()->SetSizeErr(datSize);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdSetExtentErr(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPoint datPoint;
+ if ( !GetPointFromConfig(aSection, KFldPoint, datPoint) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint);
+ SetBlockResult(EFail);
+ }
+
+ TSize datSize;
+ if ( !GetSizeFromConfig(aSection, KFldSize, datSize) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSize);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetExtentErr(TPoint, TSize)"));
+ TInt returnCode = GetWindowBase()->SetExtentErr(datPoint, datSize);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdSize(const TDesC& aSection)
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Size()"));
+ TSize actualResult = GetWindowBase()->Size();
+
+ // Diaplay command return value, check if it matches the expected value
+ TSize expectResult;
+
+ if ( !GetSizeFromConfig(aSection, KFldExpected, expectResult) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else if ( actualResult!=expectResult )
+ {
+ ERR_PRINTF2(KLogNotAsExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdInquireOffsetL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPtrC windowName;
+ RWindowTreeNode* window=NULL;
+ if ( GetStringFromConfig(aSection, KFldWindow, windowName) )
+ {
+ window = static_cast<RWindowTreeNode*>(GetDataObjectL(windowName));
+ }
+
+ if ( window==NULL )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldWindow);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute InquireOffset(RWindowTreeNode)"));
+ TPoint actualResult = GetWindowBase()->InquireOffset(*window);
+
+ // Diaplay command return value, check if it matches the expected value
+ TPoint expectResult;
+
+ if ( !GetPointFromConfig(aSection, KFldExpected, expectResult) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else if ( actualResult!=expectResult )
+ {
+ ERR_PRINTF2(KLogNotAsExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdPointerFilter(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TUint32 eventFilterMask=0;
+ if ( !CT_GraphicsUtil::ReadPointerFilter(*this, aSection, KFldFilterMask, (TUint&)eventFilterMask) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFilterMask);
+ SetBlockResult(EFail);
+ }
+
+ TUint32 eventFilter=0;
+ if ( !CT_GraphicsUtil::ReadPointerFilter(*this, aSection, KFldFilter, (TUint&)eventFilter) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFilter);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF3(_L("execute PointerFilter(0x%x, 0x%x)"), eventFilterMask, eventFilter);
+ GetWindowBase()->PointerFilter(eventFilterMask, eventFilter);
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdSetPointerGrab(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datState = EFalse;
+
+ if ( !GetBoolFromConfig(aSection, KFldState, datState) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldState);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetPointerGrab(TBool)"));
+ GetWindowBase()->SetPointerGrab(datState);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdClaimPointerGrab(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datSendUpEvent = EFalse;
+
+ if ( !GetBoolFromConfig(aSection, KFldSendUpEvent, datSendUpEvent) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSendUpEvent);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute ClaimPointerGrab(TBool)"));
+ GetWindowBase()->ClaimPointerGrab(datSendUpEvent);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdSetPointerCapture(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ RWindowBase::TCaptureFlags datFlags;
+
+ if ( !CT_GraphicsUtil::ReadCaptureFlags(*this, aSection, KFldFlags, (TUint&)datFlags) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFlags);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetPointerCapture(TInt)"));
+ GetWindowBase()->SetPointerCapture(datFlags);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdSetPointerCapturePriority(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt datPriority;
+
+ if ( !GetIntFromConfig(aSection, KFldPriority, datPriority) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPriority);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetPointerCapturePriority(TInt)"));
+ GetWindowBase()->SetPointerCapturePriority(datPriority);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdGetPointerCapturePriority(const TDesC& aSection)
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute GetPointerCapturePriority()"));
+ TInt actualResult = GetWindowBase()->GetPointerCapturePriority();
+
+ // Diaplay command return value, check if it matches the expected value
+ TInt expectResult;
+ if ( !GetIntFromConfig(aSection, KFldExpected, expectResult) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else if ( actualResult!=expectResult )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, expectResult, actualResult);
+ SetBlockResult(EFail);
+ }
+
+ // No command output parameter to display and check
+ }
+
+
+void CT_DataWindowBase::DoCmdSetVisible(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datState = EFalse;
+
+ if ( !GetBoolFromConfig(aSection, KFldState, datState) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldState);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetVisible(TBool)"));
+ GetWindowBase()->SetVisible(datState);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdSetShadowHeight(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt datHeight;
+
+ if ( !GetIntFromConfig(aSection, KFldHeight, datHeight) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldHeight);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetShadowHeight(TInt)"));
+ GetWindowBase()->SetShadowHeight(datHeight);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdSetShadowDisabled(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datState = EFalse;
+
+ if ( !GetBoolFromConfig(aSection, KFldState, datState) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldState);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetShadowDisabled(TBool)"));
+ GetWindowBase()->SetShadowDisabled(datState);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdPosition(const TDesC& aSection)
+ {
+ TPoint actual=GetWindowBase()->Position();
+ INFO_PRINTF3(_L("execute Position()=(%d,%d)"), actual.iX, actual.iY);
+
+ // Diaplay command return value, check if it matches the expected value
+ TPoint expected;
+ if ( !GetPointFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF2(KLogNotAsExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdAbsPosition(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute AbsPosition()"));
+ TPoint actual=GetWindowBase()->AbsPosition();
+
+ // Diaplay command return value, check if it matches the expected value
+ TPoint expected;
+ if ( !GetPointFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF2(KLogNotAsExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdSetCornerType(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TCornerType datCornerType;
+ if ( !CT_GraphicsUtil::ReadCornerType(*this, aSection, KFldCornerType, datCornerType) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldCornerType);
+ SetBlockResult(EFail);
+ }
+
+ TInt datCornerFlags;
+ if ( !GetHexFromConfig(aSection, KFldCornerFlags, datCornerFlags) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldCornerFlags);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetCornerType(TCornerType, TInt)"));
+ GetWindowBase()->SetCornerType(datCornerType, datCornerFlags);
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdSetShapeL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ RRegion region(1);
+ CleanupClosePushL(region);
+
+ if ( !GetRegionFromConfig(aSection, KFldRegion, region) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRegion);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetShape(TRegion)"));
+ TInt err=GetWindowBase()->SetShape(region);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+
+ // No command output parameter to display and check
+ }
+ CleanupStack::PopAndDestroy(®ion);
+ }
+
+
+void CT_DataWindowBase::DoCmdSetRequiredDisplayMode(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TDisplayMode datMode;
+
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldMode, datMode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldMode);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ TInt actual=GetWindowBase()->SetRequiredDisplayMode(datMode);
+ INFO_PRINTF2(_L("execute SetRequiredDisplayMode(TDisplayMode)=%d"), actual);
+
+ // Diaplay command return value, check if it matches the expected value
+ TDisplayMode expected;
+ if ( CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldExpected, expected) )
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF2(KLogNotAsExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataWindowBase::DoCmdDisplayMode(const TDesC& aSection)
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DisplayMode()"));
+ TDisplayMode actualResult = GetWindowBase()->DisplayMode();
+
+ // Diaplay command return value, check if it matches the expected value
+ TDisplayMode expectResult;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldExpected, expectResult) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else if ( actualResult!=expectResult )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, expectResult, actualResult);
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdEnableBackup(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TWindowBackupType datBackupType;
+
+ if ( !CT_GraphicsUtil::ReadWindowBackupType(*this, aSection, KFldBackupType, (TUint&)datBackupType) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldBackupType);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute EnableBackup(TUint)"));
+ GetWindowBase()->EnableBackup(datBackupType);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdRequestPointerRepeatEvent(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TInt datTime=0;
+ if ( !GetIntFromConfig(aSection, KFldTime, datTime) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldTime);
+ SetBlockResult(EFail);
+ }
+
+ TRect datRect;
+ if ( !GetRectFromConfig(aSection, KFldRect, datRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32, TRect)"));
+ GetWindowBase()->RequestPointerRepeatEvent((TTimeIntervalMicroSeconds32)datTime, datRect);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+void CT_DataWindowBase::DoCmdCancelPointerRepeatEventRequest()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute CancelPointerRepeatEventRequest()"));
+ GetWindowBase()->CancelPointerRepeatEventRequest();
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowBase::DoCmdAllocPointerMoveBuffer(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TInt datMaxPoints;
+ if ( !GetIntFromConfig(aSection, KFldMaxPoints, datMaxPoints) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldMaxPoints);
+ SetBlockResult(EFail);
+ }
+
+ TInt datFlags;
+ if ( !GetIntFromConfig(aSection, KFldFlags, datFlags) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFlags);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute AllocPointerMoveBuffer(TInt, TUint)"));
+ TInt returnCode = GetWindowBase()->AllocPointerMoveBuffer(datMaxPoints, datFlags);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdFreePointerMoveBuffer()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute FreePointerMoveBuffer()"));
+ GetWindowBase()->FreePointerMoveBuffer();
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowBase::DoCmdEnablePointerMoveBuffer()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute EnablePointerMoveBuffer()"));
+ GetWindowBase()->EnablePointerMoveBuffer();
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowBase::DoCmdDisablePointerMoveBuffer()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DisablePointerMoveBuffer()"));
+ GetWindowBase()->DisablePointerMoveBuffer();
+
+ // No command return value and output parameter to display and check
+ }
+
+void CT_DataWindowBase::DoCmdRetrievePointerMoveBufferL(const TDesC& aSection)
+ {
+ const TInt KPointerMoveBufferSize = 50;
+ TInt maxPoints=KPointerMoveBufferSize;
+ GetIntFromConfig(aSection, KFldMaxPoints, maxPoints);
+
+ TPoint* pnts = new (ELeave) TPoint[maxPoints];
+ CleanupArrayDeletePushL(pnts);
+ TPtr8 ptr((TUint8 *)pnts,sizeof(TPoint)*maxPoints);
+
+ INFO_PRINTF1(_L("execute RetrievePointerMoveBuffer(TDes8&)"));
+ TInt err=GetWindowBase()->RetrievePointerMoveBuffer(ptr);
+
+ if ( err<KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ TInt numberOfPointsInBuffer = ptr.Length() / sizeof(TPoint);
+ TInt expectedNumOfPoints=0;
+
+ for (TInt i=0; ; i++)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+ tempStore.Format(_L("%S%d"), &KFldExpected, i+1);
+
+ TPoint expectedPoint;
+ if ( GetPointFromConfig(aSection, tempStore, expectedPoint) )
+ {
+ expectedNumOfPoints++;
+ if ( i<numberOfPointsInBuffer )
+ {
+ if ( pnts[i]!=expectedPoint )
+ {
+ ERR_PRINTF2(KLogNotAsExpectedValue, &tempStore);
+ ERR_PRINTF3(_L("%d%d"), pnts[i].iX, pnts[i].iY);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if ( numberOfPointsInBuffer!=expectedNumOfPoints )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpectedNumOfPoints, expectedNumOfPoints, numberOfPointsInBuffer);
+ SetBlockResult(EFail);
+ }
+ }
+
+ CleanupStack::PopAndDestroy(pnts);
+ }
+
+void CT_DataWindowBase::DoCmdDiscardPointerMoveBuffer()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DiscardPointerMoveBuffer()"));
+ GetWindowBase()->DiscardPointerMoveBuffer();
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowBase::DoCmdAddKeyRect(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TRect datRect;
+ if ( !GetRectFromConfig(aSection, KFldRect, datRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect);
+ SetBlockResult(EFail);
+ }
+
+ TInt datScanCode;
+ if ( !CT_GraphicsUtil::ReadStdScanCode(*this, aSection, KFldScanCode, (TStdScanCode&)datScanCode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldScanCode);
+ SetBlockResult(EFail);
+ }
+
+ TBool datActivatedByPointerSwitchOn;
+ if ( !GetBoolFromConfig(aSection, KFldActivatedByPointerSwitchOn, datActivatedByPointerSwitchOn) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldActivatedByPointerSwitchOn);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute AddKeyRect(TRect, TInt, TBool)"));
+ TInt returnCode = GetWindowBase()->AddKeyRect(datRect, datScanCode, datActivatedByPointerSwitchOn);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdRemoveAllKeyRects()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute RemoveAllKeyRects()"));
+ GetWindowBase()->RemoveAllKeyRects();
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowBase::DoCmdPasswordWindow(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPasswordMode datPasswordMode;
+
+ if ( !CT_GraphicsUtil::ReadPasswordMode(*this, aSection, KFldPasswordMode, datPasswordMode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPasswordMode);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute PasswordWindow(TPasswordMode)"));
+ TInt returnCode = GetWindowBase()->PasswordWindow(datPasswordMode);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdFadeBehind(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datFade;
+
+ if ( !GetBoolFromConfig(aSection, KFldFade, datFade) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFade);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute FadeBehind(TBool)"));
+ GetWindowBase()->FadeBehind(datFade);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdIsFaded(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute IsFaded()"));
+ TBool actualResult = GetWindowBase()->IsFaded();
+
+ // Diaplay command return value, check if it matches the expected value
+ TBool expectResult;
+ if ( !GetBoolFromConfig(aSection, KFldExpected, expectResult) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( (actualResult!=0) != expectResult )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, expectResult, actualResult);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdIsNonFading(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute IsNonFading()"));
+ TBool actualResult = GetWindowBase()->IsNonFading();
+
+ // Diaplay command return value, check if it matches the expected value
+ TBool expectResult;
+ if ( !GetBoolFromConfig(aSection, KFldExpected, expectResult) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( (actualResult!=0) != expectResult )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, expectResult, actualResult);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+void CT_DataWindowBase::DoCmdMoveToGroupL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TInt datIdentifier;
+ if ( !GetIntFromConfig(aSection, KFldIdentifier, datIdentifier) )
+ {
+ TPtrC identifierName;
+ RWindowGroup* identifier = NULL;
+ if ( GetStringFromConfig(aSection, KFldIdentifier_Name, identifierName) )
+ {
+ identifier = static_cast<RWindowGroup*>(GetDataObjectL(identifierName));
+ }
+
+ if ( identifier==NULL )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldIdentifier);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ datIdentifier = identifier->Identifier();
+ INFO_PRINTF3(_L("get '%S_name' identifier = %d to MoveToGroup"), &KFldIdentifier, datIdentifier);
+ }
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute MoveToGroup(TInt)"));
+ TInt returnCode = GetWindowBase()->MoveToGroup(datIdentifier);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWindowGc.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,437 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWindowGc.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+_LIT(KDataClassname, "CWindowGc");
+
+//Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructor, "~CWindowGc");
+_LIT(KCmdDestructorGeneral, "~");
+_LIT(KCmdConstruct, "Construct");
+_LIT(KCmdActivate, "Activate");
+_LIT(KCmdDeactivate, "Deactivate");
+_LIT(KCmdBitBlt, "BitBlt");
+_LIT(KCmdBitBltMasked, "BitBltMasked");
+_LIT(KCmdSetDitherOrigin, "SetDitherOrigin");
+_LIT(KCmdSetOpaque, "SetOpaque");
+_LIT(KCmdDrawWsGraphic, "DrawWsGraphic");
+
+// Fields
+_LIT(KFldData, "data");
+_LIT(KFldWsga, "wsga");
+_LIT(KFldDestRect, "destrect");
+_LIT(KFldDestination, "destination");
+_LIT(KFldDevice, "device");
+_LIT(KFldId, "id");
+_LIT(KFldInvertMask, "invertmask");
+_LIT(KFldMaskBitmap, "maskbitmap");
+_LIT(KFldPoint, "point");
+_LIT(KFldSource, "source");
+_LIT(KFldSourceRect, "sourcerect");
+_LIT(KFldWsBitmap, "wsbitmap");
+_LIT(KFldDrawOpaque, "drawOpaque");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWindowGc* CT_DataWindowGc::NewL()
+ {
+ CT_DataWindowGc* ret=new (ELeave) CT_DataWindowGc();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWindowGc::CT_DataWindowGc()
+: CT_DataBitmapContext()
+, iWindowGc(NULL)
+ {
+ }
+
+void CT_DataWindowGc::ConstructL()
+ {
+ }
+
+CT_DataWindowGc::~CT_DataWindowGc()
+ {
+ DestroyData();
+ }
+
+void CT_DataWindowGc::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWindowGc = static_cast<CWindowGc*> (aAny);
+ }
+
+void CT_DataWindowGc::DisownObjectL()
+ {
+ iWindowGc = NULL;
+ }
+
+void CT_DataWindowGc::DestroyData()
+ {
+ delete iWindowGc;
+ iWindowGc=NULL;
+ }
+
+MWsClientClass* CT_DataWindowGc::GetClientClass() const
+ {
+ return iWindowGc;
+ }
+
+CBitmapContext* CT_DataWindowGc::GetBitmapContext() const
+ {
+ return iWindowGc;
+ }
+
+CGraphicsContext* CT_DataWindowGc::GetGraphicsContext() const
+ {
+ return iWindowGc;
+ }
+
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWindowGc::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructor || aCommand==KCmdDestructorGeneral )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( aCommand==KCmdConstruct )
+ {
+ DoCmdConstruct();
+ }
+ else if ( aCommand==KCmdActivate )
+ {
+ DoCmdActivateL(aSection);
+ }
+ else if ( aCommand==KCmdDeactivate )
+ {
+ DoCmdDeactivate();
+ }
+ else if ( aCommand==KCmdBitBlt )
+ {
+ DoCmdBitBltL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ else if ( aCommand==KCmdBitBltMasked )
+ {
+ DoCmdBitBltMaskedL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ else if ( aCommand==KCmdSetDitherOrigin )
+ {
+ DoCmdSetDitherOrigin(aSection);
+ }
+ else if ( aCommand==KCmdSetOpaque )
+ {
+ DoCmdSetOpaque(aSection);
+ }
+ else if ( aCommand==KCmdDrawWsGraphic )
+ {
+ DoCmdDrawWsGraphicL(aSection);
+ }
+ else if ( CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex) )
+ {
+ }
+ else
+ {
+ ret=CT_DataWsClientClass::DoCommandL(*this, aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+
+void CT_DataWindowGc::DoCmdnewL(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // Get test data for command input parameter(s)
+ CWsScreenDevice* device = NULL;
+ if ( !CT_GraphicsUtil::GetWsScreenDeviceL(*this, aSection, KFldDevice, device) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldDevice);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute new CWindowGc(CWsScreenDevice)"));
+ TRAPD( err, iWindowGc = new (ELeave) CWindowGc(device) );
+ if ( err != KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataWindowGc::DoCmdDestructor()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute ~CWindowGc()"));
+ delete iWindowGc;
+ iWindowGc=NULL;
+ }
+
+
+void CT_DataWindowGc::DoCmdConstruct()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Construct()"));
+ TInt returnCode = iWindowGc->Construct();
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+ }
+
+
+void CT_DataWindowGc::DoCmdActivateL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ RDrawableWindow *device = NULL;
+
+ if ( !CT_GraphicsUtil::GetDrawableWindowL(*this, aSection, KFldDevice, device) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldDevice);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Activate(RDrawableWindow)"));
+ iWindowGc->Activate(*device);
+
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowGc::DoCmdDeactivate()
+ {
+ // No command input parameter to process
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Deactivate()"));
+ iWindowGc->Deactivate();
+
+ // No command return value and output parameter to display and check
+ }
+
+void CT_DataWindowGc::DoCmdBitBltL(const TDesC& aCommand, const TDesC& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool dataOk=ETrue;
+
+ CWsBitmap* wsBitmap=NULL;
+ if ( !CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldWsBitmap, wsBitmap) )
+ {
+ CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ else
+ {
+ TPoint point;
+ if ( GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute BitBlt(TPoint, CWsBitmap*)"));
+ iWindowGc->BitBlt(point, wsBitmap);
+ }
+ }
+ else
+ {
+ TPoint destination;
+ if ( !GetPointFromConfig(aSection, KFldDestination, destination) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDestination());
+ SetBlockResult(EFail);
+ }
+
+ TRect source;
+ if ( !GetRectFromConfig(aSection, KFldSource, source) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSource());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute BitBlt(TRect, CWsBitmap*, TRect)"));
+ iWindowGc->BitBlt(destination, wsBitmap, source);
+ }
+ }
+ }
+ }
+
+
+void CT_DataWindowGc::DoCmdBitBltMaskedL(const TDesC& aCommand, const TDesC& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool dataOk=ETrue;
+
+ CWsBitmap* wsBitmap=NULL;
+ if ( !CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldWsBitmap, wsBitmap) )
+ {
+ CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+ else
+ {
+ // Get test data for command input parameter(s)
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
+ SetBlockResult(EFail);
+ }
+
+ TRect sourceRect;
+ if ( !GetRectFromConfig(aSection, KFldSourceRect, sourceRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSourceRect());
+ SetBlockResult(EFail);
+ }
+
+ TBool invertMask;
+ if ( !GetBoolFromConfig(aSection, KFldInvertMask, invertMask) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldInvertMask());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ CWsBitmap* maskBitmap=NULL;
+ CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldMaskBitmap, maskBitmap);
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute BitBltMasked(TPoint, CWsBitmap*, TRect, CWsBitmap*, TBool)"));
+ iWindowGc->BitBltMasked(point, wsBitmap, sourceRect, maskBitmap, invertMask);
+ }
+ }
+ }
+
+void CT_DataWindowGc::DoCmdSetDitherOrigin(const TDesC& aSection)
+ {
+ TPoint point;
+ if ( GetPointFromConfig(aSection, KFldPoint, point) )
+ {
+ INFO_PRINTF1(_L("CWindowGc::SetDitherOrigin"));
+ iWindowGc->SetDitherOrigin(point);
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldPoint());
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataWindowGc::DoCmdSetOpaque(const TDesC& aSection)
+ {
+ TBool drawOpaque=ETrue;
+ if( GetBoolFromConfig(aSection, KFldDrawOpaque(), drawOpaque))
+ {
+ INFO_PRINTF1(_L("CWindowGc::SetOpaque"));
+ iWindowGc->SetOpaque(drawOpaque);
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldDrawOpaque());
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataWindowGc::DoCmdDrawWsGraphicL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TWsGraphicId datId(0);
+ if ( !GetWsGraphicIdFromConfigL(aSection, KFldId, datId) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldId);
+ SetBlockResult(EFail);
+ }
+
+ TRect datDestRect;
+ if ( !GetRectFromConfig(aSection, KFldDestRect, datDestRect) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDestRect);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ RWsGraphicMsgBuf* pData = NULL;
+ TWsGraphicAnimation* pWsga = NULL;
+ if ( CT_GraphicsUtil::GetWsGraphicMsgBufL(*this, aSection, KFldData, pData) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawWsGraphic(TWsGraphicId, TRect, TDesC8)"));
+ iWindowGc->DrawWsGraphic(datId, datDestRect, pData->Pckg());
+ }
+ else if( CT_GraphicsUtil::GetWsGraphicAnimationL(*this, aSection, KFldWsga, pWsga) )
+ {
+ INFO_PRINTF1(_L("execute DrawWsGraphic(TWsGraphicId, TRect, TDesC8)"));
+ iWindowGc->DrawWsGraphic(datId, datDestRect, pWsga->Pckg());
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DrawWsGraphic(TWsGraphicId, TRect)"));
+ iWindowGc->DrawWsGraphic(datId, datDestRect);
+ }
+ // No command return value and output parameter to display and check
+ }
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWindowGroup.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,1236 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWindowGroup.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+_LIT(KDataClassname, "RWindowGroup");
+
+// Fields
+_LIT(KFldAdjust ,"adjust");
+_LIT(KFldCaptureKey ,"capturekey");
+_LIT(KFldClientHandle ,"clienthandle");
+_LIT(KFldClipRect ,"cliprect");
+_LIT(KFldCursor ,"cursor");
+_LIT(KFldDeviceNumber ,"devicenumber");
+_LIT(KFldFlags ,"flags");
+_LIT(KFldIdOfParentWindowGroup ,"idofparentwindowgroup");
+_LIT(KFldInputKeyCode ,"inputkeycode");
+_LIT(KFldIsFocusable ,"isfocusable");
+_LIT(KFldKeycode ,"keycode");
+_LIT(KFldModifier ,"modifier");
+_LIT(KFldModifierMask ,"modifiermask");
+_LIT(KFldOrdinalPriority ,"ordinalpriority");
+_LIT(KFldOutputKeyCode ,"outputkeycode");
+_LIT(KFldPos ,"pos");
+_LIT(KFldProcessSID ,"processsid");
+_LIT(KFldPriority ,"priority");
+_LIT(KFldRepeatTime ,"repeattime");
+_LIT(KFldScanCode ,"scancode");
+_LIT(KFldScreenDevice ,"screendevice");
+_LIT(KFldState ,"state");
+_LIT(KFldStdScanCode ,"stdscancode");
+_LIT(KFldTip ,"tip");
+_LIT(KFldType ,"type");
+_LIT(KFldWin ,"win");
+_LIT(KFldWs ,"ws");
+_LIT(KFldID ,"id");
+_LIT(KFldIDName ,"id_name");
+
+//Parameters
+_LIT(KinputWGN, "inputWGN");
+_LIT(KexpectedReturnWGN, "expectRtnWGN");
+_LIT(KOwningWGIdentifier, "OwningWGId");
+_LIT(KOwningWGIdName, "OwningWGId_name");
+
+//Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdConstruct, "Construct");
+_LIT(KCmdConstructChildApp, "ConstructChildApp");
+_LIT(KCmdAllowProcessToCreateChildWindowGroups, "AllowProcessToCreateChildWindowGroups");
+_LIT(KCmdEnableReceiptOfFocus, "EnableReceiptOfFocus");
+_LIT(KCmdAutoForeground, "AutoForeground");
+_LIT(KCmdSetOrdinalPriorityAdjust, "SetOrdinalPriorityAdjust");
+_LIT(KCmdSetOrdinalPositionErr, "SetOrdinalPositionErr");
+_LIT(KCmdCaptureKey, "CaptureKey");
+_LIT(KCmdCancelCaptureKey, "CancelCaptureKey");
+_LIT(KCmdCaptureKeyUpAndDowns, "CaptureKeyUpAndDowns");
+_LIT(KCmdCancelCaptureKeyUpAndDowns, "CancelCaptureKeyUpAndDowns");
+_LIT(KCmdCaptureLongKey, "CaptureLongKey");
+_LIT(KCmdCancelCaptureLongKey, "CancelCaptureLongKey");
+_LIT(KCmdAddPriorityKey, "AddPriorityKey");
+_LIT(KCmdRemovePriorityKey, "RemovePriorityKey");
+_LIT(KCmdSetTextCursor, "SetTextCursor");
+_LIT(KCmdCancelTextCursor, "CancelTextCursor");
+_LIT(KCmdSetOwningWindowGroup, "SetOwningWindowGroup");
+_LIT(KCmdDefaultOwningWindow, "DefaultOwningWindow");
+_LIT(KCmdSetName, "SetName");
+_LIT(KCmdName, "Name");
+_LIT(KCmdIdentifier, "Identifier");
+_LIT(KCmdDisableKeyClick, "DisableKeyClick");
+_LIT(KCmdEnableScreenChangeEvents, "EnableScreenChangeEvents");
+_LIT(KCmdDisableScreenChangeEvents, "DisableScreenChangeEvents");
+_LIT(KCmdSimulatePointerEvent, "SimulatePointerEvent");
+_LIT(KCmdSetChildGroup, "SetChildGroup");
+_LIT(KCmdClearChildGroup, "ClearChildGroup");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogMissingExpectedValue, "Missing expected value '%S'");
+_LIT(KLogNotExpectedValueString, "'%S' is not as expected='%S', actual='%S'");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWindowGroup* CT_DataWindowGroup::NewL()
+ {
+ CT_DataWindowGroup* ret=new (ELeave) CT_DataWindowGroup();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWindowGroup::CT_DataWindowGroup()
+: CT_DataWindowTreeNode()
+, iWindowGroup(NULL)
+, iCaptureKeyHandle(0)
+ {
+ }
+
+void CT_DataWindowGroup::ConstructL()
+ {
+ }
+
+CT_DataWindowGroup::~CT_DataWindowGroup()
+ {
+ DestroyData();
+ }
+
+void CT_DataWindowGroup::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWindowGroup = static_cast<RWindowGroup*> (aAny);
+ }
+
+void CT_DataWindowGroup::DisownObjectL()
+ {
+ iWindowGroup = NULL;
+ }
+
+void CT_DataWindowGroup::DestroyData()
+ {
+ delete iWindowGroup;
+ iWindowGroup=NULL;
+ }
+
+RWindowTreeNode* CT_DataWindowGroup::GetWindowTreeNode() const
+ {
+ return iWindowGroup;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWindowGroup::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructor )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( aCommand==KCmdConstruct )
+ {
+ DoCmdConstructL(aSection);
+ }
+ else if ( aCommand==KCmdConstructChildApp )
+ {
+ DoCmdConstructChildAppL(aSection);
+ }
+ else if ( aCommand==KCmdAllowProcessToCreateChildWindowGroups )
+ {
+ DoCmdAllowProcessToCreateChildWindowGroups(aSection);
+ }
+ else if ( aCommand==KCmdEnableReceiptOfFocus )
+ {
+ DoCmdEnableReceiptOfFocus(aSection);
+ }
+ else if ( aCommand==KCmdAutoForeground )
+ {
+ DoCmdAutoForeground(aSection);
+ }
+ else if ( aCommand==KCmdSetOrdinalPriorityAdjust )
+ {
+ DoCmdSetOrdinalPriorityAdjust(aSection);
+ }
+ else if ( aCommand==KCmdSetOrdinalPositionErr )
+ {
+ DoCmdSetOrdinalPositionErr(aSection);
+ }
+ else if ( aCommand==KCmdCaptureKey )
+ {
+ DoCmdCaptureKey(aSection);
+ }
+ else if ( aCommand==KCmdCancelCaptureKey )
+ {
+ DoCmdCancelCaptureKey(aSection);
+ }
+ else if ( aCommand==KCmdCaptureKeyUpAndDowns )
+ {
+ DoCmdCaptureKeyUpAndDowns(aSection);
+ }
+ else if ( aCommand==KCmdCancelCaptureKeyUpAndDowns )
+ {
+ DoCmdCancelCaptureKeyUpAndDowns(aSection);
+ }
+ else if ( aCommand==KCmdCaptureLongKey )
+ {
+ DoCmdCaptureLongKey(aSection);
+ }
+ else if ( aCommand==KCmdCancelCaptureLongKey )
+ {
+ DoCmdCancelCaptureLongKey(aSection);
+ }
+ else if ( aCommand==KCmdAddPriorityKey )
+ {
+ DoCmdAddPriorityKey(aSection);
+ }
+ else if ( aCommand==KCmdRemovePriorityKey )
+ {
+ DoCmdRemovePriorityKey(aSection);
+ }
+ else if ( aCommand==KCmdSetTextCursor )
+ {
+ DoCmdSetTextCursorL(aSection);
+ }
+ else if ( aCommand==KCmdCancelTextCursor )
+ {
+ DoCmdCancelTextCursor();
+ }
+ else if ( aCommand==KCmdSetOwningWindowGroup )
+ {
+ DoCmdSetOwningWindowGroupL(aSection);
+ }
+ else if ( aCommand==KCmdDefaultOwningWindow )
+ {
+ DoCmdDefaultOwningWindow();
+ }
+ else if ( aCommand==KCmdSetName )
+ {
+ DoCmdSetName(aSection);
+ }
+ else if ( aCommand==KCmdName )
+ {
+ DoCmdName(aSection);
+ }
+ else if ( aCommand==KCmdIdentifier )
+ {
+ DoCmdIdentifier();
+ }
+ else if ( aCommand==KCmdDisableKeyClick )
+ {
+ DoCmdDisableKeyClick(aSection);
+ }
+ else if ( aCommand==KCmdEnableScreenChangeEvents )
+ {
+ DoCmdEnableScreenChangeEvents();
+ }
+ else if ( aCommand==KCmdDisableScreenChangeEvents )
+ {
+ DoCmdDisableScreenChangeEvents();
+ }
+ else if ( aCommand==KCmdSimulatePointerEvent )
+ {
+ DoCmdSimulatePointerEvent(aSection);
+ }
+ else if ( aCommand==KCmdSetChildGroup )
+ {
+ DoCmdSetChildGroupL(aSection);
+ }
+ else if ( aCommand==KCmdClearChildGroup )
+ {
+ DoCmdClearChildGroup();
+ }
+ else
+ {
+ ret=CT_DataWindowTreeNode::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+
+void CT_DataWindowGroup::DoCmdnewL(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // Get test data for command input parameter(s)
+ TPtrC wsName;
+ RWsSession* ws=NULL;
+ if ( GetStringFromConfig(aSection, KFldWs, wsName) )
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(wsName));
+ }
+
+ TInt err=KErrNone;
+ if ( ws!=NULL )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new RWindowGroup(RWsSession)"));
+ TRAP( err, iWindowGroup = new (ELeave) RWindowGroup(*ws));
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new RWindowGroup()"));
+ TRAP( err, iWindowGroup = new (ELeave) RWindowGroup());
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdDestructor()
+ {
+ DestroyData();
+ }
+
+
+void CT_DataWindowGroup::DoCmdConstructL(const TDesC& aSection)
+ {
+ TInt returnCode=KErrNone;
+
+ // Get test data for command input parameter(s)
+ TInt datClientHandle;
+ TBool hasClientHandle = GetIntFromConfig(aSection, KFldClientHandle, datClientHandle);
+ if ( !hasClientHandle )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldClientHandle);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TBool datIsFocusable;
+ TBool hasIsFocusable = GetBoolFromConfig(aSection, KFldIsFocusable, datIsFocusable);
+
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+ CWsScreenDevice* screenDevice=NULL;
+ // Execute command and log parameters
+ if ( CT_GraphicsUtil::GetWsScreenDeviceL(*this, aSection, KFldScreenDevice, screenDevice) )
+ {
+ if ( hasIsFocusable )
+ {
+ INFO_PRINTF1(_L("execute Construct(TUint32, TBool, CWsScreenDevice)"));
+ returnCode = iWindowGroup->Construct(datClientHandle, datIsFocusable, screenDevice);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute Construct(TUint32, CWsScreenDevice)"));
+ returnCode = iWindowGroup->Construct(datClientHandle, screenDevice);
+ }
+ }
+ else
+#endif
+ {
+ if ( hasIsFocusable )
+ {
+ INFO_PRINTF1(_L("execute Construct(TUint32, TBool)"));
+ returnCode = iWindowGroup->Construct(datClientHandle, datIsFocusable);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute Construct(TUint32)"));
+ returnCode = iWindowGroup->Construct(datClientHandle);
+ }
+ }
+ }
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+
+
+void CT_DataWindowGroup::DoCmdConstructChildAppL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TInt returnCode=KErrNone;
+
+ // Get test data for command input parameter(s)
+ TInt datIdOfParentWindowGroup;
+ if ( !GetIntFromConfig(aSection, KFldIdOfParentWindowGroup, datIdOfParentWindowGroup) )
+ {
+ CDataWrapperBase* wrapper=NULL;
+ TPtrC objectName;
+ if ( GetStringFromConfig(aSection, KFldIdOfParentWindowGroup(), objectName) )
+ {
+ wrapper=static_cast<CDataWrapperBase*>(GetDataWrapperL(objectName));
+
+ }
+
+ if ( wrapper==NULL )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldIdOfParentWindowGroup);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ datIdOfParentWindowGroup = wrapper->GetIdentifier();
+ }
+ }
+
+ TInt datClientHandle;
+ if ( !GetIntFromConfig(aSection, KFldClientHandle, datClientHandle) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldClientHandle);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ TBool datIsFocusable;
+ if ( GetBoolFromConfig(aSection, KFldIsFocusable, datIsFocusable) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute ConstructChildApp(TInt, TUint32, TBool)"));
+ returnCode = iWindowGroup->ConstructChildApp(datIdOfParentWindowGroup, datClientHandle, datIsFocusable);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute ConstructChildApp(TInt, TUint32)"));
+ returnCode = iWindowGroup->ConstructChildApp(datIdOfParentWindowGroup, datClientHandle);
+ }
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdAllowProcessToCreateChildWindowGroups(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt datProcess;
+ if ( !GetIntFromConfig(aSection, KFldProcessSID, datProcess) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldProcessSID);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute AllowProcessToCreateChildWindowGroups(TUid)"));
+ iWindowGroup->AllowProcessToCreateChildWindowGroups(TUid::Uid(datProcess));
+ }
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowGroup::DoCmdEnableReceiptOfFocus(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datState;
+ if ( !GetBoolFromConfig(aSection, KFldState, datState) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldState);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute EnableReceiptOfFocus(TBool)"));
+ iWindowGroup->EnableReceiptOfFocus(datState);
+ }
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowGroup::DoCmdAutoForeground(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datState;
+ if ( !GetBoolFromConfig(aSection, KFldState, datState) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldState);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute AutoForeground(TBool)"));
+ iWindowGroup->AutoForeground(datState);
+ }
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowGroup::DoCmdSetOrdinalPriorityAdjust(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt datAdjust;
+ if ( !GetIntFromConfig(aSection, KFldAdjust, datAdjust) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldAdjust);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetOrdinalPriorityAdjust(TInt)"));
+ iWindowGroup->SetOrdinalPriorityAdjust(datAdjust);
+ }
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowGroup::DoCmdSetOrdinalPositionErr(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TInt datPos;
+ if ( !GetIntFromConfig(aSection, KFldPos, datPos) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPos);
+ SetBlockResult(EFail);
+ }
+
+ TInt datOrdinalPriority;
+ if ( !GetIntFromConfig(aSection, KFldOrdinalPriority, datOrdinalPriority) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldOrdinalPriority);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetOrdinalPositionErr(TInt, TInt)"));
+ TInt returnCode = iWindowGroup->SetOrdinalPositionErr(datPos, datOrdinalPriority);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
+
+void CT_DataWindowGroup::DoCmdCaptureKey(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TKeyCode keyCode;
+ if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KFldKeycode, keyCode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldKeycode);
+ SetBlockResult(EFail);
+ }
+
+ TUint modifierMask;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifierMask, modifierMask) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldModifierMask);
+ SetBlockResult(EFail);
+ }
+
+ TUint modifier;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifier, modifier) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldModifier);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ TInt ret=KErrNone;
+ TInt priority;
+ if ( GetIntFromConfig(aSection, KFldPriority, priority) )
+ {
+ INFO_PRINTF1(_L("execute CaptureKey(keyCode, modifierMask, modifier, priority)"));
+ ret=iWindowGroup->CaptureKey(keyCode, modifierMask, modifier, priority);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CaptureKey(keyCode, modifierMask, modifier)"));
+ ret=iWindowGroup->CaptureKey(keyCode, modifierMask, modifier);
+ }
+ if ( ret<KErrNone )
+ {
+ ERR_PRINTF2(KLogError, ret);
+ SetError(ret);
+ }
+ iCaptureKeyHandle=ret;
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdCancelCaptureKey(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt captureKey;
+ if ( !GetIntFromConfig(aSection, KFldCaptureKey, captureKey) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldCaptureKey);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CancelCaptureKey(captureKey)"));
+ if ( captureKey == -1 )
+ {
+ iWindowGroup->CancelCaptureKey(iCaptureKeyHandle);
+ }
+ else
+ {
+ iWindowGroup->CancelCaptureKey(captureKey);
+ }
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdCaptureKeyUpAndDowns(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TUint scanCode;
+ if ( !CT_GraphicsUtil::ReadStdScanCode(*this, aSection, KFldScanCode, (TStdScanCode&)scanCode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldScanCode);
+ SetBlockResult(EFail);
+ }
+
+ TUint modifierMask;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifierMask, modifierMask) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldModifierMask);
+ SetBlockResult(EFail);
+ }
+
+ TUint modifier;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifier, modifier) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldModifier);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ TInt ret=KErrNone;
+ TInt priority;
+ if ( !GetIntFromConfig(aSection, KFldPriority, priority) )
+ {
+ INFO_PRINTF1(_L("execute CaptureKeyUpAndDowns(TUint, TUint, TUint)"));
+ ret=iWindowGroup->CaptureKeyUpAndDowns(scanCode, modifierMask, modifier);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CaptureKeyUpAndDowns(TUint, TUint, TUint, TInt)"));
+ ret=iWindowGroup->CaptureKeyUpAndDowns(scanCode, modifierMask, modifier, priority);
+ }
+
+ if ( ret < KErrNone )
+ {
+ ERR_PRINTF2(KLogError, ret);
+ SetError(ret);
+ }
+ else
+ {
+ iCaptureKeyHandle=ret;
+ }
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdCancelCaptureKeyUpAndDowns(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt captureKey;
+ if ( !GetIntFromConfig(aSection, KFldCaptureKey, captureKey) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldCaptureKey);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CancelCaptureKeyUpAndDowns(captureKey)"));
+ if ( captureKey == -1 )
+ {
+ iWindowGroup->CancelCaptureKeyUpAndDowns(iCaptureKeyHandle);
+ }
+ else
+ {
+ iWindowGroup->CancelCaptureKeyUpAndDowns(captureKey);
+ }
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdCaptureLongKey(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TKeyCode inputKeyCode;
+ if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KFldInputKeyCode, inputKeyCode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldInputKeyCode);
+ SetBlockResult(EFail);
+ }
+
+ TKeyCode outputKeyCode;
+ if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KFldOutputKeyCode, outputKeyCode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldOutputKeyCode);
+ SetBlockResult(EFail);
+ }
+
+ TUint modifierMask;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifierMask, modifierMask) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldModifierMask);
+ SetBlockResult(EFail);
+ }
+
+ TUint modifier;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifier, modifier) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldModifier);
+ SetBlockResult(EFail);
+ }
+
+ TInt priority;
+ if ( !GetIntFromConfig(aSection, KFldPriority, priority) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPriority);
+ SetBlockResult(EFail);
+ }
+
+ TLongCaptureFlags flags;
+ if ( !CT_GraphicsUtil::ReadLongCaptureFlags(*this, aSection, KFldFlags, flags) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFlags);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ TInt ret=KErrNone;
+ TInt repeatTime;
+ if ( GetIntFromConfig(aSection, KFldRepeatTime, repeatTime) )
+ {
+ TTimeIntervalMicroSeconds32 theRepeatTime(repeatTime);
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute CaptureLongKey(repeatTime, inputKeyCode, iutputKeyCode, modifierMask, modifier, priority, flags)"));
+ ret=iWindowGroup->CaptureLongKey(theRepeatTime, inputKeyCode, outputKeyCode, modifierMask, modifier, priority, flags);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute CaptureLongKey(inputKeyCode, outputKeyCode, modifierMask, modifier, priority, flags)"));
+ ret=iWindowGroup->CaptureLongKey(inputKeyCode, outputKeyCode, modifierMask, modifier, priority, flags);
+ }
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( ret<KErrNone )
+ {
+ ERR_PRINTF2(KLogError, ret);
+ SetError(ret);
+ }
+ iCaptureKeyHandle=ret;
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdCancelCaptureLongKey(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt captureKey;
+ if ( !GetIntFromConfig(aSection, KFldCaptureKey, captureKey) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldCaptureKey);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CancelCaptureLongKey(captureKey)"));
+ if ( captureKey == -1 )
+ {
+ iWindowGroup->CancelCaptureLongKey(iCaptureKeyHandle);
+ }
+ else
+ {
+ iWindowGroup->CancelCaptureLongKey(captureKey);
+ }
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdAddPriorityKey(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TKeyCode keyCode;
+ if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KFldKeycode, keyCode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldKeycode);
+ SetBlockResult(EFail);
+ }
+
+ TUint modifierMask;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifierMask, modifierMask) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldModifierMask);
+ SetBlockResult(EFail);
+ }
+
+ TUint modifier;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifier, modifier) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldModifier);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute AddPriorityKey(TUint, TUint, TUint)"));
+ TInt ret=iWindowGroup->AddPriorityKey(keyCode, modifierMask, modifier);
+
+ // Check the command return code, if <KErrNone then stop this command
+ if ( ret!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, ret);
+ SetError(ret);
+ }
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdRemovePriorityKey(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TKeyCode keyCode;
+ if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KFldKeycode, keyCode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldKeycode);
+ SetBlockResult(EFail);
+ }
+
+ TUint modifierMask;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifierMask, modifierMask) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldModifierMask);
+ SetBlockResult(EFail);
+ }
+
+ TUint modifier;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifier, modifier) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldModifier);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute RemovePriorityKey(TUint, TUint, TUint)"));
+ iWindowGroup->RemovePriorityKey(keyCode, modifierMask, modifier);
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdSetTextCursorL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TPtrC datWinName;
+ RWindowBase* win = NULL;
+ if ( !GetStringFromConfig(aSection, KFldWin, datWinName) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldWin);
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+ else
+ {
+ win = static_cast<RWindowBase*>(GetDataObjectL(datWinName));
+ }
+
+ TPoint datPos;
+ if ( !GetPointFromConfig(aSection, KFldPos, datPos) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPos);
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ TTextCursor datCursor;
+ if ( !CT_GraphicsUtil::GetTextCursor(*this, aSection, KFldCursor, datCursor) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldCursor);
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+
+ if ( dataOk )
+ {
+ // get rectangle top left x-coordinate from parameters
+ TRect datClipRect;
+ if ( GetRectFromConfig(aSection, KFldClipRect, datClipRect) )
+ {
+ INFO_PRINTF1(_L("execute SetTextCursor(RWindowBase, const TPoint, const TTextCursor, const TRect)"));
+ iWindowGroup->SetTextCursor(*win, datPos, datCursor, datClipRect);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetTextCursor(RWindowBase, const TPoint, const TTextCursor)"));
+ iWindowGroup->SetTextCursor(*win, datPos, datCursor);
+ }
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdCancelTextCursor()
+ {
+ INFO_PRINTF1(_L("RWindowGroup::CancelTextCursor() call"));
+ iWindowGroup->CancelTextCursor();
+ }
+
+
+void CT_DataWindowGroup::DoCmdSetOwningWindowGroupL(const TDesC& aSection)
+ {
+ TInt winGroupId=0;
+ TBool hasWGIdentifier=ETrue;
+
+ if ( !GetIntFromConfig(aSection, KOwningWGIdentifier(), winGroupId) )
+ {
+
+ CDataWrapperBase* wrapper=NULL;
+ TPtrC objectName;
+ if ( GetStringFromConfig(aSection, KOwningWGIdName(), objectName) )
+ {
+ wrapper=static_cast<CDataWrapperBase*>(GetDataWrapperL(objectName));
+ }
+
+ if ( wrapper!=NULL )
+ {
+ winGroupId = wrapper->GetIdentifier();
+
+ INFO_PRINTF2(_L("get id:%d"), winGroupId);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KOwningWGIdentifier);
+ SetBlockResult(EFail);
+ hasWGIdentifier = EFalse;
+ }
+ }
+
+ if ( !hasWGIdentifier )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KOwningWGIdentifier);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetOwningWindowGroup(TInt)"));
+ iWindowGroup->SetOwningWindowGroup(winGroupId);
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdDefaultOwningWindow()
+ {
+ INFO_PRINTF1(_L("execute DefaultOwningWindow()"));
+ iWindowGroup->DefaultOwningWindow();
+ }
+
+
+void CT_DataWindowGroup::DoCmdSetName(const TDesC& aSection)
+ {
+ TPtrC theNameString;
+
+ if ( !GetStringFromConfig(aSection, KinputWGN(), theNameString) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KinputWGN);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetName(const TDesC)"));
+ TInt err = iWindowGroup->SetName(theNameString);
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataWindowGroup::DoCmdName(const TDesC& aSection)
+ {
+ TBuf<KMaxTestExecuteCommandLength> storeBuffer;
+
+ INFO_PRINTF1(_L("execute Name(TDes&)"));
+ TInt err = iWindowGroup->Name(storeBuffer);
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("the length of name:%d"), storeBuffer.Length());
+ INFO_PRINTF1(_L("the name of window group:"));
+ INFO_PRINTF1(storeBuffer);
+
+ TPtrC returnWGName;
+ if ( !GetStringFromConfig(aSection, KexpectedReturnWGN(), returnWGName) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KexpectedReturnWGN());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if (storeBuffer!=returnWGName)
+ {
+ ERR_PRINTF4(KLogNotExpectedValueString, &KexpectedReturnWGN, &returnWGName, &storeBuffer);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdIdentifier()
+ {
+ INFO_PRINTF1(_L("execute Identifier()"));
+ TInt actualWGId=iWindowGroup->Identifier();
+ INFO_PRINTF2(_L("Identifier:%d"),actualWGId);
+ SetIdentifier(actualWGId);
+ }
+
+
+void CT_DataWindowGroup::DoCmdDisableKeyClick(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datState;
+ if ( !GetBoolFromConfig(aSection, KFldState, datState) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldState);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute DisableKeyClick(TBool)"));
+ iWindowGroup->DisableKeyClick(datState);
+ }
+
+ // No command return value and output parameter to display and check
+ }
+
+
+void CT_DataWindowGroup::DoCmdEnableScreenChangeEvents()
+ {
+ INFO_PRINTF1(_L("execute EnableScreenChangeEvents()"));
+ TInt err = iWindowGroup->EnableScreenChangeEvents();
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdDisableScreenChangeEvents()
+ {
+ INFO_PRINTF1(_L("execute DisableScreenChangeEvents()"));
+ iWindowGroup->DisableScreenChangeEvents();
+ }
+
+
+void CT_DataWindowGroup::DoCmdSimulatePointerEvent(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TRawEvent event;
+
+ TRawEvent::TType type=TRawEvent::ENone;
+ if ( !CT_GraphicsUtil::ReadType(*this, aSection, KFldType(), type) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldType());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ event.Set(type);
+ }
+
+ TStdScanCode stdScanCode;
+ if ( CT_GraphicsUtil::ReadStdScanCode(*this, aSection, KFldStdScanCode(), stdScanCode) )
+ {
+ event.Set(type, stdScanCode);
+ }
+
+ TInt deviceNumber;
+ if ( GetIntFromConfig(aSection, KFldDeviceNumber, deviceNumber) )
+ {
+ event.SetDeviceNumber(deviceNumber);
+ }
+
+ TPoint pointerPos(0,0);
+ if ( GetPointFromConfig(aSection, KFldPos, pointerPos) )
+ {
+ event.Set(type, pointerPos.iX, pointerPos.iY);
+ }
+
+ TBool tip;
+ if ( GetBoolFromConfig(aSection, KFldTip, tip) )
+ {
+ event.SetTip(tip);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute SimulatePointerEvent(TRawEvent)"));
+ iWindowGroup->SimulatePointerEvent(event);
+ }
+ }
+
+
+void CT_DataWindowGroup::DoCmdSetChildGroupL(const TDesC& aSection)
+ {
+ TBool dataOk = ETrue;
+
+ TInt id;
+ if ( !GetIntFromConfig(aSection, KFldID, id) )
+ {
+ CDataWrapperBase* wrapper=NULL;
+ TPtrC objectName;
+ if ( GetStringFromConfig(aSection, KFldIDName(), objectName) )
+ {
+ wrapper=static_cast<CDataWrapperBase*>(GetDataWrapperL(objectName));
+ //handle=wrapper->GetHandle();
+ }
+
+ if ( wrapper!=NULL )
+ {
+ id = wrapper->GetIdentifier();
+
+ INFO_PRINTF3(_L("get '%S_name' identifier = %d' to set child group"), &KFldID, id);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldID);
+ SetBlockResult(EFail);
+ dataOk = EFalse;
+ }
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("execute SetChildGroup(TInt)"));
+ TInt returnCode = iWindowGroup->SetChildGroup(id);
+
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+ }
+ }
+
+void CT_DataWindowGroup::DoCmdClearChildGroup()
+ {
+ INFO_PRINTF1(_L("execute ClearChildGroup()"));
+ TInt returnCode = iWindowGroup->ClearChildGroup();
+
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWindowInfo.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWindowInfo.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdGetRedrawRegionAndRedrawShadowRegion, "GetRedrawRegionAndRedrawShadowRegion");
+
+/// Fields
+_LIT(KFldNullExpected, "nullexpected");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWindowInfo* CT_DataWindowInfo::NewL()
+/**
+ * Two phase constructor
+ */
+ {
+ CT_DataWindowInfo* ret=new (ELeave) CT_DataWindowInfo();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWindowInfo::CT_DataWindowInfo()
+/**
+ * Protected constructor. First phase construction
+ */
+: CDataWrapperBase()
+, iWindowInfo(NULL)
+, iRedrawRegion(NULL)
+, iRedrawShadowRegion(NULL)
+ {
+ }
+
+void CT_DataWindowInfo::ConstructL()
+/**
+ * Second phase construction
+ */
+ {
+ }
+
+CT_DataWindowInfo::~CT_DataWindowInfo()
+/**
+ * Public destructor
+ */
+ {
+ DestroyData();
+ }
+
+TAny* CT_DataWindowInfo::GetObject()
+/**
+ * Return a pointer to the object that the data wraps
+ *
+ * @return pointer to the object that the data wraps
+ */
+ {
+ return iWindowInfo;
+ }
+
+void CT_DataWindowInfo::SetObjectL(TAny* aAny)
+/**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ {
+ DestroyData();
+ iWindowInfo = static_cast<TWindowInfo*> (aAny);
+ }
+
+void CT_DataWindowInfo::DisownObjectL()
+/**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ {
+ iWindowInfo = NULL;
+ }
+
+void CT_DataWindowInfo::DestroyData()
+ {
+ delete iWindowInfo;
+ iWindowInfo=NULL;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWindowInfo::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructor )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdnew )
+ {
+ DoCmdnew();
+ }
+ else if ( aCommand==KCmdGetRedrawRegionAndRedrawShadowRegion )
+ {
+ DoCmdGetRedrawRegionAndRedrawShadowRegion(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+
+void CT_DataWindowInfo::DoCmdnew()
+ {
+ DestroyData();
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new()"));
+ TRAPD(err, iWindowInfo=new (ELeave) TWindowInfo());
+ if ( err != KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWindowInfo::DoCmdDestructor()
+ {
+ INFO_PRINTF1(_L("execute ~"));
+ DestroyData();
+ }
+
+void CT_DataWindowInfo::DoCmdGetRedrawRegionAndRedrawShadowRegion(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("GetRedrawRegionAndRedrawShadowRegion"));
+ iWindowInfo->GetRedrawRegionAndRedrawShadowRegion(iRedrawRegion, iRedrawShadowRegion);
+
+ TBool nullExpected;
+ if ( GetBoolFromConfig(aSection, KFldNullExpected(), nullExpected) )
+ {
+ if ( nullExpected )
+ {
+ if ( (iRedrawRegion!=NULL) || (iRedrawShadowRegion!=NULL) )
+ {
+ ERR_PRINTF3(_L("NULL pointers expected. RedrawRegion=0x%x, RedrawShadowRegion=0x%x"), iRedrawRegion, iRedrawShadowRegion);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ if ( (iRedrawRegion==NULL) || (iRedrawShadowRegion==NULL) )
+ {
+ ERR_PRINTF3(_L("Non NULL pointers expected. RedrawRegion=0x%x, RedrawShadowRegion=0x%x"), iRedrawRegion, iRedrawShadowRegion);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWindowTreeNode.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,682 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWindowTreeNode.h"
+
+
+//Parameters
+_LIT(KObjectName, "objectName");
+_LIT(KExpected, "expected");
+_LIT(KInputWindowPosition, "inputWindowPosition");
+_LIT(KInputWindowPriority, "inputWindowPriority");
+_LIT(KInputCursorNumber, "inputCursorNumber");
+_LIT(KInputEventControl, "inputEventControl");
+_LIT(KInputEventModifier, "inputEventModifier");
+_LIT(KInputNonFading, "inputNonFading");
+_LIT(KInputFaded, "inputFaded");
+_LIT(KInputFadeControl, "inputFadeControl");
+_LIT(KInputBlackMap, "inputBlackMap");
+_LIT(KInputWhiteMap, "inputWhiteMap");
+
+_LIT(KFldPointerCursor, "pointerCursor");
+//Commands
+_LIT(KCmdClose, "Close");
+_LIT(KCmdDestroy, "Destroy");
+_LIT(KCmdParent, "Parent");
+_LIT(KCmdPrevSibling, "PrevSibling");
+_LIT(KCmdNextSibling, "NextSibling");
+_LIT(KCmdChild, "Child");
+_LIT(KCmdOrdinalPriority, "OrdinalPriority");
+_LIT(KCmdOrdinalPosition, "OrdinalPosition");
+_LIT(KCmdFullOrdinalPosition, "FullOrdinalPosition");
+_LIT(KCmdSetOrdinalPosition, "SetOrdinalPosition");
+_LIT(KCmdWindowGroupId, "WindowGroupId");
+_LIT(KCmdSetPointerCursor, "SetPointerCursor");
+_LIT(KCmdSetCustomPointerCursor, "SetCustomPointerCursor");
+_LIT(KCmdEnableOnEvents, "EnableOnEvents");
+_LIT(KCmdDisableOnEvents, "DisableOnEvents");
+_LIT(KCmdEnableGroupChangeEvents, "EnableGroupChangeEvents");
+_LIT(KCmdDisableGroupChangeEvents, "DisableGroupChangeEvents");
+_LIT(KCmdEnableFocusChangeEvents, "EnableFocusChangeEvents");
+_LIT(KCmdDisableFocusChangeEvents, "DisableFocusChangeEvents");
+_LIT(KCmdEnableGroupListChangeEvents, "EnableGroupListChangeEvents");
+_LIT(KCmdDisableGroupListChangeEvents, "DisableGroupListChangeEvents");
+_LIT(KCmdEnableVisibilityChangeEvents, "EnableVisibilityChangeEvents");
+_LIT(KCmdDisableVisibilityChangeEvents, "DisableVisibilityChangeEvents");
+_LIT(KCmdEnableErrorMessages, "EnableErrorMessages");
+_LIT(KCmdDisableErrorMessages, "DisableErrorMessages");
+_LIT(KCmdEnableModifierChangedEvents, "EnableModifierChangedEvents");
+_LIT(KCmdDisableModifierChangedEvents, "DisableModifierChangedEvents");
+_LIT(KCmdSetNonFading, "SetNonFading");
+_LIT(KCmdSetFaded, "SetFaded");
+_LIT(KCmdClearPointerCursor, "ClearPointerCursor");
+
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWindowTreeNode::CT_DataWindowTreeNode()
+: CDataWrapperBase()
+ {
+ }
+
+MWsClientClass* CT_DataWindowTreeNode::GetClientClass() const
+ {
+ return GetWindowTreeNode();
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWindowTreeNode::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdClose )
+ {
+ DoCmdClose();
+ }
+ else if ( aCommand==KCmdDestroy )
+ {
+ DoCmdDestroyL();
+ }
+ else if ( aCommand==KCmdParent )
+ {
+ DoCmdParent(aSection);
+ }
+ else if ( aCommand==KCmdPrevSibling )
+ {
+ DoCmdPrevSibling(aSection);
+ }
+ else if ( aCommand==KCmdNextSibling )
+ {
+ DoCmdNextSibling(aSection);
+ }
+ else if ( aCommand==KCmdChild )
+ {
+ DoCmdChild(aSection);
+ }
+ else if ( aCommand==KCmdOrdinalPriority )
+ {
+ DoCmdOrdinalPriority(aSection);
+ }
+ else if ( aCommand==KCmdOrdinalPosition )
+ {
+ DoCmdOrdinalPosition(aSection);
+ }
+ else if ( aCommand==KCmdFullOrdinalPosition )
+ {
+ DoCmdFullOrdinalPosition(aSection);
+ }
+ else if ( aCommand==KCmdSetOrdinalPosition )
+ {
+ DoCmdSetOrdinalPosition(aSection);
+ }
+ else if ( aCommand==KCmdWindowGroupId )
+ {
+ DoCmdWindowGroupId();
+ }
+ else if ( aCommand==KCmdSetPointerCursor )
+ {
+ DoCmdSetPointerCursor(aSection);
+ }
+ else if ( aCommand==KCmdSetCustomPointerCursor )
+ {
+ DoCmdSetCustomPointerCursorL(aSection);
+ }
+ else if ( aCommand==KCmdEnableOnEvents )
+ {
+ DoCmdEnableOnEvents(aSection);
+ }
+ else if ( aCommand==KCmdDisableOnEvents )
+ {
+ DoCmdDisableOnEvents();
+ }
+ else if ( aCommand==KCmdEnableGroupChangeEvents )
+ {
+ DoCmdEnableGroupChangeEvents();
+ }
+ else if ( aCommand==KCmdDisableGroupChangeEvents )
+ {
+ DoCmdDisableGroupChangeEvents();
+ }
+ else if ( aCommand==KCmdEnableFocusChangeEvents )
+ {
+ DoCmdEnableFocusChangeEvents();
+ }
+ else if ( aCommand==KCmdDisableFocusChangeEvents )
+ {
+ DoCmdDisableFocusChangeEvents();
+ }
+ else if ( aCommand==KCmdEnableGroupListChangeEvents )
+ {
+ DoCmdEnableGroupListChangeEvents();
+ }
+ else if ( aCommand==KCmdDisableGroupListChangeEvents )
+ {
+ DoCmdDisableGroupListChangeEvents();
+ }
+ else if ( aCommand==KCmdEnableVisibilityChangeEvents )
+ {
+ DoCmdEnableVisibilityChangeEvents();
+ }
+ else if ( aCommand==KCmdDisableVisibilityChangeEvents )
+ {
+ DoCmdDisableVisibilityChangeEvents();
+ }
+ else if ( aCommand==KCmdEnableErrorMessages )
+ {
+ DoCmdEnableErrorMessages(aSection);
+ }
+ else if ( aCommand==KCmdDisableErrorMessages )
+ {
+ DoCmdDisableErrorMessages();
+ }
+ else if ( aCommand==KCmdEnableModifierChangedEvents )
+ {
+ DoCmdEnableModifierChangedEvents(aSection);
+ }
+ else if ( aCommand==KCmdDisableModifierChangedEvents )
+ {
+ DoCmdDisableModifierChangedEvents();
+ }
+ else if ( aCommand==KCmdSetNonFading )
+ {
+ DoCmdSetNonFading(aSection);
+ }
+ else if ( aCommand==KCmdSetFaded )
+ {
+ DoCmdSetFaded(aSection);
+ }
+ else if ( aCommand==KCmdClearPointerCursor )
+ {
+ DoCmdClearPointerCursor();
+ }
+ else
+ {
+ ret=CT_DataWsClientClass::DoCommandL(*this, aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+void CT_DataWindowTreeNode::DoCmdClose()
+ {
+ GetWindowTreeNode()->Close();
+ INFO_PRINTF1(_L("RWindowTreeNode::Close"));
+ }
+
+void CT_DataWindowTreeNode::DoCmdDestroyL()
+ {
+ RWindowTreeNode* node=GetWindowTreeNode();
+
+ // We disown the object as Destroy() also deletes it
+ DisownObjectL();
+ INFO_PRINTF1(_L("RWindowTreeNode::Destroy"));
+ node->Destroy();
+ }
+
+void CT_DataWindowTreeNode::DoCmdParent(const TDesC& aSection)
+ {
+ TUint32 actual = GetWindowTreeNode()->Parent();
+ INFO_PRINTF2(_L("RWindowTreeNode::Parent = %d"), actual);
+
+ TInt expected = 0;
+ if( GetIntFromConfig(aSection, KExpected(), expected))
+ {
+ if ( actual!=(TUint32)expected )
+ {
+ ERR_PRINTF1(_L("Parent is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KExpected());
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdPrevSibling(const TDesC& aSection)
+ {
+ TUint32 actual = GetWindowTreeNode()->PrevSibling();
+ INFO_PRINTF2(_L("RWindowTreeNode::PrevSibling = %d"), actual);
+
+ TInt expected = 0;
+ if( GetIntFromConfig(aSection, KExpected(), expected))
+ {
+ if ( actual!=(TUint32)expected )
+ {
+ ERR_PRINTF1(_L("PrevSibling is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KExpected());
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdNextSibling(const TDesC& aSection)
+ {
+ TUint32 actual = GetWindowTreeNode()->NextSibling();
+ INFO_PRINTF2(_L("RWindowTreeNode::NextSibling = %d"), actual);
+
+ TInt expected = 0;
+ if( GetIntFromConfig(aSection, KExpected(), expected))
+ {
+ if ( actual!=(TUint32)expected )
+ {
+ ERR_PRINTF1(_L("NextSibling is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KExpected());
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdChild(const TDesC& aSection)
+ {
+ TUint32 actual = GetWindowTreeNode()->Child();
+ INFO_PRINTF2(_L("RWindowTreeNode::Child = %d"), actual);
+
+ TInt expected = 0;
+ if( GetIntFromConfig(aSection, KExpected(), expected))
+ {
+ if ( actual!=(TUint32)expected )
+ {
+ ERR_PRINTF1(_L("Child is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KExpected());
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdOrdinalPriority(const TDesC& aSection)
+ {
+ TInt actual = GetWindowTreeNode()->OrdinalPriority();
+ INFO_PRINTF2(_L("RWindowTreeNode::OrdinalPriority = %d"), actual);
+
+ TInt expected = 0;
+ if( GetIntFromConfig(aSection, KExpected(), expected))
+ {
+ if( actual != expected )
+ {
+ ERR_PRINTF1(_L("OrdinalPriority is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KExpected());
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdOrdinalPosition(const TDesC& aSection)
+ {
+ TInt actual = GetWindowTreeNode()->OrdinalPosition();
+ INFO_PRINTF2(_L("RWindowTreeNode::OrdinalPosition = %d"), actual);
+
+ TInt expected = 0;
+ if( GetIntFromConfig(aSection, KExpected(), expected))
+ {
+ if( actual != expected )
+ {
+ ERR_PRINTF1(_L("OrdinalPosition is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KExpected());
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdFullOrdinalPosition(const TDesC& aSection)
+ {
+ TInt actual = GetWindowTreeNode()->FullOrdinalPosition();
+ INFO_PRINTF2(_L("RWindowTreeNode::FullOrdinalPosition = %d"), actual);
+
+ TInt expected = 0;
+ if( GetIntFromConfig(aSection, KExpected(), expected))
+ {
+ if( actual != expected )
+ {
+ ERR_PRINTF1(_L("FullOrdinalPosition is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KExpected());
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdSetOrdinalPosition(const TDesC& aSection)
+ {
+ TInt inputWindowPosition=0;
+ if( GetIntFromConfig(aSection, KInputWindowPosition(), inputWindowPosition))
+ {
+ TInt inputWindowPriority=0;
+ if( GetIntFromConfig(aSection, KInputWindowPriority(), inputWindowPriority))
+ {
+ GetWindowTreeNode()->SetOrdinalPosition(inputWindowPosition, inputWindowPriority);
+ INFO_PRINTF1(_L("RWindowTreeNode::SetOrdinalPosition (Priority)"));
+ }
+ else
+ {
+ GetWindowTreeNode()->SetOrdinalPosition(inputWindowPosition);
+ INFO_PRINTF1(_L("RWindowTreeNode::SetOrdinalPosition"));
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KInputWindowPosition());
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdWindowGroupId()
+ {
+ TInt actual = GetWindowTreeNode()->WindowGroupId();
+ INFO_PRINTF2(_L("RWindowTreeNode::WindowGroupId = %d"), actual);
+ SetIdentifier(actual);
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdSetPointerCursor(const TDesC& aSection)
+ {
+ TPointerCursorMode inputCursorNumber=EPointerCursorNormal;
+ if ( CT_GraphicsUtil::ReadPointerCursorMode(*this, aSection, KInputCursorNumber(), inputCursorNumber) )
+ {
+ TInt err=GetWindowTreeNode()->SetPointerCursor(inputCursorNumber);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("**** SetPointerCursor failed with error %d"), err);
+ SetError(err);
+ }
+
+ INFO_PRINTF1(_L("RWindowTreeNode::SetPointerCursor"));
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KInputCursorNumber());
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdSetCustomPointerCursorL(const TDesC& aSection)
+ {
+ TPtrC objectName;
+ if( GetStringFromConfig(aSection, KObjectName(), objectName) )
+ {
+ RWsSession* wsSession = static_cast<RWsSession*>(GetDataObjectL(objectName));
+ RWsPointerCursor pointerCursor(*wsSession);
+ User::LeaveIfError(pointerCursor.Construct(0));
+ CleanupClosePushL(pointerCursor);
+
+ INFO_PRINTF1(_L("RWindowTreeNode::SetCustomPointerCursor"));
+ GetWindowTreeNode()->SetCustomPointerCursor(pointerCursor);
+
+ CleanupStack::PopAndDestroy(&pointerCursor);
+ }
+ else
+ {
+ TPtrC pointerCursorName;
+
+ if( GetStringFromConfig(aSection, KFldPointerCursor(), pointerCursorName) )
+ {
+ RWsPointerCursor* pointerCursor = static_cast<RWsPointerCursor*>(GetDataObjectL(pointerCursorName));
+
+ INFO_PRINTF1(_L("RWindowTreeNode::SetCustomPointerCursor"));
+ GetWindowTreeNode()->SetCustomPointerCursor(*pointerCursor);
+ }
+
+ else
+ {
+ ERR_PRINTF3(_L("Missing parameter %S or %S"), &KFldPointerCursor(),&KObjectName());
+ SetBlockResult(EFail);
+ }
+ }
+
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdEnableOnEvents(const TDesC& aSection)
+ {
+ TEventControl eventControl=EEventControlOnlyWithKeyboardFocus;
+ CT_GraphicsUtil::ReadEventControl(*this, aSection, KInputEventControl(), eventControl);
+
+ INFO_PRINTF1(_L("RWindowTreeNode::EnableOnEvents"));
+ TInt err=GetWindowTreeNode()->EnableOnEvents(eventControl);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("**** EnableOnEvents failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdDisableOnEvents()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::DisableOnEvents"));
+ GetWindowTreeNode()->DisableOnEvents();
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdEnableGroupChangeEvents()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::EnableGroupChangeEvents"));
+ TInt err = GetWindowTreeNode()->EnableGroupChangeEvents();
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("**** EnableGroupChangeEvents failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdDisableGroupChangeEvents()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::DisableGroupChangeEvents"));
+ GetWindowTreeNode()->DisableGroupChangeEvents();
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdEnableFocusChangeEvents()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::EnableFocusChangeEvents"));
+ TInt err = GetWindowTreeNode()->EnableFocusChangeEvents();
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("**** EnableFocusChangeEvents failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdDisableFocusChangeEvents()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::DisableFocusChangeEvents"));
+ GetWindowTreeNode()->DisableFocusChangeEvents();
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdEnableGroupListChangeEvents()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::EnableGroupListChangeEvents"));
+ TInt err = GetWindowTreeNode()->EnableGroupListChangeEvents();
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("**** EnableGroupListChangeEvents failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdDisableGroupListChangeEvents()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::DisableGroupListChangeEvents"));
+ GetWindowTreeNode()->DisableGroupListChangeEvents();
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdEnableVisibilityChangeEvents()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::EnableVisibilityChangeEvents"));
+ TInt err = GetWindowTreeNode()->EnableVisibilityChangeEvents();
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("**** EnableVisibilityChangeEvents failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdDisableVisibilityChangeEvents()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::DisableVisibilityChangeEvents"));
+ GetWindowTreeNode()->DisableVisibilityChangeEvents();
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdEnableErrorMessages(const TDesC& aSection)
+ {
+ TEventControl eventControl=EEventControlOnlyWithKeyboardFocus;
+ CT_GraphicsUtil::ReadEventControl(*this, aSection, KInputEventControl(), eventControl);
+
+ INFO_PRINTF1(_L("RWindowTreeNode::EnableErrorMessages"));
+ TInt err=GetWindowTreeNode()->EnableErrorMessages(eventControl);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("**** EnableErrorMessages failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdDisableErrorMessages()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::DisableErrorMessages"));
+ GetWindowTreeNode()->DisableErrorMessages();
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdEnableModifierChangedEvents(const TDesC& aSection)
+ {
+ TEventModifier eventModifier = EModifierAutorepeatable;
+ CT_GraphicsUtil::ReadEventModifier(*this, aSection, KInputEventModifier(), eventModifier);
+
+ TEventControl eventControl = EEventControlOnlyWithKeyboardFocus;
+ CT_GraphicsUtil::ReadEventControl(*this, aSection, KInputEventControl(), eventControl);
+
+ INFO_PRINTF1(_L("RWindowTreeNode::EnableModifierChangedEvents"));
+ TInt err=GetWindowTreeNode()->EnableModifierChangedEvents(eventModifier, eventControl);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("**** EnableModifierChangedEvents failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdDisableModifierChangedEvents()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::DisableModifierChangedEvents"));
+ GetWindowTreeNode()->DisableModifierChangedEvents();
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdSetNonFading(const TDesC& aSection)
+ {
+ TBool inputNonFading=ETrue;
+ if( GetBoolFromConfig(aSection, KInputNonFading(), inputNonFading))
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::SetNonFading"));
+ GetWindowTreeNode()->SetNonFading(inputNonFading);
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KInputNonFading());
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdSetFaded(const TDesC& aSection)
+ {
+ TBool inputFaded=ETrue;
+ if( !GetBoolFromConfig(aSection, KInputFaded(), inputFaded))
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KInputFaded());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ RWindowTreeNode::TFadeControl fadeControl=RWindowTreeNode::EFadeIncludeChildren;
+ CT_GraphicsUtil::ReadFadeControl(*this, aSection, KInputFadeControl(), fadeControl);
+
+ TInt inputBlackMap=0;
+ TInt inputWhiteMap=255;
+ if( GetIntFromConfig(aSection, KInputBlackMap(), inputBlackMap) &&
+ GetIntFromConfig(aSection, KInputWhiteMap(), inputWhiteMap) )
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::SetFaded (Map Fading)"));
+ GetWindowTreeNode()->SetFaded(inputFaded, fadeControl, (TUint8) inputBlackMap, (TUint8) inputWhiteMap);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::SetFaded"));
+ GetWindowTreeNode()->SetFaded(inputFaded, fadeControl);
+ }
+ }
+ }
+
+
+void CT_DataWindowTreeNode::DoCmdClearPointerCursor()
+ {
+ INFO_PRINTF1(_L("RWindowTreeNode::ClearPointerCursor"));
+ GetWindowTreeNode()->ClearPointerCursor();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsBitmap.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,351 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsBitmap.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+_LIT(KDataClassname, "CWsBitmap");
+
+//Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructor, "~CWsBitmap");
+_LIT(KCmdDestructorGeneral, "~");
+_LIT(KCmdCreate, "Create");
+_LIT(KCmdDuplicate, "Duplicate");
+_LIT(KCmdLoad, "Load");
+_LIT(KCmdInternalizeL, "InternalizeL");
+_LIT(KCmdReset, "Reset");
+
+// Fields
+_LIT(KFldDispMode, "dispmode");
+_LIT(KFldFileName, "filename");
+_LIT(KFldHandle, "handle");
+_LIT(KFldHandle_Name, "handle_name");
+_LIT(KFldId, "id");
+_LIT(KFldShareIfLoaded, "shareifloaded");
+_LIT(KFldSizeInPixels, "sizeinpixels");
+_LIT(KFldUseClosedStream, "use_closed_stream");
+_LIT(KFldWs, "ws");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsBitmap* CT_DataWsBitmap::NewL()
+ {
+ CT_DataWsBitmap* ret=new (ELeave) CT_DataWsBitmap();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWsBitmap::CT_DataWsBitmap()
+: CT_DataFbsBitmap()
+, iWsBitmap(NULL)
+ {
+ }
+
+void CT_DataWsBitmap::ConstructL()
+ {
+ CT_DataFbsBitmap::ConstructL();
+ }
+
+CT_DataWsBitmap::~CT_DataWsBitmap()
+ {
+ DestroyData();
+ }
+
+void CT_DataWsBitmap::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWsBitmap = static_cast<CWsBitmap*> (aAny);
+ }
+
+void CT_DataWsBitmap::DestroyData()
+ {
+ delete iWsBitmap;
+ iWsBitmap=NULL;
+ }
+
+void CT_DataWsBitmap::DisownObjectL()
+ {
+ iWsBitmap = NULL;
+ }
+
+MWsClientClass* CT_DataWsBitmap::GetClientClass() const
+ {
+ return iWsBitmap;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsBitmap::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructor || aCommand==KCmdDestructorGeneral )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( aCommand==KCmdCreate )
+ {
+ DoCmdCreate(aSection);
+ }
+ else if ( aCommand==KCmdDuplicate )
+ {
+ DoCmdDuplicateL(aSection);
+ }
+ else if ( aCommand==KCmdLoad )
+ {
+ DoCmdLoad(aSection);
+ }
+ else if ( aCommand==KCmdInternalizeL )
+ {
+ DoCmdInternalizeL(aSection);
+ }
+ else if ( aCommand==KCmdReset )
+ {
+ DoCmdReset();
+ }
+ else if ( !CT_DataWsClientClass::DoCommandL(*this, aCommand, aSection, aAsyncErrorIndex) )
+ {
+ CT_DataFbsBitmap::SetObjectL(iWsBitmap);
+ ret = CT_DataFbsBitmap::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ CT_DataFbsBitmap::DisownObjectL();
+ }
+
+ return ret;
+ }
+
+
+void CT_DataWsBitmap::DoCmdnewL(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // Get test data for command input parameter(s)
+ TPtrC wsName;
+ RWsSession* ws=NULL;
+ if ( GetStringFromConfig(aSection, KFldWs, wsName) )
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(wsName));
+ }
+
+ TInt err=KErrNone;
+ if ( ws!=NULL )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new CWsBitmap(RWsSession)"));
+ TRAP( err, iWsBitmap = new (ELeave) CWsBitmap(*ws));
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new CWsBitmap()"));
+ TRAP( err, iWsBitmap = new (ELeave) CWsBitmap());
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWsBitmap::DoCmdDestructor()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute ~CWsBitmap()"));
+ delete iWsBitmap;
+ iWsBitmap=NULL;
+ }
+
+
+void CT_DataWsBitmap::DoCmdCreate(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TSize datSizeInPixels;
+ if ( !GetSizeFromConfig(aSection, KFldSizeInPixels, datSizeInPixels) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSizeInPixels);
+ SetBlockResult(EFail);
+ }
+
+ TDisplayMode datDispMode;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldDispMode, datDispMode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldDispMode);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Create(TSize, TDisplayMode)"));
+ TInt returnCode = iWsBitmap->Create (datSizeInPixels, datDispMode);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+ }
+ }
+
+
+void CT_DataWsBitmap::DoCmdDuplicateL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CFbsBitmap::Duplicate()"));
+ TInt handle=GetHandle();
+ TPtrC objectName;
+ if ( GetStringFromConfig(aSection, KFldHandle_Name(), objectName) )
+ {
+ CDataWrapperBase* wrapper=static_cast<CDataWrapperBase*>(GetDataWrapperL(objectName));
+ handle=wrapper->GetHandle();
+ }
+ else
+ {
+ GetIntFromConfig(aSection, KFldHandle(), handle);
+ }
+
+ // call Duplicate()
+ TInt err = iWsBitmap->Duplicate(handle);
+ if (err != KErrNone)
+ {
+ ERR_PRINTF2(_L("Duplicate error: %d"), err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWsBitmap::DoCmdLoad(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPtrC datFileName;
+ if ( !GetStringFromConfig(aSection, KFldFileName, datFileName) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFileName);
+ SetBlockResult(EFail);
+ }
+
+ TInt datId;
+ if ( !GetIntFromConfig(aSection, KFldId, datId) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldId);
+ SetBlockResult(EFail);
+ }
+
+ TBool datShareIfLoaded;
+ if ( !GetBoolFromConfig(aSection, KFldShareIfLoaded, datShareIfLoaded) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldShareIfLoaded);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Load(TDesC, TInt32, TBool)"));
+ TInt returnCode = iWsBitmap->Load(datFileName, datId, datShareIfLoaded);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+ }
+ }
+
+
+void CT_DataWsBitmap::DoCmdInternalizeL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TBool datUseClosedStream=EFalse;
+ GetBoolFromConfig(aSection, KFldUseClosedStream, datUseClosedStream);
+
+ TPtrC datFileName;
+ if ( !GetStringFromConfig(aSection, KFldFileName, datFileName) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldUseClosedStream);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CDirectFileStore* readstore = CDirectFileStore::OpenL(FileServer(), datFileName, EFileStream | EFileRead);
+ CleanupStack::PushL(readstore);
+ TInt popCount=1;
+
+ TStreamId headerid = readstore->Root();
+ RStoreReadStream readstrm;
+ if ( !datUseClosedStream )
+ {
+ readstrm.OpenL(*readstore, headerid);
+ CleanupClosePushL(readstrm);
+ popCount=2;
+ }
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute InternalizeL(RReadStream)"));
+ TRAPD(err, iWsBitmap->InternalizeL(readstrm));
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+
+ // Cleanup
+ CleanupStack::PopAndDestroy(popCount, readstore);
+ }
+ }
+
+
+void CT_DataWsBitmap::DoCmdReset()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Reset()"));
+ iWsBitmap->Reset();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsClientClass.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsClientClass.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdWsHandle, "WsHandle");
+
+// Fields
+_LIT(KFldExpected, "expected");
+_LIT(KFldExpectNot, "expectnot");
+
+/// Logging
+_LIT(KLogNotExpectedValueInt, "'%S' is not as expected=%d, actual=%d");
+_LIT(KLogAsExpectedValueInt, "actual value as '%S'=%d");
+/*@}*/
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsClientClass::DoCommandL(CDataWrapperBase& aDataWrapper, const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdWsHandle )
+ {
+ DoCmdWsHandle(aDataWrapper, aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+
+void CT_DataWsClientClass::DoCmdWsHandle(CDataWrapperBase& aDataWrapper, const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ aDataWrapper.INFO_PRINTF1(_L("execute WsHandle()"));
+ TInt actualResult = GetClientClass()->WsHandle();
+
+ // Diaplay command return value, check if it matches the expected value
+ TInt expnotResult;
+ if ( aDataWrapper.GetIntFromConfig(aSection, KFldExpectNot, expnotResult) )
+ {
+ if ( actualResult==expnotResult )
+ {
+ aDataWrapper.ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpectNot, expnotResult, actualResult);
+ aDataWrapper.SetBlockResult(EFail);
+ }
+ else
+ {
+ aDataWrapper.INFO_PRINTF3(KLogAsExpectedValueInt, &KFldExpectNot, actualResult);
+ }
+ }
+
+ TInt expectResult;
+ if ( aDataWrapper.GetIntFromConfig(aSection, KFldExpected, expectResult) )
+ {
+ if ( actualResult!=expectResult )
+ {
+ aDataWrapper.ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, expectResult, actualResult);
+ aDataWrapper.SetBlockResult(EFail);
+ }
+ else
+ {
+ aDataWrapper.INFO_PRINTF3(KLogAsExpectedValueInt, &KFldExpected, actualResult);
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsEvent.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,557 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsEvent.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdErrorMessage, "ErrorMessage");
+_LIT(KCmdEventData, "EventData");
+_LIT(KCmdHandle, "Handle");
+_LIT(KCmdInt, "Int");
+_LIT(KCmdKey, "Key");
+_LIT(KCmdModifiersChanged, "ModifiersChanged");
+_LIT(KCmdPointer, "Pointer");
+_LIT(KCmdSetHandle, "SetHandle");
+_LIT(KCmdSetTimeNow, "SetTimeNow");
+_LIT(KCmdSetType, "SetType");
+_LIT(KCmdTime, "Time");
+_LIT(KCmdType, "Type");
+_LIT(KCmdVisibilityChanged, "VisibilityChanged");
+
+/// Fields
+_LIT(KFldExpected, "expected");
+_LIT(KFldType, "type");
+_LIT(KFldError, "error");
+_LIT(KFldErrorCategory, "errorcategory");
+_LIT(KFldExpectedCategory, "expectedcategory");
+_LIT(KFldExpectedError, "expectederror");
+_LIT(KFldExpected_Code, "expected_code");
+_LIT(KFldExpected_ChangedModifier, "expected_changedmodifier");
+_LIT(KFldExpected_Modifier, "expected_modifier");
+_LIT(KFldExpected_Repeats, "expected_repeats");
+_LIT(KFldExpected_ScanCode, "expected_scancode");
+_LIT(KFldExpected_Type, "expected_type");
+_LIT(KFldExpected_Pos, "expected_pos");
+_LIT(KFldHandle, "handle");
+_LIT(KFldNew_Value, "new_value");
+_LIT(KFldUseConst, "useconst");
+
+/// Logging
+_LIT(KLogMissingParameter, "Missing parameter %S");
+_LIT(KLogMissingExpectedValue, "Missing expected value '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+_LIT(KLogNotExpectedValueInt, "'%S' is not as expected=%d, actual=%d");
+_LIT(KLogNotExpectedValueHex, "'%S' is not as expected=0x%x, actual=0x%x");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsEvent* CT_DataWsEvent::NewL()
+/**
+ * Two phase constructor
+ */
+ {
+ CT_DataWsEvent* ret=new (ELeave) CT_DataWsEvent();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWsEvent::CT_DataWsEvent()
+/**
+ * Protected constructor. First phase construction
+ */
+: CDataWrapperBase()
+, iWsEvent(NULL)
+ {
+ }
+
+void CT_DataWsEvent::ConstructL()
+/**
+ * Second phase construction
+ */
+ {
+ }
+
+CT_DataWsEvent::~CT_DataWsEvent()
+/**
+ * Public destructor
+ */
+ {
+ DestroyData();
+ }
+
+TAny* CT_DataWsEvent::GetObject()
+/**
+ * Return a pointer to the object that the data wraps
+ *
+ * @return pointer to the object that the data wraps
+ */
+ {
+ return iWsEvent;
+ }
+
+void CT_DataWsEvent::SetObjectL(TAny* aAny)
+/**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ {
+ DestroyData();
+ iWsEvent = static_cast<TWsEvent*> (aAny);
+ }
+
+void CT_DataWsEvent::DisownObjectL()
+/**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ {
+ iWsEvent = NULL;
+ }
+
+void CT_DataWsEvent::DestroyData()
+ {
+ delete iWsEvent;
+ iWsEvent=NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsEvent::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret = ETrue;
+ if ( aCommand==KCmdnew )
+ {
+ DoCmdnew();
+ }
+ else if ( aCommand==KCmdDestructor )
+ {
+ DestroyData();
+ }
+ else if ( aCommand==KCmdErrorMessage )
+ {
+ DoCmdErrorMessage(aSection);
+ }
+ else if ( aCommand==KCmdEventData )
+ {
+ DoCmdEventData(aSection);
+ }
+ else if ( aCommand==KCmdHandle )
+ {
+ DoCmdHandle(aSection);
+ }
+ else if ( aCommand==KCmdInt )
+ {
+ DoCmdInt(aSection);
+ }
+ else if ( aCommand==KCmdKey )
+ {
+ DoCmdKey(aSection);
+ }
+ else if ( aCommand==KCmdModifiersChanged )
+ {
+ DoCmdModifiersChanged(aSection);
+ }
+ else if ( aCommand==KCmdPointer )
+ {
+ DoCmdPointer(aSection);
+ }
+ else if ( aCommand==KCmdSetHandle )
+ {
+ DoCmdSetHandle(aSection);
+ }
+ else if ( aCommand==KCmdSetTimeNow )
+ {
+ DoCmdSetTimeNow();
+ }
+ else if ( aCommand==KCmdSetType )
+ {
+ DoCmdSetType(aSection);
+ }
+ else if ( aCommand==KCmdTime )
+ {
+ DoCmdTime();
+ }
+ else if ( aCommand==KCmdType )
+ {
+ DoCmdType(aSection);
+ }
+ else if ( aCommand==KCmdVisibilityChanged )
+ {
+ DoCmdVisibilityChanged(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+void CT_DataWsEvent::DoCmdnew()
+ {
+ INFO_PRINTF1(_L("new TWsEvent()"));
+ DestroyData();
+ TRAPD(err, iWsEvent = new (ELeave) TWsEvent());
+ if(err != KErrNone)
+ {
+ ERR_PRINTF2(_L("**** TWsEvent Constructor failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsEvent::DoCmdErrorMessage(const TDesC& aSection)
+ {
+ const TWsEvent* wsEvent=iWsEvent;
+ TWsErrorMessage* actual=wsEvent->ErrorMessage();
+ INFO_PRINTF3(_L("ErrorMessage: Category %d. Error %d"), actual->iErrorCategory, actual->iError);
+
+ TWsErrorMessage expected;
+ if ( CT_GraphicsUtil::ReadErrorCategory(*this, aSection, KFldExpectedCategory(), expected.iErrorCategory) )
+ {
+ if ( actual->iErrorCategory!=expected.iErrorCategory )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TWsErrorMessage::TErrorCategory expectedError;
+ if ( CT_GraphicsUtil::ReadErrorCategory(*this, aSection, KFldExpectedError(), expectedError) )
+ {
+ if ( actual->iErrorCategory!=expectedError )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ CT_GraphicsUtil::ReadErrorCategory(*this, aSection, KFldErrorCategory(), actual->iErrorCategory);
+
+ TInt error;
+ if ( GetIntFromConfig(aSection, KFldError(), error) )
+ {
+ actual->iError=(TUint)error;
+ }
+ }
+
+void CT_DataWsEvent::DoCmdEventData(const TDesC& aSection)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TUint8* actual=iWsEvent->EventData();
+ INFO_PRINTF2(_L("EventData: FirstByte %d"), *actual);
+
+ TInt index=0;
+ for ( index=0; index<TWsEvent::EWsEventDataSize; ++index )
+ {
+ TInt expected;
+ tempStore.Format(_L("%S%d"), &KFldExpected, index+1);
+ if ( GetIntFromConfig(aSection, tempStore, expected) )
+ {
+ if ( *(actual+index)!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+ for ( index=0; index<TWsEvent::EWsEventDataSize; ++index )
+ {
+ TInt actualInt;
+ tempStore.Format(_L("%S%d"), &KFldNew_Value, index+1);
+ if ( GetIntFromConfig(aSection, tempStore, actualInt) )
+ {
+ *(actual+index)=(TUint8)actualInt;
+ }
+ }
+ }
+
+void CT_DataWsEvent::DoCmdSetHandle(const TDesC& aSection)
+ {
+ TInt handle=0;
+ if ( !GetIntFromConfig(aSection, KFldHandle(), handle) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldHandle());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("TWsEvent::SetHandle"));
+ iWsEvent->SetHandle((TUint)handle);
+ }
+ }
+
+void CT_DataWsEvent::DoCmdHandle(const TDesC& aSection)
+ {
+ TUint actual=iWsEvent->Handle();
+ INFO_PRINTF2(_L("Handle() actual=%d"), actual);
+ SetHandle(actual);
+
+ TInt expected;
+ if ( !GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( expected!=(TInt)actual )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsEvent::DoCmdSetType(const TDesC& aSection)
+ {
+ TEventCode eventCode;
+ if ( !CT_GraphicsUtil::ReadEventCode(*this, aSection, KFldType(), eventCode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldType());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("SetType()"));
+ iWsEvent->SetType(eventCode);
+ }
+ }
+
+void CT_DataWsEvent::DoCmdType(const TDesC& aSection)
+ {
+ TInt actual=iWsEvent->Type();
+ INFO_PRINTF2(_L("Type() actual Type:%d"), actual);
+
+ TEventCode expected;
+ if ( !CT_GraphicsUtil::ReadEventCode(*this, aSection, KFldExpected(), expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsEvent::DoCmdVisibilityChanged(const TDesC& aSection)
+ {
+ const TWsVisibilityChangedEvent* actual=NULL;
+
+ TBool useConst=EFalse;
+ GetBoolFromConfig(aSection, KFldUseConst(), useConst);
+ if ( useConst )
+ {
+ INFO_PRINTF1(_L("const VisibilityChanged"));
+ const TWsEvent* wsEvent=iWsEvent;
+ actual=wsEvent->VisibilityChanged();
+ }
+ else
+ {
+ INFO_PRINTF1(_L("VisibilityChanged"));
+ TWsVisibilityChangedEvent* actualNonConst=iWsEvent->VisibilityChanged();
+ actual=actualNonConst;
+ }
+ INFO_PRINTF2(_L("VisibilityChanged:%d"), actual->iFlags);
+
+ TWsVisibilityChangedEvent expected;
+ if ( CT_GraphicsUtil::ReadWsVisibilityChangedEvent(*this, aSection, KFldExpected(), expected) )
+ {
+ if ( actual->iFlags!=expected.iFlags )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsEvent::DoCmdSetTimeNow()
+ {
+ INFO_PRINTF1(_L("SetTimeNow()"));
+ iWsEvent->SetTimeNow();
+ }
+
+void CT_DataWsEvent::DoCmdTime()
+ {
+ INFO_PRINTF1(_L("Time()"));
+ TTime eventTime=iWsEvent->Time();
+
+ TDateTime dateTime = eventTime.DateTime();
+ INFO_PRINTF4(_L("Time() returned %d/%d/%d"), dateTime.Year(), dateTime.Month(), dateTime.Day());
+ INFO_PRINTF5(_L("Time() returned %d:%d:%d.%d"), dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond());
+ }
+
+void CT_DataWsEvent::DoCmdInt(const TDesC& aSection)
+ {
+ TInt* actual=iWsEvent->Int();
+ INFO_PRINTF2(_L("Int:0x%x"), *actual);
+
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ if ( *actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ GetIntFromConfig(aSection, KFldNew_Value(), *actual);
+ }
+
+void CT_DataWsEvent::DoCmdKey(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Key()"));
+ TKeyEvent* eventKey=iWsEvent->Key();
+
+ TKeyCode keyCode;
+ if ( CT_GraphicsUtil::ReadKeyCode(*this, aSection, KFldExpected_Code, keyCode) )
+ {
+ if ( (TUint)keyCode != eventKey->iCode )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected_Code, keyCode, eventKey->iCode);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected_Code);
+ SetBlockResult(EFail);
+ }
+
+ TStdScanCode scanCode;
+ if ( CT_GraphicsUtil::ReadStdScanCode(*this, aSection, KFldExpected_ScanCode, scanCode) )
+ {
+ if ( scanCode != eventKey->iScanCode )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected_ScanCode, scanCode, eventKey->iScanCode);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TUint modifiers;
+ if ( CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldExpected_Modifier, modifiers) )
+ {
+ if ( modifiers != eventKey->iModifiers )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected_Modifier, modifiers, eventKey->iModifiers);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TInt repeats;
+ if ( GetIntFromConfig(aSection, KFldExpected_Repeats, repeats) )
+ {
+ if ( repeats != eventKey->iRepeats )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected_Repeats, repeats, eventKey->iRepeats);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsEvent::DoCmdModifiersChanged(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("ModifiersChanged()"));
+ TModifiersChangedEvent* event=iWsEvent->ModifiersChanged();
+ INFO_PRINTF3(_L("TModifiersChangedEvent: iChangedModifiers=0x%x iModifiers=0x%x"), event->iChangedModifiers, event->iModifiers);
+
+ TUint changedModifiers;
+ if ( CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldExpected_ChangedModifier, changedModifiers) )
+ {
+ if ( changedModifiers!=event->iChangedModifiers )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueHex, &KFldExpected_Modifier, changedModifiers, event->iChangedModifiers);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TUint modifiers;
+ if ( CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldExpected_Modifier, modifiers) )
+ {
+ if ( modifiers!=(event->iModifiers&event->iChangedModifiers) )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueHex, &KFldExpected_Modifier, modifiers, event->iModifiers);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsEvent::DoCmdPointer(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Pointer()"));
+ TPointerEvent* actual=iWsEvent->Pointer();
+ INFO_PRINTF2(_L("iType =%d"), actual->iType);
+ INFO_PRINTF2(_L("iModifiers =0x%x"), actual->iModifiers);
+ INFO_PRINTF3(_L("iPosition =(%d,%d)"), actual->iPosition.iX, actual->iPosition.iY);
+ INFO_PRINTF3(_L("iParentPosition =(%d,%d)"), actual->iParentPosition.iX, actual->iParentPosition.iY);
+
+ TPointerEvent::TType expectedType;
+ if ( CT_GraphicsUtil::ReadType(*this, aSection, KFldExpected_Type, expectedType) )
+ {
+ if ( actual->iType!=expectedType )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueHex, &KFldExpected_Type, expectedType, actual->iType);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TUint modifiers;
+ if ( CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldExpected_Modifier, modifiers) )
+ {
+ if ( modifiers!=(actual->iModifiers&actual->iType) )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueHex, &KFldExpected_Modifier, modifiers, actual->iModifiers);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TPoint position;
+ if ( GetPointFromConfig(aSection, KFldExpected_Pos, position) )
+ {
+ if ( position!=actual->iPosition )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsGraphic.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,251 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsGraphic.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdDestructor, "~CWsGraphic");
+_LIT(KCmdDestroy, "Destroy");
+_LIT(KCmdId, "Id");
+_LIT(KCmdIsActive, "IsActive");
+_LIT(KCmdShare, "Share");
+_LIT(KCmdShareGlobally, "ShareGlobally");
+_LIT(KCmdUnShare, "UnShare");
+_LIT(KCmdUnShareGlobally, "UnShareGlobally");
+
+/// Fields
+_LIT(KFldClientId, "clientid");
+_LIT(KFldExpected, "expected");
+_LIT(KFldExpectNot, "expectnot");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsGraphic::CT_DataWsGraphic()
+: CDataWrapperBase()
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsGraphic::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructor )
+ {
+ DoCmdDestructorL();
+ }
+ else if ( aCommand==KCmdDestroy )
+ {
+ DoCmdDestroy();
+ }
+ else if ( aCommand==KCmdId )
+ {
+ DoCmdIdL(aSection);
+ }
+ else if ( aCommand==KCmdIsActive )
+ {
+ DoCmdIsActive(aSection);
+ }
+ else if ( aCommand==KCmdShare )
+ {
+ DoCmdShare(aSection);
+ }
+ else if ( aCommand==KCmdShareGlobally )
+ {
+ DoCmdShareGlobally();
+ }
+ else if ( aCommand==KCmdUnShare )
+ {
+ DoCmdUnShare(aSection);
+ }
+ else if ( aCommand==KCmdUnShareGlobally )
+ {
+ DoCmdUnShareGlobally();
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+void CT_DataWsGraphic::DoCmdDestructorL()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute ~CWsGraphic()"));
+ CWsGraphic* graphic=GetWsGraphic();
+ CleanupStack::PushL(graphic);
+ DisownObjectL();
+ CleanupStack::PopAndDestroy(graphic);
+ }
+
+void CT_DataWsGraphic::DoCmdDestroy()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Destroy()"));
+ GetWsGraphic()->Destroy();
+ }
+
+void CT_DataWsGraphic::DoCmdIdL(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Id()"));
+ const TWsGraphicId& actual=GetWsGraphic()->Id();
+ SetId(actual);
+ INFO_PRINTF3(_L("GetWsGraphic() Uid=0x%x Id=0x%x"), actual.Uid().iUid, actual.Id());
+
+ // Diaplay command return value, check if it matches the expected value
+ TWsGraphicId expected(0);
+ if ( GetWsGraphicIdFromConfigL(aSection, KFldExpectNot, expected) )
+ {
+ if ( actual.Id()==expected.Uid().iUid )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ if ( !GetWsGraphicIdFromConfigL(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpectNot);
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual.Uid()!=expected.Uid() )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataWsGraphic::DoCmdIsActive(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ TBool actual=GetWsGraphic()->IsActive();
+ INFO_PRINTF2(_L("execute IsActive()=%d"), actual);
+
+ // Diaplay command return value, check if it matches the expected value
+ TBool expected;
+ if ( !GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsGraphic::DoCmdShare(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt datId;
+
+ if ( !GetIntFromConfig(aSection, KFldClientId, datId) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldClientId());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ _LIT_SECURE_ID(datClientId, datId);
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Share(TSecureId)"));
+ TInt err=Share(datClientId);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataWsGraphic::DoCmdShareGlobally()
+ {
+ INFO_PRINTF1(_L("execute ShareGlobally()"));
+ TInt err=ShareGlobally();
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsGraphic::DoCmdUnShare(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt datId;
+
+ if ( !GetIntFromConfig(aSection, KFldClientId, datId) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldClientId());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ _LIT_SECURE_ID(datClientId, datId);
+
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute UnShare(TSecureId)"));
+ TInt err=UnShare(datClientId);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataWsGraphic::DoCmdUnShareGlobally()
+ {
+ INFO_PRINTF1(_L("execute UnShareGlobally()"));
+ TInt err=UnShareGlobally();
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsGraphicAnimation.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,262 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsGraphicAnimation.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdIsPaused, "IsPaused");
+_LIT(KCmdIsPlaying, "IsPlaying");
+_LIT(KCmdIsStopped, "IsStopped");
+_LIT(KCmdIsStopping, "IsStopping");
+_LIT(KCmdLoops, "Loops");
+_LIT(KCmdPause, "Pause");
+_LIT(KCmdPlay, "Play");
+_LIT(KCmdStop, "Stop");
+
+/// Fields
+_LIT(KFldExpected, "expected");
+_LIT(KFldLoop, "loop");
+_LIT(KFldImmediately, "immediately");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsGraphicAnimation::CT_DataWsGraphicAnimation()
+: CT_DataWsGraphicMsgFixedBase()
+, iWsGraphicAnimation(NULL)
+ {
+ }
+
+CT_DataWsGraphicAnimation::~CT_DataWsGraphicAnimation()
+ {
+ DestroyData();
+ }
+
+void CT_DataWsGraphicAnimation::DestroyData()
+ {
+ delete iWsGraphicAnimation;
+ iWsGraphicAnimation=NULL;
+ }
+
+/**
+ * Return a pointer to the object that the data wraps
+ *
+ * @return pointer to the object that the data wraps
+ */
+TAny* CT_DataWsGraphicAnimation::GetObject()
+ {
+ return iWsGraphicAnimation;
+ }
+
+TWsGraphicMsgFixedBase* CT_DataWsGraphicAnimation::GetWsGraphicMsgFixedBase() const
+ {
+ return iWsGraphicAnimation;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsGraphicAnimation::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret=ETrue;
+
+ if ( aCommand==KCmdnew )
+ {
+ DoCmdnew();
+ }
+ else if ( aCommand==KCmdIsPaused )
+ {
+ DoCmdIsPaused(aSection);
+ }
+ else if ( aCommand==KCmdIsPlaying )
+ {
+ DoCmdIsPlaying(aSection);
+ }
+ else if ( aCommand==KCmdIsStopped )
+ {
+ DoCmdIsStopped(aSection);
+ }
+ else if ( aCommand==KCmdIsStopping )
+ {
+ DoCmdIsStopping(aSection);
+ }
+ else if ( aCommand==KCmdLoops )
+ {
+ DoCmdLoops(aSection);
+ }
+ else if ( aCommand==KCmdPause )
+ {
+ DoCmdPause();
+ }
+ else if ( aCommand==KCmdPlay )
+ {
+ DoCmdPlay(aSection);
+ }
+ else if ( aCommand==KCmdStop )
+ {
+ DoCmdStop(aSection);
+ }
+ else
+ {
+ ret=CT_DataWsGraphicMsgFixedBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+void CT_DataWsGraphicAnimation::DoCmdnew()
+ {
+ INFO_PRINTF1(_L("execute new"));
+ DestroyData();
+ TRAPD(err, iWsGraphicAnimation=new (ELeave) TWsGraphicAnimation());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsGraphicAnimation::DoCmdIsPaused(const TDesC& aSection)
+ {
+ TBool actual=iWsGraphicAnimation->IsPaused();
+ INFO_PRINTF2(_L("execute IsPaused() = %d"), actual);
+
+ TBool expected;
+ if ( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( expected!=actual )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsGraphicAnimation::DoCmdIsPlaying(const TDesC& aSection)
+ {
+ TBool actual=iWsGraphicAnimation->IsPlaying();
+ INFO_PRINTF2(_L("execute IsPlaying() = %d"), actual);
+
+ TBool expected;
+ if ( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( expected!=actual )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsGraphicAnimation::DoCmdIsStopped(const TDesC& aSection)
+ {
+ TBool actual=iWsGraphicAnimation->IsStopped();
+ INFO_PRINTF2(_L("execute IsStopped() = %d"), actual);
+
+ TBool expected;
+ if ( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( expected!=actual )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsGraphicAnimation::DoCmdIsStopping(const TDesC& aSection)
+ {
+ TBool actual=iWsGraphicAnimation->IsStopping();
+ INFO_PRINTF2(_L("execute IsStopping() = %d"), actual);
+
+ TBool expected;
+ if ( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( expected!=actual )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsGraphicAnimation::DoCmdLoops(const TDesC& aSection)
+ {
+ TBool actual=iWsGraphicAnimation->Loops();
+ INFO_PRINTF2(_L("execute Loops() = %d"), actual);
+
+ TBool expected;
+ if ( GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( expected!=actual )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsGraphicAnimation::DoCmdPause()
+ {
+ iWsGraphicAnimation->Pause();
+ INFO_PRINTF1(_L("execute Pause()"));
+ }
+
+void CT_DataWsGraphicAnimation::DoCmdPlay(const TDesC& aSection)
+ {
+ TBool loop;
+ if ( !GetBoolFromConfig(aSection, KFldLoop, loop) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldLoop());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iWsGraphicAnimation->Play(loop);
+ INFO_PRINTF1(_L("execute Play(TBool)"));
+ }
+ }
+
+void CT_DataWsGraphicAnimation::DoCmdStop(const TDesC& aSection)
+ {
+ TBool immediately;
+ if ( !GetBoolFromConfig(aSection, KFldImmediately, immediately) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldImmediately());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iWsGraphicAnimation->Stop(immediately);
+ INFO_PRINTF1(_L("execute Stop(TBool)"));
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsGraphicBitmap.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsGraphicBitmap.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdNewL, "NewL");
+_LIT(KCmdDestructor, "~CWsGraphicBitmap");
+_LIT(KCmdDestructorGeneral, "~");
+
+/// Fields
+_LIT(KFldBitmap, "bitmap");
+_LIT(KFldMask, "mask");
+_LIT(KFldReplace, "replace");
+_LIT(KFldUid, "uid");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsGraphicBitmap* CT_DataWsGraphicBitmap::NewL()
+ {
+ CT_DataWsGraphicBitmap* ret=new (ELeave) CT_DataWsGraphicBitmap();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWsGraphicBitmap::CT_DataWsGraphicBitmap()
+: CT_DataWsGraphic()
+, iWsGraphicBitmap(NULL)
+ {
+ }
+
+void CT_DataWsGraphicBitmap::ConstructL()
+ {
+ }
+
+CT_DataWsGraphicBitmap::~CT_DataWsGraphicBitmap()
+ {
+ DestroyData();
+ }
+
+void CT_DataWsGraphicBitmap::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWsGraphicBitmap = static_cast<CWsGraphicBitmap*> (aAny);
+ }
+
+void CT_DataWsGraphicBitmap::DisownObjectL()
+ {
+ iWsGraphicBitmap = NULL;
+ }
+
+void CT_DataWsGraphicBitmap::DestroyData()
+ {
+ delete iWsGraphicBitmap;
+ iWsGraphicBitmap=NULL;
+ }
+
+// CT_DataWsGraphic Implementation
+CWsGraphic* CT_DataWsGraphicBitmap::GetWsGraphic() const
+ {
+ return iWsGraphicBitmap;
+ }
+
+TInt CT_DataWsGraphicBitmap::Share(TSecureId aClientId)
+ {
+ return iWsGraphicBitmap->Share(aClientId);
+ }
+
+TInt CT_DataWsGraphicBitmap::ShareGlobally()
+ {
+ return iWsGraphicBitmap->ShareGlobally();
+ }
+
+TInt CT_DataWsGraphicBitmap::UnShare(TSecureId aClientId)
+ {
+ return iWsGraphicBitmap->UnShare(aClientId);
+ }
+
+TInt CT_DataWsGraphicBitmap::UnShareGlobally()
+ {
+ return iWsGraphicBitmap->UnShareGlobally();
+ }
+
+/**
+ * Process a command read from the ini file
+ *
+ * @param aCommand the command to process
+ * @param aSection the entry in the ini file requiring the command to be processed
+ * @param aAsyncErrorIndex index of command. used for async calls
+ *
+ * @return ETrue if the command is processed
+ */
+TBool CT_DataWsGraphicBitmap::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructor || aCommand==KCmdDestructorGeneral )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdNewL )
+ {
+ DoCmdNewL(aSection);
+ }
+ else
+ {
+ ret=CT_DataWsGraphic::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+void CT_DataWsGraphicBitmap::DoCmdNewL(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // Get test data for command input parameter(s)
+ CFbsBitmap* bitmap = NULL;
+ CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap);
+
+ CFbsBitmap* mask = NULL;
+ CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldMask, mask);
+
+ TInt err=KErrNone;
+
+ TInt datUid;
+ if ( GetIntFromConfig(aSection, KFldUid, datUid) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute NewL(TUid , CFbsBitmap*, CFbsBitmap*)"));
+ TRAP(err, iWsGraphicBitmap = CWsGraphicBitmap::NewL(TUid::Uid(datUid), bitmap, mask));
+ }
+ else
+ {
+ TWsGraphicId datReplace(TWsGraphicId::EUninitialized);
+ if ( GetWsGraphicIdFromConfigL(aSection, KFldReplace, datReplace) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute NewL(TWsGraphicId , CFbsBitmap*, CFbsBitmap*)"));
+ TRAP(err, iWsGraphicBitmap = CWsGraphicBitmap::NewL(datReplace, bitmap, mask));
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute NewL(CFbsBitmap*, CFbsBitmap*)"));
+ TRAP(err, iWsGraphicBitmap = CWsGraphicBitmap::NewL(bitmap, mask));
+ }
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsGraphicBitmap::DoCmdDestructor()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute ~CWsGraphicBitmap()"));
+ DestroyData();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsGraphicBitmapAnimation.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,303 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_GraphicsUtil.h"
+#include "T_DataWsGraphicBitmapAnimation.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdNew, "NewL");
+_LIT(KCmdDestroy, "~");
+_LIT(KCmdUtil_StartAnimTesterClientL, "Util_StartAnimTesterClientL");
+_LIT(KCmdUtil_CloseAnimTesterClientL, "Util_CloseAnimTesterClientL");
+
+// Fields
+_LIT(KFldFrameCount, "framescount");
+_LIT(KFldTFrame, "frame%d");
+_LIT(KFldUid, "uid");
+_LIT(KFldReplace, "replace");
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+
+_LIT(KLogNew, "execute CWsGraphicBitmapAnimation::NewL(const TFrames &aFrames)");
+_LIT(KLogNew2, "execute CWsGraphicBitmapAnimation::NewL(TUid aUid, const TFrames &aFrames)");
+_LIT(KLogNew3, "execute CWsGraphicBitmapAnimation::NewL(const TWsGraphicId &aReplace, const TFrames &aFrames)");
+_LIT(KLogUtil_StartAnimTesterClientL, "execute CWsGraphicBitmapAnimation::Util_StartAnimTesterClientL(const TDesC& aSection)");
+_LIT(KLogUtil_CloseAnimTesterClientL, "execute CWsGraphicBitmapAnimation::Util_CloseAnimTesterClientL()");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsGraphicBitmapAnimation::CT_DataWsGraphicBitmapAnimation()
+: CT_DataWsGraphic(),iWsGraphicBitmapAnimation(NULL)
+ {
+ }
+
+CT_DataWsGraphicBitmapAnimation* CT_DataWsGraphicBitmapAnimation::NewL()
+ {
+ CT_DataWsGraphicBitmapAnimation* ret=new (ELeave) CT_DataWsGraphicBitmapAnimation();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+void CT_DataWsGraphicBitmapAnimation::ConstructL()
+ {
+ }
+
+CT_DataWsGraphicBitmapAnimation::~CT_DataWsGraphicBitmapAnimation()
+ {
+ DoCmdDestroy();
+ }
+
+/**
+ * Called by TEF framework to set object.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsGraphicBitmapAnimation::SetObjectL(TAny* aAny)
+ {
+ DoCmdDestroy();
+ iWsGraphicBitmapAnimation = static_cast<CWsGraphicBitmapAnimation*> (aAny);
+ }
+
+/**
+ * Called by TEF framework to disown the object.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsGraphicBitmapAnimation::DisownObjectL()
+ {
+ iWsGraphicBitmapAnimation = NULL;
+ }
+
+/**
+ * Destroy the object which has been constructed.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsGraphicBitmapAnimation::DoCmdDestroy()
+ {
+ delete iWsGraphicBitmapAnimation;
+ iWsGraphicBitmapAnimation = NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsGraphicBitmapAnimation::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdNew )
+ {
+ DoCmdNewL(aSection);
+ }
+ else if ( aCommand==KCmdDestroy )
+ {
+ DoCmdDestroy();
+ }
+ else if ( aCommand==KCmdUtil_StartAnimTesterClientL )
+ {
+ Util_StartAnimTesterClientL(aSection);
+ }
+ else if ( aCommand==KCmdUtil_CloseAnimTesterClientL )
+ {
+ Util_CloseAnimTesterClientL(aSection);
+ }
+ else
+ {
+ ret=CT_DataWsGraphic::DoCommandL(aCommand,aSection,aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+/**
+ * Process new command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataWsGraphicBitmapAnimation::DoCmdNewL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ RPointerArray<CWsGraphicBitmapAnimation::CFrame> frames;
+
+ //CWsGraphicBitmapAnimation::TFrames frames;
+ TInt nFrameCount=0;
+
+ if(!GetIntFromConfig(aSection,KFldFrameCount,nFrameCount))
+ {
+ ERR_PRINTF2(KLogMissingParameter,KFldFrameCount);
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+ else
+ {
+ RBuf info;
+ info.Create(256);
+ TPtrC framename;
+ for(TInt i=0;i<nFrameCount;i++)
+ {
+ info.Format(KFldTFrame,i+1);
+
+ if(!GetStringFromConfig(aSection,info, framename))
+ {
+ ERR_PRINTF2(KLogMissingParameter,info.Ptr());
+ SetBlockResult(EFail);
+ dataOk=EFalse;
+ }
+ else
+ {
+ frames.Append(static_cast<CWsGraphicBitmapAnimation::CFrame*>(GetDataObjectL(framename)));
+ }
+ }
+ info.Close();
+ }
+
+ TInt err=KErrNone;
+
+ if ( dataOk )
+ {
+ TInt ndata;
+ TWsGraphicId datReplace(TWsGraphicId::EUninitialized);
+ if(GetIntFromConfig(aSection,KFldUid,ndata))
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogNew2);
+ TRAP( err, iWsGraphicBitmapAnimation=CWsGraphicBitmapAnimation::NewL(TUid::Uid(ndata),frames.Array()));
+ }
+ else if(GetWsGraphicIdFromConfigL(aSection, KFldReplace, datReplace))
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogNew3);
+ TRAP( err, iWsGraphicBitmapAnimation=CWsGraphicBitmapAnimation::NewL(datReplace,frames.Array()));
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogNew);
+ TRAP( err, iWsGraphicBitmapAnimation=CWsGraphicBitmapAnimation::NewL(frames.Array()));
+ }
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ // No command return value and output parameter to display and check
+ }
+
+/**
+ * Process Util_StartAnimTesterClientL command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataWsGraphicBitmapAnimation::Util_StartAnimTesterClientL(const TDesC& aSection)
+ {
+ TInt dataOK;
+ TRAPD( err, dataOK = CT_GraphicsUtil::StartAnimTesterClientL(*this, aSection) );
+ if( dataOK )
+ {
+ if ( KErrNone == err )
+ {
+ INFO_PRINTF1(KLogUtil_StartAnimTesterClientL);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, KLogUtil_StartAnimTesterClientL);
+ }
+ }
+
+/**
+ * Process Util_CloseAnimTesterClientL command
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsGraphicBitmapAnimation::Util_CloseAnimTesterClientL(const TDesC& aSection)
+ {
+ TInt dataOK;
+ TRAPD( err, dataOK = CT_GraphicsUtil::CloseAnimTesterClientL(*this, aSection) );
+ if( dataOK )
+ {
+ if ( KErrNone == err )
+ {
+ INFO_PRINTF1(KLogUtil_CloseAnimTesterClientL);
+ }
+ else
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingParameter, KLogUtil_CloseAnimTesterClientL);
+ }
+ }
+
+
+TInt CT_DataWsGraphicBitmapAnimation::ShareGlobally()
+ {
+ return iWsGraphicBitmapAnimation->ShareGlobally();
+ }
+
+TInt CT_DataWsGraphicBitmapAnimation::UnShareGlobally()
+ {
+ return iWsGraphicBitmapAnimation->UnShareGlobally();
+ }
+
+
+ TInt CT_DataWsGraphicBitmapAnimation::Share(TSecureId aClientId)
+ {
+ return iWsGraphicBitmapAnimation->Share(aClientId);
+ }
+
+
+ TInt CT_DataWsGraphicBitmapAnimation::UnShare(TSecureId aClientId)
+ {
+ return iWsGraphicBitmapAnimation->UnShare(aClientId);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsGraphicFrameRate.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsGraphicFrameRate.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdnew, "new");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsGraphicFrameRate::CT_DataWsGraphicFrameRate()
+: CT_DataWsGraphicMsgFixedBase()
+, iWsGraphicFrameRate(NULL)
+ {
+ }
+
+CT_DataWsGraphicFrameRate::~CT_DataWsGraphicFrameRate()
+ {
+ DestroyData();
+ }
+
+void CT_DataWsGraphicFrameRate::DestroyData()
+ {
+ delete iWsGraphicFrameRate;
+ iWsGraphicFrameRate=NULL;
+ }
+
+/**
+ * Return a pointer to the object that the data wraps
+ *
+ * @return pointer to the object that the data wraps
+ */
+TAny* CT_DataWsGraphicFrameRate::GetObject()
+ {
+ return iWsGraphicFrameRate;
+ }
+
+TWsGraphicMsgFixedBase* CT_DataWsGraphicFrameRate::GetWsGraphicMsgFixedBase() const
+ {
+ return iWsGraphicFrameRate;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsGraphicFrameRate::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret=ETrue;
+
+ if ( aCommand==KCmdnew )
+ {
+ DoCmdnew();
+ }
+ else
+ {
+ ret=CT_DataWsGraphicMsgFixedBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+void CT_DataWsGraphicFrameRate::DoCmdnew()
+ {
+ INFO_PRINTF1(_L("execute new"));
+ DestroyData();
+ TRAPD(err, iWsGraphicFrameRate=new (ELeave) TWsGraphicFrameRate());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsGraphicMsgBuf.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,381 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsGraphicMsgBuf.h"
+
+/*@{*/
+//Parameters
+_LIT(KExpected, "expected");
+_LIT(KInputTypeId, "inputTypeId");
+_LIT(KInputText, "inputText");
+_LIT(KInputUseText8, "inputUseText8");
+_LIT(KInputMsgLen, "inputMsgLen");
+_LIT(KInputMsgPosition, "inputMsgPosition");
+_LIT(KInputFormat, "inputFormat");
+
+//Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdClose, "Close");
+_LIT(KCmdCleanupClosePushL, "CleanupClosePushL");
+_LIT(KCmdAppend, "Append");
+_LIT(KCmdRemove, "Remove");
+_LIT(KCmdCount, "Count");
+_LIT(KCmdTypeId, "TypeId");
+_LIT(KCmdData, "Data");
+_LIT(KCmdGetFixedMsg, "GetFixedMsg");
+_LIT(KCmdPckg, "Pckg");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsGraphicMsgBuf* CT_DataWsGraphicMsgBuf::NewL()
+ {
+ CT_DataWsGraphicMsgBuf* ret=new (ELeave) CT_DataWsGraphicMsgBuf();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWsGraphicMsgBuf::CT_DataWsGraphicMsgBuf()
+: CDataWrapperBase()
+, iWsGraphicMsgBuf(NULL)
+ {
+ }
+
+void CT_DataWsGraphicMsgBuf::ConstructL()
+ {
+ }
+
+CT_DataWsGraphicMsgBuf::~CT_DataWsGraphicMsgBuf()
+ {
+ DestroyData();
+ }
+
+void CT_DataWsGraphicMsgBuf::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWsGraphicMsgBuf = static_cast<RWsGraphicMsgBuf*> (aAny);
+ }
+
+void CT_DataWsGraphicMsgBuf::DisownObjectL()
+ {
+ iWsGraphicMsgBuf = NULL;
+ }
+
+void CT_DataWsGraphicMsgBuf::DestroyData()
+ {
+ delete iWsGraphicMsgBuf;
+ iWsGraphicMsgBuf=NULL;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsGraphicMsgBuf::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdnew )
+ {
+ DoCmdnew();
+ }
+ else if ( aCommand==KCmdClose )
+ {
+ DoCmdClose();
+ }
+ else if ( aCommand==KCmdCleanupClosePushL )
+ {
+ DoCmdCleanupClosePushL();
+ }
+ else if ( aCommand==KCmdAppend )
+ {
+ DoCmdAppendL(aSection);
+ }
+ else if ( aCommand==KCmdRemove )
+ {
+ DoCmdRemove(aSection);
+ }
+ else if ( aCommand==KCmdCount )
+ {
+ DoCmdCount(aSection);
+ }
+ else if ( aCommand==KCmdTypeId )
+ {
+ DoCmdTypeId(aSection);
+ }
+ else if ( aCommand==KCmdData )
+ {
+ DoCmdDataL(aSection);
+ }
+ else if( aCommand==KCmdGetFixedMsg)
+ {
+ DoCmdGetFixedMsg(aSection);
+ }
+ else if ( aCommand==KCmdPckg )
+ {
+ DoCmdPckg();
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+
+void CT_DataWsGraphicMsgBuf::DoCmdnew()
+ {
+ DestroyData();
+
+ TRAPD(err, iWsGraphicMsgBuf = new (ELeave) RWsGraphicMsgBuf());
+ if(err != KErrNone)
+ {
+ ERR_PRINTF2(_L("**** RWsGraphicMsgBuf Constructor failed with error %d"), err);
+ SetError(err);
+ }
+
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::RWsGraphicMsgBuf"));
+ }
+
+void CT_DataWsGraphicMsgBuf::DoCmdClose()
+ {
+ iWsGraphicMsgBuf->Close();
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::Close"));
+ }
+
+void CT_DataWsGraphicMsgBuf::DoCmdCleanupClosePushL()
+ {
+ iWsGraphicMsgBuf->CleanupClosePushL();
+ CleanupStack::PopAndDestroy(iWsGraphicMsgBuf);
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::CleanupClosePushL"));
+ }
+
+void CT_DataWsGraphicMsgBuf::DoCmdAppendL(const TDesC& aSection)
+ {
+ TInt err=KErrNone;
+ TInt inputTypeId=0;
+ if( GetIntFromConfig(aSection, KInputTypeId(), inputTypeId))
+ {
+ TUid uid = TUid::Uid(inputTypeId);
+ TPtrC inputStr;
+ if( !GetStringFromConfig(aSection, KInputText(), inputStr) )
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KInputText());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TBool useBuf8=EFalse;
+ GetBoolFromConfig(aSection, KInputUseText8(), useBuf8);
+ if ( useBuf8 )
+ {
+ TInt inputMsgLen=0;
+ HBufC8* tempStr = HBufC8::NewLC(inputStr.Length());
+ tempStr->Des().Copy(inputStr);
+ if( GetIntFromConfig(aSection, KInputMsgLen(), inputMsgLen))
+ {
+ // Test iWsGraphicMsgBuf->Append(TUid aTypeId, TInt aLen, TPtr8 &aPtr);
+ TPtr8 tempInputStr(tempStr->Des());
+ err = iWsGraphicMsgBuf->Append(uid, inputMsgLen, tempInputStr);
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::Append (TPtr8)"));
+ }
+ else
+ {
+ // Test iWsGraphicMsgBuf->Append(TUid aTypeId, const TDesC8 &aData);
+ err = iWsGraphicMsgBuf->Append(uid, *tempStr);
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::Append (TDesC8)"));
+ }
+ CleanupStack::PopAndDestroy(tempStr);
+ }
+ else
+ {
+ // Test iWsGraphicMsgBuf->Append(TUid aTypeId, const TDesC16 &aData);
+ err = iWsGraphicMsgBuf->Append(uid, inputStr);
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::Append (TDesC16)"));
+ }
+ }
+ }
+ else
+ {
+ TWsGraphicFrameRate frameRate;
+ err = iWsGraphicMsgBuf->Append(frameRate);
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::Append (TWsGraphicMsgFixedBase)"));
+ }
+
+ if(err != KErrNone)
+ {
+ ERR_PRINTF2(_L("**** Append failed with error %d"), err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsGraphicMsgBuf::DoCmdRemove(const TDesC& aSection)
+ {
+ TInt inputMsgPosition=0;
+ if( GetIntFromConfig(aSection, KInputMsgPosition(), inputMsgPosition))
+ {
+ iWsGraphicMsgBuf->Remove(inputMsgPosition);
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::Remove"));
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KInputMsgPosition());
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataWsGraphicMsgBuf::DoCmdCount(const TDesC& aSection)
+ {
+ TInt actual = iWsGraphicMsgBuf->Count();
+ INFO_PRINTF2(_L("RWsGraphicMsgBuf::Count = %d"), actual);
+
+ TInt expected = 0;
+ if( GetIntFromConfig(aSection, KExpected(), expected))
+ {
+ if( actual != expected )
+ {
+ ERR_PRINTF1(_L("Count is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KExpected());
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataWsGraphicMsgBuf::DoCmdTypeId(const TDesC& aSection)
+ {
+ TInt inputMsgPosition=0;
+ if( GetIntFromConfig(aSection, KInputMsgPosition(), inputMsgPosition))
+ {
+ TUid actual = iWsGraphicMsgBuf->TypeId(inputMsgPosition);
+ INFO_PRINTF2(_L("RWsGraphicMsgBuf::TypeId = %d"), actual.iUid);
+
+ TInt expected = 0;
+ if( GetIntFromConfig(aSection, KExpected(), expected))
+ {
+ TUid expectedUid = TUid::Uid(expected);
+
+ if( actual != expectedUid )
+ {
+ ERR_PRINTF1(_L("TypeId is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KExpected());
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KInputMsgPosition());
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataWsGraphicMsgBuf::DoCmdDataL(const TDesC& aSection)
+ {
+ TInt inputMsgPosition=0;
+ if( !GetIntFromConfig(aSection, KInputMsgPosition(), inputMsgPosition) )
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KInputMsgPosition());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TPtrC format;
+ if( GetStringFromConfig(aSection, KInputFormat(), format) )
+ {
+ // Test modifiable Data
+ TPtr8 actual=iWsGraphicMsgBuf->Data(inputMsgPosition);
+ HBufC* buffer=HBufC::NewLC(actual.Length());
+ TPtr bufferPtr=buffer->Des();
+
+ bufferPtr.Copy(actual);
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::Data ="));
+ INFO_PRINTF1(bufferPtr);
+ bufferPtr.Format(format, &bufferPtr);
+ actual.Copy(bufferPtr);
+ CleanupStack::PopAndDestroy(buffer);
+ }
+ else
+ {
+ // Test non-modifiable Data
+ const RWsGraphicMsgBuf* wsGraphicMsgBuf=iWsGraphicMsgBuf;
+ TPtrC8 actual=wsGraphicMsgBuf->Data(inputMsgPosition);
+ HBufC* buffer=HBufC::NewLC(actual.Length());
+ TPtr bufferPtr=buffer->Des();
+
+ bufferPtr.Copy(actual);
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::Data ="));
+ INFO_PRINTF1(bufferPtr);
+ TPtrC expected;
+ if( !GetStringFromConfig(aSection, KExpected(), expected) )
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KInputMsgPosition());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if( bufferPtr!=expected )
+ {
+ ERR_PRINTF1(_L("Data is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ CleanupStack::PopAndDestroy(buffer);
+ }
+ }
+ }
+
+void CT_DataWsGraphicMsgBuf::DoCmdGetFixedMsg(const TDesC& aSection)
+ {
+ TInt inputMsgPosition=0;
+ if( GetIntFromConfig(aSection, KInputMsgPosition(), inputMsgPosition))
+ {
+ TWsGraphicFrameRate frameRate;
+ iWsGraphicMsgBuf->GetFixedMsg(frameRate, inputMsgPosition);
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::GetFixedMsg"));
+ }
+ else
+ {
+ ERR_PRINTF2(_L("Missing parameter %S"), &KInputMsgPosition());
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataWsGraphicMsgBuf::DoCmdPckg()
+ {
+ TBuf8<KMaxTestExecuteCommandLength> msg;
+ msg = iWsGraphicMsgBuf->Pckg();
+ INFO_PRINTF1(_L("RWsGraphicMsgBuf::Pckg"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsGraphicMsgFixedBase.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsGraphicMsgFixedBase.h"
+
+/*@{*/
+/// Commands
+_LIT(KCmdPckg, "Pckg");
+_LIT(KCmdSize, "Size");
+_LIT(KCmdTypeId, "TypeId");
+
+// Fields
+_LIT(KFldExpected, "expected");
+
+/// Logging
+_LIT(KLogNotExpectedValue, "Not expected value");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsGraphicMsgFixedBase::CT_DataWsGraphicMsgFixedBase()
+: CDataWrapperBase()
+ {
+ }
+
+CT_DataWsGraphicMsgFixedBase::~CT_DataWsGraphicMsgFixedBase()
+ {
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsGraphicMsgFixedBase::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret=ETrue;
+
+ if ( aCommand==KCmdPckg )
+ {
+ DoCmdPckg();
+ }
+ else if ( aCommand==KCmdSize )
+ {
+ DoCmdSize(aSection);
+ }
+ else if ( aCommand==KCmdTypeId )
+ {
+ DoCmdTypeId(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+void CT_DataWsGraphicMsgFixedBase::DoCmdPckg()
+ {
+ INFO_PRINTF1(_L("execute Pckg()"));
+ iPckg.Set(GetWsGraphicMsgFixedBase()->Pckg());
+ }
+
+void CT_DataWsGraphicMsgFixedBase::DoCmdSize(const TDesC& aSection)
+ {
+ TInt size=GetWsGraphicMsgFixedBase()->Size();
+ INFO_PRINTF2(_L("execute Size() = %d"), size);
+
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( expected!=size )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsGraphicMsgFixedBase::DoCmdTypeId(const TDesC& aSection)
+ {
+ TUid uid=GetWsGraphicMsgFixedBase()->TypeId();
+ INFO_PRINTF2(_L("execute TypeId() = 0x%x"), uid.iUid);
+
+ TInt expected;
+ if ( GetHexFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( expected!=uid.iUid )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsPointerCursor.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_GraphicsUtil.h"
+#include "T_DataWsPointerCursor.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdNew, "new");
+_LIT(KCmdConstruct, "Construct");
+
+// Fields
+_LIT(KFldWs, "ws");
+_LIT(KFldFlag, "flag");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+
+_LIT(KLogConstruct, "execute Construct(TInt aFlags)");
+_LIT(KLogNew, "execute new RWsPointerCursor()");
+_LIT(KLogNew2, "execute new RWsPointerCursor(RWsSession)");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsPointerCursor::CT_DataWsPointerCursor()
+: CT_DataWsSpriteBase(),iWsPointerCursor(NULL)
+ {
+ }
+
+CT_DataWsPointerCursor* CT_DataWsPointerCursor::NewL()
+ {
+ CT_DataWsPointerCursor* ret=new (ELeave) CT_DataWsPointerCursor();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+void CT_DataWsPointerCursor::ConstructL()
+ {
+ }
+
+CT_DataWsPointerCursor::~CT_DataWsPointerCursor()
+ {
+ DestroyData();
+ }
+
+/**
+ * Called by TEF framework to set object.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsPointerCursor::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWsPointerCursor=static_cast<RWsPointerCursor*> (aAny);
+ }
+
+/**
+ * Called by TEF framework to disown the object.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsPointerCursor::DisownObjectL()
+ {
+ iWsPointerCursor=NULL;
+ }
+
+/**
+ * Destroy the object which has been constructed.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsPointerCursor::DestroyData()
+ {
+ delete iWsPointerCursor;
+ iWsPointerCursor=NULL;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsPointerCursor::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret=ETrue;
+
+ if ( aCommand==KCmdNew )
+ {
+ DoCmdNewL(aSection);
+ }
+ else if ( aCommand==KCmdConstruct )
+ {
+ DoCmdConstructL(aSection);
+ }
+ else
+ {
+ ret=CT_DataWsSpriteBase::DoCommandL(aCommand,aSection,aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+/**
+ * Process new command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataWsPointerCursor::DoCmdNewL(const TDesC& aSection)
+ {
+ TPtrC wsName;
+ RWsSession* ws=NULL;
+
+ if ( GetStringFromConfig(aSection, KFldWs, wsName) )
+ {
+ ws=static_cast<RWsSession*>(GetDataObjectL(wsName));
+ }
+
+ TInt err=KErrNone;
+
+ if ( ws!=NULL )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogNew2);
+ TRAP( err, iWsPointerCursor = new (ELeave) RWsPointerCursor(*ws));
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogNew);
+ TRAP( err, iWsPointerCursor = new (ELeave) RWsPointerCursor());
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ // No command return value and output parameter to display and check
+ }
+
+
+/**
+ * Process Construct command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataWsPointerCursor::DoCmdConstructL(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogConstruct);
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TUint aSpriteFlags=0;
+
+ if(!CT_GraphicsUtil::ReadSpriteFlags(*this,aSection,KFldFlag,aSpriteFlags))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFlag);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogConstruct);
+ TInt returnCode=iWsPointerCursor->Construct(aSpriteFlags);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command output parameter to display and check
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsPriorityKeyEvent.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsPriorityKeyEvent.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdHandle, "Handle");
+_LIT(KCmdKey, "Key");
+_LIT(KCmdSetHandle, "SetHandle");
+
+// Fields
+_LIT(KFldExpected, "expected");
+_LIT(KFldExpected_Code, "expected_code");
+_LIT(KFldExpected_Modifier, "expected_modifier");
+_LIT(KFldExpected_Repeats, "expected_repeats");
+_LIT(KFldExpected_ScanCode, "expected_scancode");
+_LIT(KFldHandle, "handle");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogMissingExpectedValue, "Missing expected value '%S'");
+_LIT(KLogNotExpectedValueInt, "'%S' is not as expected=%d, actual=%d");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsPriorityKeyEvent* CT_DataWsPriorityKeyEvent::NewL()
+ {
+ CT_DataWsPriorityKeyEvent* ret=new (ELeave) CT_DataWsPriorityKeyEvent();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWsPriorityKeyEvent::CT_DataWsPriorityKeyEvent()
+: CDataWrapperBase()
+, iWsPriorityKeyEvent(NULL)
+ {
+ }
+
+void CT_DataWsPriorityKeyEvent::ConstructL()
+ {
+ }
+
+CT_DataWsPriorityKeyEvent::~CT_DataWsPriorityKeyEvent()
+ {
+ DestroyData();
+ }
+
+void CT_DataWsPriorityKeyEvent::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWsPriorityKeyEvent = static_cast<TWsPriorityKeyEvent*> (aAny);
+ }
+
+void CT_DataWsPriorityKeyEvent::DisownObjectL()
+ {
+ iWsPriorityKeyEvent = NULL;
+ }
+
+void CT_DataWsPriorityKeyEvent::DestroyData()
+ {
+ delete iWsPriorityKeyEvent;
+ iWsPriorityKeyEvent=NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsPriorityKeyEvent::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret = ETrue;
+ if ( aCommand==KCmdnew )
+ {
+ DoCmdnew();
+ }
+ else if ( aCommand==KCmdDestructor )
+ {
+ DestroyData();
+ }
+ else if ( aCommand==KCmdHandle )
+ {
+ DoCmdHandle(aSection);
+ }
+ else if ( aCommand==KCmdKey )
+ {
+ DoCmdKey(aSection);
+ }
+ else if ( aCommand==KCmdSetHandle )
+ {
+ DoCmdSetHandle(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+
+
+void CT_DataWsPriorityKeyEvent::DoCmdnew()
+ {
+ DestroyData();
+ INFO_PRINTF1(_L("execute new TWsPriorityKeyEvent()"));
+ TRAPD(err, iWsPriorityKeyEvent = new (ELeave) TWsPriorityKeyEvent());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWsPriorityKeyEvent::DoCmdSetHandle(const TDesC& aSection)
+ {
+ TInt handle;
+
+ if ( !GetIntFromConfig(aSection, KFldHandle(), handle) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldHandle);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute SetHandle(TUint)"));
+ iWsPriorityKeyEvent->SetHandle((TUint)handle);
+ }
+ }
+
+
+void CT_DataWsPriorityKeyEvent::DoCmdHandle(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute Handle()"));
+ TUint actual=iWsPriorityKeyEvent->Handle();
+ SetHandle(actual);
+
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( actual!= (TUint)expected )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ }
+
+
+void CT_DataWsPriorityKeyEvent::DoCmdKey(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute Key()"));
+ TKeyEvent* eventKey=iWsPriorityKeyEvent->Key();
+
+ TKeyCode keyCode;
+ if ( CT_GraphicsUtil::ReadKeyCode(*this, aSection, KFldExpected_Code, keyCode) )
+ {
+ if ( (TUint)keyCode != eventKey->iCode )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected_Code, keyCode, eventKey->iCode);
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected_Code);
+ SetBlockResult(EFail);
+ }
+
+ TStdScanCode scanCode;
+ if ( CT_GraphicsUtil::ReadStdScanCode(*this, aSection, KFldExpected_ScanCode, scanCode) )
+ {
+ if ( scanCode != eventKey->iScanCode )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected_ScanCode, scanCode, eventKey->iScanCode);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TUint modifiers;
+ if ( CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldExpected_Modifier, modifiers) )
+ {
+ if ( modifiers != eventKey->iModifiers )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected_Modifier, modifiers, eventKey->iModifiers);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TInt repeats;
+ if ( GetIntFromConfig(aSection, KFldExpected_Repeats, repeats) )
+ {
+ if ( repeats != eventKey->iRepeats )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected_Repeats, repeats, eventKey->iRepeats);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsRedrawEvent.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsRedrawEvent.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdDestructor, "~");
+_LIT(KCmdHandle, "Handle");
+_LIT(KCmdRect, "Rect");
+
+/// Fields
+_LIT(KFldExpected, "expected");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingExpectedValue, "Missing expected value '%S'");
+_LIT(KLogNotAsExpectedValue, "'%S' is not as expected value");
+_LIT(KLogNotExpectedValueInt, "'%S' is not as expected=%d, actual=%d");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsRedrawEvent* CT_DataWsRedrawEvent::NewL()
+ {
+ CT_DataWsRedrawEvent* ret=new (ELeave) CT_DataWsRedrawEvent();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWsRedrawEvent::CT_DataWsRedrawEvent()
+: CDataWrapperBase()
+, iWsRedrawEvent(NULL)
+ {
+ }
+
+void CT_DataWsRedrawEvent::ConstructL()
+ {
+ }
+
+CT_DataWsRedrawEvent::~CT_DataWsRedrawEvent()
+ {
+ DestroyData();
+ }
+
+void CT_DataWsRedrawEvent::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWsRedrawEvent = static_cast<TWsRedrawEvent*> (aAny);
+ }
+
+void CT_DataWsRedrawEvent::DisownObjectL()
+ {
+ iWsRedrawEvent = NULL;
+ }
+
+void CT_DataWsRedrawEvent::DestroyData()
+ {
+ delete iWsRedrawEvent;
+ iWsRedrawEvent=NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsRedrawEvent::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret = ETrue;
+ if ( aCommand==KCmdnew )
+ {
+ DoCmdnew();
+ }
+ else if ( aCommand==KCmdDestructor )
+ {
+ DestroyData();
+ }
+ else if ( aCommand==KCmdHandle )
+ {
+ DoCmdHandle(aSection);
+ }
+ else if ( aCommand==KCmdRect )
+ {
+ DoCmdRect(aSection);
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+
+void CT_DataWsRedrawEvent::DoCmdnew()
+ {
+ DestroyData();
+ INFO_PRINTF1(_L("execute new TWsRedrawEvent()"));
+ TRAPD(err, iWsRedrawEvent = new (ELeave) TWsRedrawEvent());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+
+void CT_DataWsRedrawEvent::DoCmdHandle(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute Handle()"));
+ TUint actual=iWsRedrawEvent->Handle();
+ SetHandle(actual);
+
+ TInt expected;
+ if ( !GetIntFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=(TUint)expected )
+ {
+ ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, expected, actual);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+void CT_DataWsRedrawEvent::DoCmdRect(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("execute Rect()"));
+ TRect actual=iWsRedrawEvent->Rect();
+ LogRect(_L("Rect()"), actual);
+
+ TRect expected;
+ if ( !GetRectFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF2(KLogNotAsExpectedValue, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsScreenDevice.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,1523 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsScreenDevice.h"
+#include "T_GraphicsUtil.h"
+
+/*@{*/
+_LIT(KDataClassname, "CWsScreenDevice");
+
+/// Fields
+_LIT(KFldAlgStyle, "alg_style");
+_LIT(KFldBackLight, "backlight");
+_LIT(KFldBitmap, "bitmap");
+_LIT(KFldDefaultScreenNumber, "defaultscreennumber");
+_LIT(KFldExpected, "expected");
+_LIT(KFldExpectedCount, "expectedcount");
+_LIT(KFldFinish, "finish");
+_LIT(KFldFlags, "flags");
+_LIT(KFldFormatFieldNumber, "%S%d");
+_LIT(KFldFontUid, "font_uid");
+_LIT(KFldMode, "mode");
+_LIT(KFldPalette, "palette");
+_LIT(KFldPixel, "pixel");
+_LIT(KFldPixelSize, "pixelsize");
+_LIT(KFldRect, "rect");
+_LIT(KFldRect1, "rect1");
+_LIT(KFldRect2, "rect2");
+_LIT(KFldRotation, "rotation");
+_LIT(KFldStart, "start");
+_LIT(KFldTwips, "twips");
+_LIT(KFldTwipsSize, "twipssize");
+_LIT(KFldWindowGc, "windowgc");
+_LIT(KFldWs, "ws");
+_LIT(KFldFont, "font");
+_LIT(KFldContext, "context");
+
+/// Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmddisown, "disown");
+_LIT(KCmdDestructor, "~CWsScreenDevice");
+_LIT(KCmdDestructorGeneral, "~");
+_LIT(KCmdConstruct, "Construct");
+_LIT(KCmdCopyScreenToBitmap, "CopyScreenToBitmap");
+_LIT(KCmdCreateContext, "CreateContext");
+_LIT(KCmdCurrentScreenMode, "CurrentScreenMode");
+_LIT(KCmdGetCurrentScreenModeScale, "GetCurrentScreenModeScale");
+_LIT(KCmdGetCurrentScreenModeScaledOrigin, "GetCurrentScreenModeScaledOrigin");
+_LIT(KCmdGetDefaultScreenModeOrigin, "GetDefaultScreenModeOrigin");
+_LIT(KCmdGetDefaultScreenSizeAndRotation, "GetDefaultScreenSizeAndRotation");
+_LIT(KCmdGetFontById, "GetFontById");
+_LIT(KCmdGetRotationsList, "GetRotationsList");
+_LIT(KCmdGetScreenModeDisplayMode, "GetScreenModeDisplayMode");
+_LIT(KCmdGetScreenModeOrigin, "GetScreenModeOrigin");
+_LIT(KCmdGetScreenModeScale, "GetScreenModeScale");
+_LIT(KCmdGetScreenModeScaledOrigin, "GetScreenModeScaledOrigin");
+_LIT(KCmdGetScreenModeSizeAndRotation, "GetScreenModeSizeAndRotation");
+_LIT(KCmdGetScreenNumber, "GetScreenNumber");
+_LIT(KCmdGetScreenSizeModeList, "GetScreenSizeModeList");
+_LIT(KCmdNumScreenModes, "NumScreenModes");
+_LIT(KCmdRectCompare, "RectCompare");
+_LIT(KCmdPointerRect, "PointerRect");
+_LIT(KCmdScreenModeEnforcement, "ScreenModeEnforcement");
+_LIT(KCmdSetAppScreenMode, "SetAppScreenMode");
+_LIT(KCmdSetBackLight, "SetBackLight");
+_LIT(KCmdSetCustomPalette, "SetCustomPalette");
+_LIT(KCmdSetScreenSizeAndRotation, "SetScreenSizeAndRotation");
+
+_LIT(KCmdcheckPixels, "checkPixels");
+_LIT(KCmdcheckLineColor, "checkLineColor");
+_LIT(KCmdcheckRectColor, "checkRectColor");
+
+_LIT(KFormatFieldNumber, "%S%d");
+
+/// Logging
+_LIT(KLogColor, "Color Red=%d Green=%d Blue=%d Alpha=%d");
+_LIT(KLogPoint, "Point X=%d Y=%d");
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsScreenDevice* CT_DataWsScreenDevice::NewL()
+/**
+ * Two phase constructor
+ */
+ {
+ CT_DataWsScreenDevice* ret=new (ELeave) CT_DataWsScreenDevice();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWsScreenDevice::CT_DataWsScreenDevice()
+/**
+ * Protected constructor. First phase construction
+ */
+: CT_DataBitmapDevice()
+, iWsScreenDevice(NULL)
+ {
+ }
+
+void CT_DataWsScreenDevice::ConstructL()
+/**
+ * Second phase construction
+ */
+ {
+ }
+
+CT_DataWsScreenDevice::~CT_DataWsScreenDevice()
+/**
+ * Public destructor
+ */
+ {
+ DestroyData();
+ }
+
+TAny* CT_DataWsScreenDevice::GetObject()
+/**
+ * Return a pointer to the object that the data wraps
+ *
+ * @return pointer to the object that the data wraps
+ */
+ {
+ return iWsScreenDevice;
+ }
+
+void CT_DataWsScreenDevice::SetObjectL(TAny* aAny)
+/**
+ * Set the object that the data wraps
+ *
+ * @param aObject object that the wrapper is testing
+ *
+ */
+ {
+ DestroyData();
+ iWsScreenDevice = static_cast<CWsScreenDevice*> (aAny);
+ }
+
+void CT_DataWsScreenDevice::DisownObjectL()
+/**
+ * The object will no longer be owned by this
+ *
+ * @leave KErrNotSupported if the the function is not supported
+ */
+ {
+ iWsScreenDevice = NULL;
+ }
+
+void CT_DataWsScreenDevice::DestroyData()
+ {
+ delete iWsScreenDevice;
+ iWsScreenDevice=NULL;
+ }
+
+MWsClientClass* CT_DataWsScreenDevice::GetClientClass() const
+ {
+ return iWsScreenDevice;
+ }
+
+MGraphicsDeviceMap* CT_DataWsScreenDevice::GetGraphicsDeviceMap() const
+ {
+ return iWsScreenDevice;
+ }
+
+CGraphicsDevice* CT_DataWsScreenDevice::GetGraphicsDevice() const
+ {
+ return iWsScreenDevice;
+ }
+
+CBitmapDevice* CT_DataWsScreenDevice::GetBitmapDevice() const
+ {
+ return iWsScreenDevice;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsScreenDevice::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdDestructor || aCommand==KCmdDestructorGeneral )
+ {
+ DoCmdDestructor();
+ }
+ else if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnewL(aSection);
+ }
+ else if ( aCommand==KCmddisown )
+ {
+ DisownObjectL();
+ }
+ else if ( aCommand==KCmdConstruct )
+ {
+ DoCmdConstruct(aSection);
+ }
+ else if ( aCommand==KCmdCopyScreenToBitmap )
+ {
+ DoCmdCopyScreenToBitmapL(aSection);
+ }
+ else if ( aCommand==KCmdCreateContext )
+ {
+ DoCmdCreateContextL(aSection);
+ }
+ else if ( aCommand==KCmdCurrentScreenMode )
+ {
+ DoCmdCurrentScreenMode(aSection);
+ }
+ else if ( aCommand==KCmdGetCurrentScreenModeScale )
+ {
+ DoCmdGetCurrentScreenModeScale(aSection);
+ }
+ else if ( aCommand==KCmdGetCurrentScreenModeScaledOrigin )
+ {
+ DoCmdGetCurrentScreenModeScaledOrigin(aSection);
+ }
+ else if ( aCommand==KCmdGetDefaultScreenModeOrigin )
+ {
+ DoCmdGetDefaultScreenModeOrigin(aSection);
+ }
+ else if ( aCommand==KCmdGetDefaultScreenSizeAndRotation )
+ {
+ DoCmdGetDefaultScreenSizeAndRotation(aSection);
+ }
+ else if ( aCommand==KCmdGetFontById )
+ {
+ DoCmdGetFontByIdL(aSection);
+ }
+ else if ( aCommand==KCmdGetRotationsList )
+ {
+ DoCmdGetRotationsListL(aSection);
+ }
+ else if ( aCommand==KCmdGetScreenModeDisplayMode )
+ {
+ DoCmdGetScreenModeDisplayMode(aSection);
+ }
+ else if ( aCommand==KCmdGetScreenModeOrigin )
+ {
+ DoCmdGetScreenModeOrigin(aSection);
+ }
+ else if ( aCommand==KCmdGetScreenModeScale )
+ {
+ DoCmdGetScreenModeScale(aSection);
+ }
+ else if ( aCommand==KCmdGetScreenModeScaledOrigin )
+ {
+ DoCmdGetScreenModeScaledOrigin(aSection);
+ }
+ else if ( aCommand==KCmdGetScreenModeSizeAndRotation )
+ {
+ DoCmdGetScreenModeSizeAndRotation(aSection);
+ }
+ else if ( aCommand==KCmdGetScreenNumber )
+ {
+ DoCmdGetScreenNumber(aSection);
+ }
+ else if ( aCommand==KCmdGetScreenSizeModeList )
+ {
+ DoCmdGetScreenSizeModeListL(aSection);
+ }
+ else if ( aCommand==KCmdNumScreenModes )
+ {
+ DoCmdNumScreenModes(aSection);
+ }
+ else if ( aCommand==KCmdPointerRect )
+ {
+ DoCmdPointerRect(aSection);
+ }
+ else if ( aCommand==KCmdRectCompare )
+ {
+ DoCmdRectCompare(aSection);
+ }
+ else if ( aCommand==KCmdScreenModeEnforcement )
+ {
+ DoCmdScreenModeEnforcement(aSection);
+ }
+ else if ( aCommand==KCmdSetAppScreenMode )
+ {
+ DoCmdSetAppScreenMode(aSection);
+ }
+ else if ( aCommand==KCmdSetBackLight )
+ {
+ DoCmdSetBackLight(aSection);
+ }
+ else if ( aCommand==KCmdSetCustomPalette )
+ {
+ DoCmdSetCustomPaletteL(aSection);
+ }
+ else if ( aCommand==KCmdSetScreenSizeAndRotation )
+ {
+ DoCmdSetScreenSizeAndRotation(aSection);
+ }
+ else if ( aCommand==KCmdcheckPixels )
+ {
+ DoCmdcheckPixels(aSection);
+ }
+ else if ( aCommand==KCmdcheckLineColor )
+ {
+ DoCmdcheckLineColor(aSection);
+ }
+ else if ( aCommand==KCmdcheckRectColor )
+ {
+ DoCmdcheckRectColor(aSection);
+ }
+ else if ( CT_DataBitmapDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex) )
+ {
+ }
+ else
+ {
+ ret=CT_DataWsClientClass::DoCommandL(*this, aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+/**
+Test Constructor
+*/
+void CT_DataWsScreenDevice::DoCmdnewL(const TDesC& aSection)
+ {
+ DestroyData();
+
+ // Get test data for command input parameter(s)
+ RWsSession* ws=NULL;
+ TPtrC wsName;
+ if ( GetStringFromConfig(aSection, KFldWs, wsName) )
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(wsName));
+ }
+
+ TInt err;
+ if ( ws!= NULL )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new CWsScreenDevice(RWsSession)"));
+ TRAP( err, iWsScreenDevice = new (ELeave) CWsScreenDevice(*ws) );
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute new CWsScreenDevice()"));
+ TRAP(err, iWsScreenDevice = new (ELeave) CWsScreenDevice());
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+/**
+Test Destructor
+*/
+void CT_DataWsScreenDevice::DoCmdDestructor()
+ {
+ INFO_PRINTF1(_L("execute ~CWsScreenDevice()"));
+ DestroyData();
+ }
+
+/**
+Test Construct()
+*/
+void CT_DataWsScreenDevice::DoCmdConstruct(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TInt err=KErrNone;
+
+ TInt datDefaultScreenNumber;
+ if ( GetIntFromConfig(aSection, KFldDefaultScreenNumber, datDefaultScreenNumber) )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Construct(TInt)"));
+ err=iWsScreenDevice->Construct(datDefaultScreenNumber);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute Construct()"));
+ err=iWsScreenDevice->Construct();
+ }
+
+ // Check the command return code.
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+/**
+Test CopyScreenToBitmap()
+*/
+void CT_DataWsScreenDevice::DoCmdCopyScreenToBitmapL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ CFbsBitmap* bitmap=NULL;
+ TBool hasBitmap=CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap);
+ if ( !hasBitmap )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldBitmap);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ TInt err=KErrNone;
+
+ TRect datRect;
+ if ( GetRectFromConfig(aSection, KFldRect, datRect) )
+ {
+ INFO_PRINTF1(_L("execute CopyScreenToBitmap(CFbsBitmap, TRect)"));
+ err=iWsScreenDevice->CopyScreenToBitmap(bitmap, datRect);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("execute CopyScreenToBitmap(CFbsBitmap)"));
+ err=iWsScreenDevice->CopyScreenToBitmap(bitmap);
+ }
+
+ // Check the command return code.
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+/**
+Test CreateContext()
+*/
+void CT_DataWsScreenDevice::DoCmdCreateContextL(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPtrC datWindowGc;
+ if ( !GetStringFromConfig(aSection, KFldWindowGc, datWindowGc) )
+ {
+ //CT_DataBitmapDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
+
+ // get BitmapUtilData object from parameters
+ if ( !GetStringFromConfig(aSection, KFldContext, datWindowGc) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldContext());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ CGraphicsContext* context=NULL;
+ INFO_PRINTF1(_L("execute CreateContext(CGraphicsContext*&)"));
+ TInt returnCode=GetGraphicsDevice()->CreateContext(context);
+ // Check the command return code.
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+ else
+ {
+ SetDataObjectL(datWindowGc, context);
+ }
+ }
+ }
+ else
+ {
+ // Execute command and log parameters
+ CWindowGc* windowGc;
+
+ INFO_PRINTF1(_L("execute CreateContext(CWindowGc)"));
+ TInt returnCode = iWsScreenDevice->CreateContext(windowGc);
+
+ // Check the command return code.
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+ else
+ {
+ SetDataObjectL(datWindowGc, windowGc);
+ }
+ }
+ }
+
+/**
+Test CurrentScreenMode()
+*/
+void CT_DataWsScreenDevice::DoCmdCurrentScreenMode(const TDesC& aSection)
+ {
+ TInt actual=iWsScreenDevice->CurrentScreenMode();
+ INFO_PRINTF2(_L("CurrentScreenMode()=%d"), actual);
+
+ TInt expected;
+ if ( !GetIntFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+Test GetCurrentScreenModeScale()
+*/
+void CT_DataWsScreenDevice::DoCmdGetCurrentScreenModeScale(const TDesC& aSection)
+ {
+ TSize actual=iWsScreenDevice->GetCurrentScreenModeScale();
+ INFO_PRINTF3(_L("GetCurrentScreenModeScale(TInt) height=%d width=%d"), actual.iHeight, actual.iWidth);
+
+ TSize expected;
+ if ( !GetSizeFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+Test GetCurrentScreenModeScaledOrigin()
+*/
+void CT_DataWsScreenDevice::DoCmdGetCurrentScreenModeScaledOrigin(const TDesC& aSection)
+ {
+ TPoint actual=iWsScreenDevice->GetCurrentScreenModeScaledOrigin();
+ INFO_PRINTF3(_L("GetCurrentScreenModeScaledOrigin() x=%d y=%d"), actual.iX, actual.iY);
+
+ TPoint expected;
+ if ( !GetPointFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+Test GetDefaultScreenModeOrigin()
+*/
+void CT_DataWsScreenDevice::DoCmdGetDefaultScreenModeOrigin(const TDesC& aSection)
+ {
+ TPoint actual=iWsScreenDevice->GetDefaultScreenModeOrigin();
+ INFO_PRINTF3(_L("GetDefaultScreenModeOrigin() x=%d y=%d"), actual.iX, actual.iY);
+
+ TPoint expected;
+ if ( !GetPointFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+Test GetDefaultScreenSizeAndRotation()
+*/
+void CT_DataWsScreenDevice::DoCmdGetDefaultScreenSizeAndRotation(const TDesC& aSection)
+ {
+ CFbsBitGc::TGraphicsOrientation rotation;
+ TBool checkRotation=CT_GraphicsUtil::ReadGraphicsOrientation(*this, aSection, KFldRotation, rotation);
+
+ TSize pixelSize;
+ TBool checkPixelSize=GetSizeFromConfig(aSection, KFldPixelSize, pixelSize);
+
+ TBool twips=EFalse;
+ GetBoolFromConfig(aSection, KFldTwips, twips);
+ if ( twips )
+ {
+ TPixelsTwipsAndRotation param;
+ iWsScreenDevice->GetDefaultScreenSizeAndRotation(param);
+ INFO_PRINTF2(_L("GetDefaultScreenSizeAndRotation(TPixelsTwipsAndRotation) Rotation=%d"), param.iRotation);
+ INFO_PRINTF3(_L("Pixel height=%d width=%d"), param.iPixelSize.iHeight, param.iPixelSize.iWidth);
+ INFO_PRINTF3(_L("Twips height=%d width=%d"), param.iTwipsSize.iHeight, param.iTwipsSize.iWidth);
+
+ if ( checkRotation )
+ {
+ if ( rotation!=param.iRotation )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ if ( checkPixelSize )
+ {
+ if ( pixelSize!=param.iPixelSize )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TSize twipsSize;
+ if ( GetSizeFromConfig(aSection, KFldTwipsSize, twipsSize) )
+ {
+ if ( twipsSize!=param.iTwipsSize )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ else
+ {
+ TPixelsAndRotation param;
+ iWsScreenDevice->GetDefaultScreenSizeAndRotation(param);
+ INFO_PRINTF2(_L("GetDefaultScreenSizeAndRotation(TPixelsAndRotation) Rotation=%d"), param.iRotation);
+ INFO_PRINTF3(_L("Pixel height=%d width=%d"), param.iPixelSize.iHeight, param.iPixelSize.iWidth);
+
+ if ( checkRotation )
+ {
+ if ( rotation!=param.iRotation )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ if ( checkPixelSize )
+ {
+ if ( pixelSize!=param.iPixelSize )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+/**
+Test GetFontById()
+*/
+void CT_DataWsScreenDevice::DoCmdGetFontByIdL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Call GetFontById()"));
+ TBool dataOk=ETrue;
+
+ // get font uid from parameters
+ TInt fontUid;
+ if(!GetIntFromConfig(aSection, KFldFontUid(), fontUid))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("No %S"), &KFldFontUid());
+ SetBlockResult(EFail);
+ }
+ // get TAlgStyle from parameters
+ TAlgStyle* algStyle=NULL;
+ CT_GraphicsUtil::GetAlgStyleL(*this, aSection, KFldAlgStyle(), algStyle);
+ if ( algStyle==NULL )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("No %S"), &KFldAlgStyle());
+ SetBlockResult(EFail);
+ }
+ // get font wrapper name
+ TPtrC datFbsFont;
+ if( !GetStringFromConfig(aSection, KFldFont, datFbsFont) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldFont());
+ SetBlockResult(EFail);
+ }
+ // call GetFontById()
+ else
+ {
+ if ( dataOk )
+ {
+ CFont* fbsFont=NULL;
+ INFO_PRINTF1(_L("execute GetFontById(CFont *&aFont, TUid aUid, const TAlgStyle &aAlgStyle)"));
+ TInt err = iWsScreenDevice->GetFontById(fbsFont, TUid::Uid(fontUid), *algStyle);
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ SetDataObjectL(datFbsFont, fbsFont);
+ }
+ }
+ }
+ }
+
+/**
+Test GetRotationsList()
+*/
+void CT_DataWsScreenDevice::DoCmdGetRotationsListL(const TDesC& aSection)
+ {
+ CArrayFixFlat<TInt>* rotations=new(ELeave) CArrayFixFlat<TInt>(1);
+ CleanupStack::PushL(rotations);
+
+ TInt mode=0;
+ if ( !GetIntFromConfig(aSection, KFldMode, mode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldMode);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TInt err=iWsScreenDevice->GetRotationsList(mode, rotations);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("GetRotationsList count=%d"), rotations->Count());
+ TInt expectedCount;
+ if ( GetIntFromConfig(aSection, KFldExpectedCount, expectedCount) )
+ {
+ if ( expectedCount!=rotations->Count() )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Check elements in the rotations list"));
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TBool ok=ETrue;
+ for ( TInt index = 0; (index < expectedCount) && (ok); )
+ {
+ tempStore.Format(KFormatFieldNumber, &KFldRotation, ++index);
+
+ CFbsBitGc::TGraphicsOrientation rotation;
+ ok = CT_GraphicsUtil::ReadGraphicsOrientation(*this, aSection, tempStore, rotation);
+ if ( !ok )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &tempStore);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if( rotation != (*rotations)[index-1])
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ ok = EFalse;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy();
+ }
+
+/**
+Test GetScreenModeDisplayMode()
+*/
+void CT_DataWsScreenDevice::DoCmdGetScreenModeDisplayMode(const TDesC& aSection)
+ {
+ TInt mode=0;
+ if ( !GetIntFromConfig(aSection, KFldMode, mode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldMode);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TDisplayMode actual=iWsScreenDevice->GetScreenModeDisplayMode(mode);
+ INFO_PRINTF2(_L("GetScreenModeDisplayMode(TInt)=%d"), actual);
+
+ TDisplayMode expected;
+ if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+/**
+Test GetScreenModeOrigin()
+*/
+void CT_DataWsScreenDevice::DoCmdGetScreenModeOrigin(const TDesC& aSection)
+ {
+ TInt mode=0;
+ if ( !GetIntFromConfig(aSection, KFldMode, mode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldMode);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TPoint actual=iWsScreenDevice->GetScreenModeOrigin(mode);
+ INFO_PRINTF3(_L("GetScreenModeOrigin(TInt) x=%d y=%d"), actual.iX, actual.iY);
+
+ TPoint expected;
+ if ( !GetPointFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+/**
+Test GetScreenModeScale()
+*/
+void CT_DataWsScreenDevice::DoCmdGetScreenModeScale(const TDesC& aSection)
+ {
+ TInt mode=0;
+ if ( !GetIntFromConfig(aSection, KFldMode, mode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldMode);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TSize actual=iWsScreenDevice->GetScreenModeScale(mode);
+ INFO_PRINTF3(_L("GetScreenModeScale(TInt) height=%d width=%d"), actual.iHeight, actual.iWidth);
+
+ TSize expected;
+ if ( !GetSizeFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+/**
+Test GetScreenModeScaledOrigin()
+*/
+void CT_DataWsScreenDevice::DoCmdGetScreenModeScaledOrigin(const TDesC& aSection)
+ {
+ TInt mode=0;
+ if ( !GetIntFromConfig(aSection, KFldMode, mode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldMode);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TPoint actual=iWsScreenDevice->GetScreenModeScaledOrigin(mode);
+ INFO_PRINTF3(_L("GetScreenModeScaledOrigin(TInt) x=%d y=%d"), actual.iX, actual.iY);
+
+ TPoint expected;
+ if ( !GetPointFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+/**
+Test GetScreenModeSizeAndRotation()
+*/
+void CT_DataWsScreenDevice::DoCmdGetScreenModeSizeAndRotation(const TDesC& aSection)
+ {
+ TInt mode=0;
+ if ( !GetIntFromConfig(aSection, KFldMode, mode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldMode);
+ SetBlockResult(EFail);
+ }
+
+ CFbsBitGc::TGraphicsOrientation rotation;
+ TBool checkRotation=CT_GraphicsUtil::ReadGraphicsOrientation(*this, aSection, KFldRotation, rotation);
+
+ TSize pixelSize;
+ TBool checkPixelSize=GetSizeFromConfig(aSection, KFldPixelSize, pixelSize);
+
+ TBool twips=EFalse;
+ GetBoolFromConfig(aSection, KFldTwips, twips);
+ if ( twips )
+ {
+ TPixelsTwipsAndRotation param;
+ iWsScreenDevice->GetScreenModeSizeAndRotation(mode, param);
+ INFO_PRINTF2(_L("GetScreenModeSizeAndRotation(TInt, TPixelsTwipsAndRotation) Rotation=%d"), param.iRotation);
+ INFO_PRINTF3(_L("Pixel height=%d width=%d"), param.iPixelSize.iHeight, param.iPixelSize.iWidth);
+ INFO_PRINTF3(_L("Twips height=%d width=%d"), param.iTwipsSize.iHeight, param.iTwipsSize.iWidth);
+
+ if ( checkRotation )
+ {
+ if ( rotation!=param.iRotation )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ if ( checkPixelSize )
+ {
+ if ( pixelSize!=param.iPixelSize )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TSize twipsSize;
+ if ( GetSizeFromConfig(aSection, KFldTwipsSize, twipsSize) )
+ {
+ if ( twipsSize!=param.iTwipsSize )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ else
+ {
+ TPixelsAndRotation param;
+ iWsScreenDevice->GetScreenModeSizeAndRotation(mode, param);
+ INFO_PRINTF2(_L("GetScreenModeSizeAndRotation(TInt, TPixelsAndRotation) Rotation=%d"), param.iRotation);
+ INFO_PRINTF3(_L("Pixel height=%d width=%d"), param.iPixelSize.iHeight, param.iPixelSize.iWidth);
+
+ if ( checkRotation )
+ {
+ if ( rotation!=param.iRotation )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ if ( checkPixelSize )
+ {
+ if ( pixelSize!=param.iPixelSize )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+/**
+Test GetScreenNumber()
+*/
+void CT_DataWsScreenDevice::DoCmdGetScreenNumber(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ TInt actual=iWsScreenDevice->GetScreenNumber();
+ INFO_PRINTF2(_L("execute GetScreenNumber()=%d"), actual);
+
+ // Diaplay command return value, check if it matches the expected value
+ TInt expected;
+ if ( !GetIntFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+Test GetScreenSizeModeList()
+*/
+void CT_DataWsScreenDevice::DoCmdGetScreenSizeModeListL(const TDesC& aSection)
+ {
+ RArray<TInt> screenModes;
+ CleanupClosePushL(screenModes);
+
+ TInt number = iWsScreenDevice->GetScreenSizeModeList(&screenModes);
+
+ if (number < 0)
+ {
+ ERR_PRINTF2(KLogError, number);
+ SetError(number);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("GetScreenSizeModeList count=%d"), screenModes.Count());
+ TInt expectedCount;
+ if ( GetIntFromConfig(aSection, KFldExpectedCount, expectedCount) )
+ {
+ if ( expectedCount!=screenModes.Count() || expectedCount != number)
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("Check elements in the modes list"));
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TBool ok=ETrue;
+ for ( TInt index = 0; (index < number) && (ok); )
+ {
+ tempStore.Format(KFormatFieldNumber, &KFldMode, ++index);
+
+ TInt expectedMode = 0;
+ ok=GetIntFromConfig(aSection, tempStore, expectedMode);
+ if ( !ok )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &tempStore);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if( expectedMode != screenModes[index-1])
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ ok = EFalse;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(&screenModes);
+ }
+
+/**
+Test NumScreenModes()
+*/
+void CT_DataWsScreenDevice::DoCmdNumScreenModes(const TDesC& aSection)
+ {
+ TInt actual=iWsScreenDevice->NumScreenModes();
+ INFO_PRINTF2(_L("NumScreenModes()=%d"), actual);
+
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+Test PointerRect()
+*/
+void CT_DataWsScreenDevice::DoCmdPointerRect(const TDesC& aSection)
+ {
+ TRect actual=iWsScreenDevice->PointerRect();
+ LogRect(_L("PointerRect()"), actual);
+
+ TRect expected;
+ if ( GetRectFromConfig(aSection, KFldExpected, expected) )
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+Test RectCompare()
+*/
+void CT_DataWsScreenDevice::DoCmdRectCompare(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TRect datRect1;
+ if ( !GetRectFromConfig(aSection, KFldRect1, datRect1) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect1);
+ SetBlockResult(EFail);
+ }
+
+ TRect datRect2;
+ if ( !GetRectFromConfig(aSection, KFldRect2, datRect2) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect2);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ TBool actual=EFalse;
+
+ // Execute command and log parameters
+ TUint datFlags;
+ if ( CT_GraphicsUtil::ReadSpriteInCompare(*this, aSection, KFldFlags, datFlags) )
+ {
+ actual=iWsScreenDevice->RectCompare(datRect1, datRect2, datFlags);
+ INFO_PRINTF2(_L("execute RectCompare(TRect, TRect, TUint)=%d"), actual);
+ }
+ else
+ {
+ actual=iWsScreenDevice->RectCompare(datRect1, datRect2);
+ INFO_PRINTF2(_L("execute RectCompare(TRect, TRect)=%d"), actual);
+ }
+
+ // Diaplay command return value, check if it matches the expected value
+ TBool expected;
+ if ( !GetBoolFromConfig(aSection, KFldExpected, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+/**
+Test ScreenModeEnforcement()
+*/
+void CT_DataWsScreenDevice::DoCmdScreenModeEnforcement(const TDesC& aSection)
+ {
+ TScreenModeEnforcement actual=iWsScreenDevice->ScreenModeEnforcement();
+ INFO_PRINTF2(_L("execute ScreenModeEnforcement()=%d"), actual);
+
+ TScreenModeEnforcement expected;
+ if ( CT_GraphicsUtil::ReadScreenModeEnforcement(*this, aSection, KFldExpected, expected) )
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+/**
+Test SetAppScreenMode()
+*/
+void CT_DataWsScreenDevice::DoCmdSetAppScreenMode(const TDesC& aSection)
+ {
+ TInt mode;
+ if ( !GetIntFromConfig(aSection, KFldMode, mode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldRect2);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("SetAppScreenMode()"));
+ iWsScreenDevice->SetAppScreenMode(mode);
+ }
+ }
+
+/**
+Test SetBackLight()
+*/
+void CT_DataWsScreenDevice::DoCmdSetBackLight(const TDesC& aSection)
+ {
+ TBool backLight;
+ if ( !GetBoolFromConfig(aSection, KFldBackLight, backLight) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldBackLight);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TInt err=iWsScreenDevice->SetBackLight(backLight);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+/**
+Test SetCustomPalette()
+*/
+void CT_DataWsScreenDevice::DoCmdSetCustomPaletteL(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("Calls CWsScreenDevice::SetCustomPalette() by previously created palette"));
+
+ // get CPalette object passed as a parameter
+ CPalette* palette = NULL;
+
+ if(!CT_GraphicsUtil::GetPaletteL(*this, aSection, KFldPalette(), palette))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldPalette);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // call SetPalette()
+ TInt err = iWsScreenDevice->SetCustomPalette(palette);
+ if(err != KErrNone)
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+/**
+Test SetScreenSizeAndRotation()
+*/
+void CT_DataWsScreenDevice::DoCmdSetScreenSizeAndRotation(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ CFbsBitGc::TGraphicsOrientation rotation;
+ if ( !CT_GraphicsUtil::ReadGraphicsOrientation(*this, aSection, KFldRotation, rotation) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldRotation);
+ SetBlockResult(EFail);
+ }
+
+ TSize pixelSize;
+ if ( !GetSizeFromConfig(aSection, KFldPixelSize, pixelSize) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPixelSize);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ TSize twipsSize;
+ if ( GetSizeFromConfig(aSection, KFldTwipsSize, twipsSize) )
+ {
+ TPixelsTwipsAndRotation param;
+ param.iPixelSize=pixelSize;
+ param.iRotation=rotation;
+ param.iTwipsSize=twipsSize;
+ INFO_PRINTF1(_L("execute SetScreenSizeAndRotation(const TPixelsTwipsAndRotation&)"));
+ iWsScreenDevice->SetScreenSizeAndRotation(param);
+ }
+ else
+ {
+ TPixelsAndRotation param;
+ param.iPixelSize=pixelSize;
+ param.iRotation=rotation;
+ INFO_PRINTF1(_L("execute SetScreenSizeAndRotation(const TPixelsAndRotation&)"));
+ iWsScreenDevice->SetScreenSizeAndRotation(param);
+ }
+ }
+ }
+
+/**
+* The source codes hereafter are NOT simple wrapper functions of CWsScreenDevice class,
+* but use combinations of CWsScreenDevice (and other) class functions to check if what
+* take from the CWsScreenDevice matches with the expected value specified in TEF testdata.
+*
+*/
+
+/**
+* DoCmdcheckPixels: to check the color of specified pixels on the screen device, and compare
+* with the expected color specidied in the TEF testdata.
+* pixel<n>: specify the position of the screen device to check
+* expected<n>: specify the expected color to be compared with
+*
+*/
+void CT_DataWsScreenDevice::DoCmdcheckPixels(const TDesC& aSection)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ TBool moreData=ETrue;
+ for ( TInt index=1; moreData; ++index )
+ {
+ // get the pixel position on the screen to check/verify
+ tempStore.Format(KFldFormatFieldNumber, &KFldPixel, index);
+ TPoint point;
+ if ( !GetPointFromConfig(aSection, tempStore, point) )
+ {
+ moreData=EFalse;
+ }
+ else
+ {
+ TRgb actual;
+ iWsScreenDevice->GetPixel(actual, point);
+
+ tempStore.Format(KFldFormatFieldNumber, &KFldExpected, index);
+ TRgb expected;
+ if ( GetRgbFromConfig(aSection, tempStore, expected) )
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF5(KLogColor, actual.Red(), actual.Green(), actual.Blue(), actual.Alpha());
+ ERR_PRINTF5(KLogColor, expected.Red(), expected.Green(), expected.Blue(), expected.Alpha());
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+ }
+
+/**
+* DoCmdcheckLineColor: to check the color of specified lines on the screen device, and compare
+* with the expected color specidied in the TEF testdata.
+* start<n>: specify the starting position of the line on the screen device to check
+* finish<n>: specify the finish position of the line on the screen device to check
+* expected<n>: specify the expected color to be compared with
+* Note: the straight line (from start to the finish points) is constructed by TLinearDDA
+*
+*/
+void CT_DataWsScreenDevice::DoCmdcheckLineColor(const TDesC& aSection)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ CPalette* palette=NULL;
+ iWsScreenDevice->GetPalette(palette);
+
+ TBool moreData=ETrue;
+ for ( TInt index=1; moreData; ++index )
+ {
+ // get the the start and finish points of the line to check/verify
+ tempStore.Format(KFldFormatFieldNumber, &KFldStart, index);
+ TPoint startPoint;
+ if ( !GetPointFromConfig(aSection, tempStore, startPoint) )
+ {
+ moreData=EFalse;
+ }
+
+ tempStore.Format(KFldFormatFieldNumber, &KFldFinish, index);
+ TPoint endPoint;
+ if ( !GetPointFromConfig(aSection, tempStore, endPoint) )
+ {
+ moreData=EFalse;
+ }
+
+ if ( moreData )
+ {
+ // get the expected color from testdata
+ tempStore.Format(KFldFormatFieldNumber, &KFldExpected, index);
+ TRgb expected;
+ if ( !GetRgbFromConfig(aSection, tempStore, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &tempStore);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( palette!=NULL )
+ {
+ expected=palette->NearestEntry(expected);
+ }
+
+ TLinearDDA lineDDA;
+ lineDDA.Construct(startPoint, endPoint, TLinearDDA::ECenter);
+
+ // for each pixels on the line (from start to finish points), check if its color matches expected
+ TPoint point;
+ while ( !lineDDA.SingleStep(point) )
+ {
+ TRgb actual;
+ iWsScreenDevice->GetPixel(actual, point);
+
+ if ( actual!=expected )
+ {
+ ERR_PRINTF5(KLogColor, actual.Red(), actual.Green(), actual.Blue(), actual.Alpha());
+ ERR_PRINTF5(KLogColor, expected.Red(), expected.Green(), expected.Blue(), expected.Alpha());
+ ERR_PRINTF3(KLogPoint, point.iX, point.iY);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+ }
+
+ delete palette;
+ }
+
+/**
+* DoCmdcheckRectColor: to check the color of specified rectangle on the screen device, and
+* compare with the expected color specidied in the TEF testdata.
+* rect<n>: specify the rectangle area on the screen device to check
+* expected<n>: specify the expected color to be compared with
+*
+*/
+void CT_DataWsScreenDevice::DoCmdcheckRectColor(const TDesC& aSection)
+ {
+ TBuf<KMaxTestExecuteCommandLength> tempStore;
+
+ CPalette* palette=NULL;
+ iWsScreenDevice->GetPalette(palette);
+
+ TBool moreData=ETrue;
+ for ( TInt index=1; moreData; ++index )
+ {
+ // get the the rectangle to check/verify
+ tempStore.Format(KFldFormatFieldNumber, &KFldRect, index);
+ TRect rect;
+ if ( !GetRectFromConfig(aSection, tempStore, rect) )
+ {
+ moreData=EFalse;
+ }
+ else
+ {
+ // get the expected color from testdata
+ tempStore.Format(KFldFormatFieldNumber, &KFldExpected, index);
+ TRgb expected;
+ if ( !GetRgbFromConfig(aSection, tempStore, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &tempStore);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( palette!=NULL )
+ {
+ expected=palette->NearestEntry(expected);
+ }
+
+ TPoint point;
+ for ( point.iX=rect.iTl.iX; point.iX<rect.iBr.iX; ++point.iX)
+ {
+ for ( point.iY=rect.iTl.iY; point.iY<rect.iBr.iY; ++point.iY )
+ {
+ TRgb actual;
+ iWsScreenDevice->GetPixel(actual, point);
+
+ if ( actual!=expected )
+ {
+ ERR_PRINTF5(KLogColor, actual.Red(), actual.Green(), actual.Blue(), actual.Alpha());
+ ERR_PRINTF5(KLogColor, expected.Red(), expected.Green(), expected.Blue(), expected.Alpha());
+ ERR_PRINTF3(KLogPoint, point.iX, point.iY);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ delete palette;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsSession.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,2440 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_DataWsSession.h"
+#include "T_GraphicsUtil.h"
+#include "T_DataWindowGroup.h"
+
+// EPOC Includes
+#include <apgtask.h>
+#include <w32std.h>
+#include <gdi.h>
+
+/*@{*/
+_LIT(KDataClassname, "RWsSession");
+
+/// Fields
+_LIT(KFldCheckWithStore, "checkwithstore");
+_LIT(KFldExpected, "expected");
+_LIT(KFldKeyCode, "keycode");
+_LIT(KFldModifier, "modifier");
+_LIT(KFldModifierMask, "modifiermask");
+_LIT(KFldModifiers, "modifiers");
+_LIT(KFldNullPointer, "nullpointer");
+_LIT(KFldOffset, "offset");
+_LIT(KFldRepeats, "repeats");
+_LIT(KFldStdScanCode, "stdscancode");
+_LIT(KFldType, "type");
+_LIT(KFldStore, "store");
+_LIT(KFldPos, "pos");
+_LIT(KFldDeviceNumber, "devicenumber");
+_LIT(KFldTip, "tip");
+_LIT(KFldIdentifier, "identifier");
+_LIT(KFldSpriteMember, "spritemember");
+_LIT(KFldSpriteFlags, "spriteflags");
+_LIT(KFldAlignment, "alignment");
+_LIT(KFldWindowGroup, "windowgroup");
+
+/// Parameters
+
+_LIT(KLogMessage, "logMessage");
+_LIT(KLogCommand, "logCommand");
+_LIT(KTPoint, "point");
+_LIT(KInputWGId, "inputWGId");
+_LIT(KBGColour, "bgcolour");
+_LIT(KInputCursorNumber, "inputcursornumber");
+_LIT(KComputeMode, "computemode");
+_LIT(KInputScrnNo, "inputscreenno");
+_LIT(KDefDisplayMode, "defDisplayMode");
+_LIT(KDefModeMaxNumColor, "defModeMaxNumColor");
+_LIT(KDefModeMaxNumGray, "defModeMaxNumGray");
+_LIT(KWindowGroupIdentifier, "wgIdentifier");
+_LIT(KInputDefaultCursorNumber, "defaultsyscurnum");
+_LIT(KUseRfs, "userfs");
+_LIT(KExpectedHeapCount, "heapCount");
+_LIT(KExpectPtrCursorMode, "expectptrcurmode");
+_LIT(KExpectBgColour, "expectbgcolour");
+_LIT(KExpectedDiff, "expected_diff");
+_LIT(KSetBuffer, "setbuffer");
+_LIT(KSetMaxBuffer, "setmaxbuffer");
+_LIT(KSetFocusScreen, "setfocusscreen");
+_LIT(KSetEventOffOn, "seteventoffon");
+_LIT(KWTreeNodeObj, "treenodeobj");
+_LIT(KExpectShadowVector, "expectshdwvet");
+_LIT(KAutoFlushState, "newFlushstate");
+_LIT(KExpectFlushState, "expectedFlushstate");
+_LIT(KVersionBuild, "build");
+_LIT(KVersionMajor, "major");
+_LIT(KVersionMinor, "minor");
+_LIT(KWGUseArray, "usearray");
+_LIT(KWGListPriority, "priority");
+_LIT(KWGGivenPriority, "givenwgpriority");
+_LIT(KWGSpecifieScrnNo, "specifiescrnno");
+_LIT(KWGScreenNumber, "screennum");
+_LIT(KWGOrdinalId, "identifier");
+_LIT(KWGOrdinalPosition, "position");
+_LIT(KWGOrdinalPriority, "wgid");
+_LIT(KWGinquiredId, "inquiredwgid");
+_LIT(KFindWGPreId, "prewgid");
+_LIT(KMatchWGString, "matchwgname");
+_LIT(KThreadId, "threadid");
+_LIT(KRequestEvent, "requestevent");
+_LIT(KRequestRedraw, "requestRedraw");
+_LIT(KPKPriorityKey, "prioritykey");
+_LIT(KSetHotKey, "hotkey");
+_LIT(KClsHotKey, "clshotkey");
+_LIT(KRestoreDefHotKey, "restoredefhk");
+_LIT(KSetKeyCode, "keycode");
+_LIT(KDblClickInterval, "maxinterval");
+_LIT(KDblClickDistance, "maxdistance");
+_LIT(KExpectedDblMaxInitialTime, "expecteddblmaxinittime");
+_LIT(KExpectedDblDistance, "expecteddblmaxdistance");
+_LIT(KSetKBRepRateInterval, "kbreprateinterval");
+_LIT(KSetKBRepRateTime, "kbrepratetime");
+_LIT(KWGGetExpectedKBInitialTime, "expectedkbinittime");
+_LIT(KWGGetExpectedKBRepeatTime, "expectedkbRepeattime");
+_LIT(KSetSysFading, "sysfadonoff");
+_LIT(KSetblackMapFading, "blackmapfading");
+_LIT(KSetwhiteMapFading, "whitemapfading");
+_LIT(KSetDefblackMapFading, "defblackmapfading");
+_LIT(KSetDefwhiteMapFading, "defwhitemapfading");
+_LIT(KSetShadowVec, "shadowvector");
+_LIT(KSetScrnSizeMode, "screensizemode");
+_LIT(KSetPtrCurPosValue, "ptrcurpos");
+_LIT(KPtrCurPosArea, "ptrcurarea");
+_LIT(KSetPtrCurMode, "pointercurmode");
+_LIT(KSetCltCurMode, "cltcurmode");
+_LIT(KInputPermanentModifier, "inputpermanmodif");
+_LIT(KInputPermanentModifierState, "inputpermanmodifstate");
+
+//Commands
+_LIT(KCmdnew, "new");
+_LIT(KCmdConnect, "Connect");
+_LIT(KCmdClose, "Close");
+_LIT(KCmdVersion, "Version");
+_LIT(KCmdSetHotKey, "SetHotKey");
+_LIT(KCmdClearHotKeys, "ClearHotKeys");
+_LIT(KCmdRestoreDefaultHotKey, "RestoreDefaultHotKey");
+_LIT(KCmdEventReady, "EventReady");
+_LIT(KCmdEventReadyCancel, "EventReadyCancel");
+_LIT(KCmdGetEvent, "GetEvent");
+_LIT(KCmdPurgePointerEvents, "PurgePointerEvents");
+_LIT(KCmdRedrawReady, "RedrawReady");
+_LIT(KCmdRedrawReadyCancel, "RedrawReadyCancel");
+_LIT(KCmdGetRedraw, "GetRedraw");
+_LIT(KCmdPriorityKeyReady, "PriorityKeyReady");
+_LIT(KCmdPriorityKeyReadyCancel, "PriorityKeyReadyCancel");
+_LIT(KCmdGetPriorityKey, "GetPriorityKey");
+_LIT(KCmdFlush, "Flush");
+_LIT(KCmdSetAutoFlush, "SetAutoFlush");
+_LIT(KCmdSetKeyboardRepeatRate, "SetKeyboardRepeatRate");
+_LIT(KCmdGetKeyboardRepeatRate, "GetKeyboardRepeatRate");
+_LIT(KCmdGetDoubleClickSettings, "GetDoubleClickSettings");
+_LIT(KCmdSetDoubleClick, "SetDoubleClick");
+_LIT(KCmdNumWindowGroups, "NumWindowGroups");
+_LIT(KCmdWindowGroupList, "WindowGroupList");
+_LIT(KCmdGetFocusWindowGroup, "GetFocusWindowGroup");
+_LIT(KCmdGetDefaultOwningWindow, "GetDefaultOwningWindow");
+_LIT(KCmdSetWindowGroupOrdinalPosition, "SetWindowGroupOrdinalPosition");
+_LIT(KCmdGetWindowGroupClientThreadId, "GetWindowGroupClientThreadId");
+_LIT(KCmdGetWindowGroupHandle, "GetWindowGroupHandle");
+_LIT(KCmdGetWindowGroupOrdinalPriority, "GetWindowGroupOrdinalPriority");
+_LIT(KCmdGetWindowGroupNameFromIdentifier, "GetWindowGroupNameFromIdentifier");
+_LIT(KCmdFindWindowGroupIdentifier, "FindWindowGroupIdentifier");
+_LIT(KCmdFetchMessage, "FetchMessage");
+_LIT(KCmdSetShadowVector, "SetShadowVector");
+_LIT(KCmdShadowVector, "ShadowVector");
+_LIT(KCmdSetBackgroundColor, "SetBackgroundColor");
+_LIT(KCmdGetBackgroundColor, "GetBackgroundColor");
+_LIT(KCmdSetSystemPointerCursor, "SetSystemPointerCursor");
+_LIT(KCmdClearSystemPointerCursor, "ClearSystemPointerCursor");
+_LIT(KCmdClaimSystemPointerCursorList, "ClaimSystemPointerCursorList");
+_LIT(KCmdFreeSystemPointerCursorList, "FreeSystemPointerCursorList");
+_LIT(KCmdSetCustomTextCursor, "SetCustomTextCursor");
+_LIT(KCmdResourceCount, "ResourceCount");
+_LIT(KCmdPasswordEntered, "PasswordEntered");
+_LIT(KCmdComputeMode, "ComputeMode");
+_LIT(KCmdHeapCount, "HeapCount");
+_LIT(KCmdSetModifierState, "SetModifierState");
+_LIT(KCmdGetModifierState, "GetModifierState");
+_LIT(KCmdRequestOffEvents, "RequestOffEvents");
+_LIT(KCmdGetDefModeMaxNumColors, "GetDefModeMaxNumColors");
+_LIT(KCmdGetColorModeList, "GetColorModeList");
+_LIT(KCmdSetPointerCursorArea, "SetPointerCursorArea");
+_LIT(KCmdPointerCursorArea, "PointerCursorArea");
+_LIT(KCmdSetPointerCursorMode, "SetPointerCursorMode");
+_LIT(KCmdSetClientCursorMode, "SetClientCursorMode");
+_LIT(KCmdPointerCursorMode, "PointerCursorMode");
+_LIT(KCmdSetDefaultSystemPointerCursor, "SetDefaultSystemPointerCursor");
+_LIT(KCmdClearDefaultSystemPointerCursor, "ClearDefaultSystemPointerCursor");
+_LIT(KCmdSetPointerCursorPosition, "SetPointerCursorPosition");
+_LIT(KCmdPointerCursorPosition, "PointerCursorPosition");
+_LIT(KCmdSetDefaultFadingParameters, "SetDefaultFadingParameters");
+_LIT(KCmdPrepareForSwitchOff, "PrepareForSwitchOff");
+_LIT(KCmdSetBufferSizeL, "SetBufferSizeL");
+_LIT(KCmdSetMaxBufferSizeL, "SetMaxBufferSizeL");
+_LIT(KCmdSetSystemFaded, "SetSystemFaded");
+_LIT(KCmdSetFocusScreen, "SetFocusScreen");
+_LIT(KCmdGetFocusScreen, "GetFocusScreen");
+_LIT(KCmdClearAllRedrawStores, "ClearAllRedrawStores");
+_LIT(KCmdLogCommand, "LogCommand");
+_LIT(KCmdLogMessage, "LogMessage");
+_LIT(KCmdNumberOfScreens, "NumberOfScreens");
+_LIT(KCmdSimulateRawEvent, "SimulateRawEvent");
+_LIT(KCmdSimulateKeyEvent, "SimulateKeyEvent");
+
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+_LIT(KLogNotExpectedValue, "Not expected value");
+
+//constants
+const TInt KGroupNameMaxSize =100;
+
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsSession* CT_DataWsSession::NewL()
+ {
+ CT_DataWsSession* ret=new (ELeave) CT_DataWsSession();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+CT_DataWsSession::CT_DataWsSession()
+: CDataWrapperBase()
+, iWsSession(NULL)
+, iResourceCount(0)
+, iNumWinGroup(0)
+, iColorModeCount(0)
+, iWindowGroupIdentifier(0)
+, iActiveEventReady(NULL)
+, iActivePriorityKeyReady(NULL)
+, iActiveRedrawReady(NULL)
+ {
+ }
+
+void CT_DataWsSession::ConstructL()
+ {
+ iActiveEventReady=CActiveCallback::NewL(*this);
+ iActivePriorityKeyReady=CActiveCallback::NewL(*this);
+ iActiveRedrawReady=CActiveCallback::NewL(*this);
+ }
+
+CT_DataWsSession::~CT_DataWsSession()
+ {
+ DestroyData();
+ delete iActiveRedrawReady;
+ iActiveRedrawReady=NULL;
+ delete iActivePriorityKeyReady;
+ iActivePriorityKeyReady=NULL;
+ delete iActiveEventReady;
+ iActiveEventReady=NULL;
+ }
+
+void CT_DataWsSession::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWsSession = static_cast<RWsSession*> (aAny);
+ }
+
+void CT_DataWsSession::DisownObjectL()
+ {
+ iWsSession = NULL;
+ }
+
+void CT_DataWsSession::DestroyData()
+ {
+ delete iWsSession;
+ iWsSession=NULL;
+ }
+
+MWsClientClass* CT_DataWsSession::GetClientClass() const
+ {
+ return iWsSession;
+ }
+
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsSession::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdnew || aCommand==KDataClassname )
+ {
+ DoCmdnew();
+ }
+ else if ( aCommand==KCmdConnect )
+ {
+ DoCmdConnectL(aSection);
+ }
+ else if ( aCommand==KCmdClose )
+ {
+ DoCmdClose();
+ }
+ else if ( aCommand==KCmdVersion )
+ {
+ DoCmdVersion(aSection);
+ }
+ else if ( aCommand==KCmdSetHotKey )
+ {
+ DoCmdSetHotKey(aSection);
+ }
+ else if ( aCommand==KCmdClearHotKeys )
+ {
+ DoCmdClearHotKeys(aSection);
+ }
+ else if ( aCommand==KCmdRestoreDefaultHotKey )
+ {
+ DoCmdRestoreDefaultHotKey(aSection);
+ }
+ else if ( aCommand==KCmdEventReady )
+ {
+ DoCmdEventReady(aSection, aAsyncErrorIndex);
+ }
+ else if ( aCommand==KCmdEventReadyCancel )
+ {
+ DoCmdEventReadyCancel();
+ }
+ else if ( aCommand==KCmdGetEvent )
+ {
+ DoCmdGetEventL(aSection);
+ }
+ else if ( aCommand==KCmdPurgePointerEvents )
+ {
+ DoCmdPurgePointerEvents();
+ }
+ else if ( aCommand==KCmdRedrawReady )
+ {
+ DoCmdRedrawReady(aSection, aAsyncErrorIndex);
+ }
+ else if ( aCommand==KCmdRedrawReadyCancel )
+ {
+ DoCmdRedrawReadyCancel();
+ }
+ else if ( aCommand==KCmdGetRedraw )
+ {
+ DoCmdGetRedrawL(aSection);
+ }
+ else if ( aCommand==KCmdPriorityKeyReady )
+ {
+ DoCmdPriorityKeyReady(aSection, aAsyncErrorIndex);
+ }
+ else if ( aCommand==KCmdPriorityKeyReadyCancel )
+ {
+ DoCmdPriorityKeyReadyCancel();
+ }
+ else if ( aCommand==KCmdGetPriorityKey )
+ {
+ DoCmdGetPriorityKeyL(aSection);
+ }
+ else if ( aCommand==KCmdFlush )
+ {
+ DoCmdFlush();
+ }
+ else if ( aCommand==KCmdSetAutoFlush )
+ {
+ DoCmdSetAutoFlush(aSection);
+ }
+ else if ( aCommand==KCmdSetKeyboardRepeatRate )
+ {
+ DoCmdSetKeyboardRepeatRate(aSection);
+ }
+ else if ( aCommand==KCmdGetKeyboardRepeatRate )
+ {
+ DoCmdGetKeyboardRepeatRate(aSection);
+ }
+ else if ( aCommand==KCmdGetDoubleClickSettings )
+ {
+ DoCmdGetDoubleClickSettings(aSection);
+ }
+ else if ( aCommand==KCmdSetDoubleClick )
+ {
+ DoCmdSetDoubleClick(aSection);
+ }
+ else if ( aCommand==KCmdNumWindowGroups )
+ {
+ DoCmdNumWindowGroups(aSection);
+ }
+ else if ( aCommand==KCmdWindowGroupList )
+ {
+ DoCmdWindowGroupListL(aSection);
+ }
+ else if ( aCommand==KCmdGetFocusWindowGroup )
+ {
+ DoCmdGetFocusWindowGroup(aSection);
+ }
+ else if ( aCommand==KCmdGetDefaultOwningWindow )
+ {
+ DoCmdGetDefaultOwningWindow(aSection);
+ }
+ else if ( aCommand==KCmdSetWindowGroupOrdinalPosition )
+ {
+ DoCmdSetWindowGroupOrdinalPosition(aSection);
+ }
+ else if ( aCommand==KCmdGetWindowGroupClientThreadId )
+ {
+ DoCmdGetWindowGroupClientThreadId(aSection);
+ }
+ else if ( aCommand==KCmdGetWindowGroupHandle )
+ {
+ DoCmdGetWindowGroupHandle(aSection);
+ }
+ else if ( aCommand==KCmdGetWindowGroupOrdinalPriority )
+ {
+ DoCmdGetWindowGroupOrdinalPriority(aSection);
+ }
+ else if ( aCommand==KCmdGetWindowGroupNameFromIdentifier )
+ {
+ DoCmdGetWindowGroupNameFromIdentifier(aSection);
+ }
+ else if ( aCommand==KCmdFindWindowGroupIdentifier )
+ {
+ DoCmdFindWindowGroupIdentifier(aSection);
+ }
+ else if ( aCommand==KCmdFetchMessage )
+ {
+ DoCmdFetchMessage(aSection);
+ }
+ else if ( aCommand==KCmdSetShadowVector )
+ {
+ DoCmdSetShadowVector(aSection);
+ }
+ else if ( aCommand==KCmdShadowVector )
+ {
+ DoCmdShadowVector(aSection);
+ }
+ else if ( aCommand==KCmdSetBackgroundColor )
+ {
+ DoCmdSetBackgroundColor(aSection);
+ }
+ else if ( aCommand==KCmdGetBackgroundColor )
+ {
+ DoCmdGetBackgroundColor(aSection);
+ }
+ else if ( aCommand==KCmdSetSystemPointerCursor )
+ {
+ DoCmdSetSystemPointerCursor(aSection);
+ }
+ else if ( aCommand==KCmdClearSystemPointerCursor )
+ {
+ DoCmdClearSystemPointerCursor(aSection);
+ }
+ else if ( aCommand==KCmdClaimSystemPointerCursorList )
+ {
+ DoCmdClaimSystemPointerCursorList();
+ }
+ else if ( aCommand==KCmdFreeSystemPointerCursorList )
+ {
+ DoCmdFreeSystemPointerCursorList();
+ }
+ else if ( aCommand==KCmdSetCustomTextCursor )
+ {
+ DoCmdSetCustomTextCursorL(aSection);
+ }
+ else if ( aCommand==KCmdResourceCount )
+ {
+ DoCmdResourceCount(aSection);
+ }
+ else if ( aCommand==KCmdPasswordEntered )
+ {
+ DoCmdPasswordEntered();
+ }
+ else if ( aCommand==KCmdComputeMode )
+ {
+ DoCmdComputeMode(aSection);
+ }
+ else if ( aCommand==KCmdHeapCount )
+ {
+ DoCmdHeapCount(aSection);
+ }
+ else if ( aCommand==KCmdSetModifierState )
+ {
+ DoCmdSetModifierState(aSection);
+ }
+ else if ( aCommand==KCmdGetModifierState )
+ {
+ DoCmdGetModifierState(aSection);
+ }
+ else if ( aCommand==KCmdRequestOffEvents )
+ {
+ DoCmdRequestOffEventsL(aSection);
+ }
+ else if ( aCommand==KCmdGetDefModeMaxNumColors )
+ {
+ DoCmdGetDefModeMaxNumColors(aSection);
+ }
+ else if ( aCommand==KCmdGetColorModeList )
+ {
+ DoCmdGetColorModeListL(aSection);
+ }
+ else if ( aCommand==KCmdSetPointerCursorArea )
+ {
+ DoCmdSetPointerCursorArea(aSection);
+ }
+ else if ( aCommand==KCmdPointerCursorArea )
+ {
+ DoCmdPointerCursorArea(aSection);
+ }
+ else if ( aCommand==KCmdSetPointerCursorMode )
+ {
+ DoCmdSetPointerCursorMode(aSection);
+ }
+ else if ( aCommand==KCmdSetClientCursorMode )
+ {
+ DoCmdSetClientCursorMode(aSection);
+ }
+ else if ( aCommand==KCmdPointerCursorMode )
+ {
+ DoCmdPointerCursorMode(aSection);
+ }
+ else if ( aCommand==KCmdSetDefaultSystemPointerCursor )
+ {
+ DoCmdSetDefaultSystemPointerCursor(aSection);
+ }
+ else if ( aCommand==KCmdClearDefaultSystemPointerCursor )
+ {
+ DoCmdClearDefaultSystemPointerCursor();
+ }
+ else if ( aCommand==KCmdSetPointerCursorPosition )
+ {
+ DoCmdSetPointerCursorPosition(aSection);
+ }
+ else if ( aCommand==KCmdPointerCursorPosition )
+ {
+ DoCmdPointerCursorPosition(aSection);
+ }
+ else if ( aCommand==KCmdSetDefaultFadingParameters )
+ {
+ DoCmdSetDefaultFadingParameters(aSection);
+ }
+ else if ( aCommand==KCmdPrepareForSwitchOff )
+ {
+ DoCmdPrepareForSwitchOff();
+ }
+ else if ( aCommand==KCmdSetBufferSizeL )
+ {
+ DoCmdSetBufferSizeL(aSection);
+ }
+ else if ( aCommand==KCmdSetMaxBufferSizeL )
+ {
+ DoCmdSetMaxBufferSizeL(aSection);
+ }
+ else if ( aCommand==KCmdSetSystemFaded )
+ {
+ DoCmdSetSystemFaded(aSection);
+ }
+ else if ( aCommand==KCmdSetFocusScreen )
+ {
+ DoCmdSetFocusScreen(aSection);
+ }
+ else if ( aCommand==KCmdGetFocusScreen )
+ {
+ DoCmdGetFocusScreen(aSection);
+ }
+ else if ( aCommand==KCmdClearAllRedrawStores )
+ {
+ DoCmdClearAllRedrawStores();
+ }
+ else if ( aCommand==KCmdLogCommand )
+ {
+ DoCmdLogCommand(aSection);
+ }
+ else if ( aCommand==KCmdLogMessage )
+ {
+ DoCmdLogMessage(aSection);
+ }
+ else if ( aCommand==KCmdNumberOfScreens )
+ {
+ DoCmdNumberOfScreens(aSection);
+ }
+ else if ( aCommand==KCmdSimulateRawEvent )
+ {
+ DoCmdSimulateRawEvent(aSection);
+ }
+ else if ( aCommand==KCmdSimulateKeyEvent )
+ {
+ DoCmdSimulateKeyEvent(aSection);
+ }
+ else
+ {
+ ret=CT_DataWsClientClass::DoCommandL(*this, aCommand, aSection, aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+
+void CT_DataWsSession::DoCmdnew()
+ {
+ INFO_PRINTF1(_L("Session is going to create"));
+ TRAPD(err, iWsSession = new (ELeave) RWsSession());
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsSession::DoCmdConnectL(const TDesC& aSection)
+ {
+ TBool useRfs=EFalse;
+ GetBoolFromConfig(aSection, KUseRfs(), useRfs);
+
+ TInt err=KErrNone;
+ if ( useRfs )
+ {
+ INFO_PRINTF1(_L("RWsSession::Connect(RFs&) call"));
+ err=iWsSession->Connect(FileServer());
+ }
+ else
+ {
+ INFO_PRINTF1(_L("RWsSession::Connect() call"));
+ err=iWsSession->Connect();
+ }
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsSession::DoCmdClose()
+ {
+ INFO_PRINTF1(_L("RWsSession::Close() call"));
+ iWsSession->Close();
+ }
+
+void CT_DataWsSession::DoCmdVersion(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("WsSession::Version() call"));
+
+ TVersion version = iWsSession->Version();
+
+ INFO_PRINTF2(_L("Version build : %d"), (TInt)version.iBuild);
+ INFO_PRINTF2(_L("Version major : %d"), (TInt)version.iMajor);
+ INFO_PRINTF2(_L("Version minor : %d"), (TInt)version.iMinor);
+ TInt intTemp;
+ if ( GetIntFromConfig(aSection, KVersionBuild(), intTemp) )
+ {
+ if ( intTemp != version.iBuild )
+ {
+ ERR_PRINTF1(_L("Build does not match expected build"));
+ SetBlockResult(EFail);
+ }
+ }
+
+ if ( GetIntFromConfig(aSection, KVersionMajor(), intTemp) )
+ {
+ if ( intTemp != version.iMajor )
+ {
+ ERR_PRINTF1(_L("Major does not match expected major"));
+ SetBlockResult(EFail);
+ }
+ }
+
+ if ( GetIntFromConfig(aSection, KVersionMinor(), intTemp) )
+ {
+ if ( intTemp != version.iMinor )
+ {
+ ERR_PRINTF1(_L("Minor does not match expected minor"));
+ SetBlockResult(EFail);
+ }
+ }
+
+ if (version.Name() == _L("") && version.iBuild == 0 && version.iMajor == 0 && version.iMinor == 0)
+ {
+ ERR_PRINTF1(_L("Some version fields are not set!"));
+ SetBlockResult(EFail);
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetHotKey(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ THotKey hotKey;
+
+ TInt err=KErrNone;
+
+ if ( !CT_GraphicsUtil::ReadHotKey(*this, aSection, KSetHotKey(), hotKey) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KSetHotKey());
+ SetBlockResult(EFail);
+ }
+
+ TKeyCode keyCode;
+ if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KSetKeyCode(), keyCode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KSetKeyCode());
+ SetBlockResult(EFail);
+ }
+
+ TUint modifierMask=EModifierAlt | EModifierCtrl | EModifierShift | EModifierFunc | EModifierCapsLock;
+ CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifierMask, modifierMask);
+ TUint modifier=EModifierAlt | EModifierCtrl | EModifierShift | EModifierFunc | EModifierCapsLock;
+ CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifier, modifier);
+ if ( dataOk )
+ {
+ err = iWsSession->SetHotKey(hotKey, keyCode, modifierMask, modifier);
+ }
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsSession::DoCmdClearHotKeys(const TDesC& aSection)
+ {
+ THotKey hotKey;
+
+ TInt err=KErrNone;
+
+ if ( !CT_GraphicsUtil::ReadHotKey(*this, aSection, KClsHotKey(), hotKey) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KClsHotKey());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ err = iWsSession->ClearHotKeys(hotKey);
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsSession::DoCmdRestoreDefaultHotKey(const TDesC& aSection)
+ {
+ THotKey hotKey;
+
+ TInt err=KErrNone;
+
+ if ( !CT_GraphicsUtil::ReadHotKey(*this, aSection, KRestoreDefHotKey(), hotKey) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KRestoreDefHotKey());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ err = iWsSession->RestoreDefaultHotKey(hotKey);
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsSession::DoCmdEventReady(const TDesC& aSection, TInt aAsyncErrorIndex)
+ {
+ CActive::TPriority priority=CActive::EPriorityHigh;
+ CT_GraphicsUtil::ReadPriority(*this, aSection, KRequestEvent(), priority);
+
+ iActiveEventReady->SetPriority(priority);
+ INFO_PRINTF1(_L("RWsSession::EventReady() call"));
+ iWsSession->EventReady(&iActiveEventReady->iStatus);
+ iActiveEventReady->Activate(aAsyncErrorIndex);
+ IncOutstanding();
+ }
+
+void CT_DataWsSession::DoCmdEventReadyCancel()
+ {
+ iWsSession->EventReadyCancel();
+ }
+
+void CT_DataWsSession::DoCmdGetEventL(const TDesC& aSection)
+ {
+ TWsEvent event;
+
+ iWsSession->GetEvent(event);
+ INFO_PRINTF1(_L("RWsSession::GetEvent() call"));
+
+ TWsEvent* store=NULL;
+ if ( CT_GraphicsUtil::GetWsEventL(*this, aSection, KFldStore(), store) )
+ {
+ *store=event;
+ }
+ }
+
+void CT_DataWsSession::DoCmdPurgePointerEvents()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF3(_L("execute %S::%S()"), &KDataClassname, &KCmdPurgePointerEvents);
+ iWsSession->PurgePointerEvents();
+ }
+
+void CT_DataWsSession::DoCmdRedrawReady(const TDesC& aSection, TInt aAsyncErrorIndex)
+ {
+ CActive::TPriority priority=CActive::EPriorityHigh;
+ CT_GraphicsUtil::ReadPriority(*this, aSection, KRequestRedraw(), priority);
+
+ iActiveRedrawReady->SetPriority(priority);
+ INFO_PRINTF1(_L("RWsSession::RedrawReady() call"));
+ iWsSession->RedrawReady(&iActiveRedrawReady->iStatus);
+ iActiveRedrawReady->Activate(aAsyncErrorIndex);
+ IncOutstanding();
+ }
+
+void CT_DataWsSession::DoCmdRedrawReadyCancel()
+ {
+ INFO_PRINTF1(_L("RWsSession::RedrawReadyCancel() call"));
+ iWsSession->RedrawReadyCancel();
+ }
+
+void CT_DataWsSession::DoCmdGetRedrawL(const TDesC& aSection)
+ {
+ TWsRedrawEvent redrawEvent;
+
+ iWsSession->GetRedraw(redrawEvent);
+ INFO_PRINTF1(_L("RWsSession::GetRedraw() call"));
+
+ TWsRedrawEvent* store=NULL;
+ if ( CT_GraphicsUtil::GetWsRedrawEventL(*this, aSection, KFldStore(), store) )
+ {
+ *store=redrawEvent;
+ }
+ }
+
+void CT_DataWsSession::DoCmdPriorityKeyReady(const TDesC& aSection, TInt aAsyncErrorIndex)
+ {
+ CActive::TPriority priority=CActive::EPriorityHigh;
+ CT_GraphicsUtil::ReadPriority(*this, aSection, KPKPriorityKey(), priority);
+
+ iActivePriorityKeyReady->SetPriority(priority);
+ INFO_PRINTF1(_L("RWsSession::PriorityKeyReady() call"));
+ iWsSession->PriorityKeyReady(&iActivePriorityKeyReady->iStatus);
+ iActivePriorityKeyReady->Activate(aAsyncErrorIndex);
+ IncOutstanding();
+ }
+
+
+void CT_DataWsSession::DoCmdPriorityKeyReadyCancel()
+ {
+ INFO_PRINTF1(_L("RWsSession::PriorityKeyReadyCancel() call"));
+ iWsSession->PriorityKeyReadyCancel();
+ }
+
+void CT_DataWsSession::DoCmdGetPriorityKeyL(const TDesC& aSection)
+ {
+ TWsPriorityKeyEvent event;
+
+ iWsSession->GetPriorityKey(event);
+ INFO_PRINTF1(_L("RWsSession::GetPriorityKey() call"));
+
+ TWsPriorityKeyEvent * store=NULL;
+ if ( CT_GraphicsUtil::GetWsPriorityKeyEventL(*this, aSection, KFldStore(), store) )
+ {
+ *store=event;
+ }
+ }
+
+void CT_DataWsSession::DoCmdFlush()
+ {
+ INFO_PRINTF1(_L("RWsSession::Flush() call"));
+ iWsSession->Flush();
+ }
+
+void CT_DataWsSession::DoCmdSetAutoFlush(const TDesC& aSection)
+ {
+ TBool actualFlushstate;
+ TBool setFlushState=EFalse;
+ TBool expectedFlush=EFalse;
+
+ if ( !GetBoolFromConfig(aSection, KAutoFlushState(), setFlushState) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KAutoFlushState());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ actualFlushstate = iWsSession->SetAutoFlush(setFlushState);
+ INFO_PRINTF2(_L("Flush State: %d"),actualFlushstate);
+
+ if ( !GetBoolFromConfig(aSection, KExpectFlushState(), expectedFlush) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KExpectFlushState());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actualFlushstate!=expectedFlush)
+ {
+ ERR_PRINTF1(_L("SetAutoFlush is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetKeyboardRepeatRate(const TDesC& aSection)
+ {
+ TInt setInputInterval=iKeyboardRepeateRateInitialTime.Int();
+ GetIntFromConfig(aSection, KSetKBRepRateInterval(), setInputInterval);
+
+ TInt setInputTime=iKeyboardRepeateRateTime.Int();
+ GetIntFromConfig(aSection, KSetKBRepRateTime(), setInputTime);
+
+ TTimeIntervalMicroSeconds32 changeInitialTime(setInputInterval);
+ TTimeIntervalMicroSeconds32 changeTime(setInputTime);
+ iWsSession->SetKeyboardRepeatRate(changeInitialTime, changeTime);
+ }
+
+void CT_DataWsSession::DoCmdGetKeyboardRepeatRate(const TDesC& aSection)
+ {
+ TTimeIntervalMicroSeconds32 actualInitialTime;
+ TTimeIntervalMicroSeconds32 actualTime;
+ iWsSession->GetKeyboardRepeatRate(actualInitialTime, actualTime);
+ INFO_PRINTF2(_L("actual Interval Time: %d"), actualInitialTime.Int());
+ INFO_PRINTF2(_L("actual Time: %d"), actualTime.Int());
+
+ TInt expectInitialTime;
+ if( GetIntFromConfig(aSection, KWGGetExpectedKBInitialTime(), expectInitialTime))
+ {
+ if ( actualInitialTime.Int()!=expectInitialTime )
+ {
+ ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+
+ TInt expectTime;
+ if ( GetIntFromConfig(aSection, KWGGetExpectedKBRepeatTime(), expectTime) )
+ {
+ if ( actualTime.Int()!=expectTime)
+ {
+ ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+
+ TBool checkWithStore=FALSE;
+ GetBoolFromConfig(aSection, KFldCheckWithStore(), checkWithStore);
+ if ( checkWithStore )
+ {
+ if ( iKeyboardRepeateRateInitialTime!=actualInitialTime )
+ {
+ ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ if ( iKeyboardRepeateRateTime!=actualTime )
+ {
+ ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+
+ TBool store=FALSE;
+ GetBoolFromConfig(aSection, KFldStore(), store);
+ if ( store )
+ {
+ iKeyboardRepeateRateInitialTime=actualInitialTime;
+ iKeyboardRepeateRateTime=actualTime;
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetDoubleClick(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TInt setMaxInputInterval;
+ if ( !GetIntFromConfig(aSection, KDblClickInterval(), setMaxInputInterval) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KDblClickInterval());
+ SetBlockResult(EFail);
+ }
+
+ TInt setMaxDistance;
+ if ( !GetIntFromConfig(aSection, KDblClickDistance(), setMaxDistance) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KDblClickDistance());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ TTimeIntervalMicroSeconds32 changeMaxIntervalTime(setMaxInputInterval);
+ iWsSession->SetDoubleClick(changeMaxIntervalTime, setMaxDistance);
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetDoubleClickSettings(const TDesC& aSection)
+ {
+ TTimeIntervalMicroSeconds32 actualMaxIntervalValue;
+ TInt actualMaxDistanceValue;
+ iWsSession->GetDoubleClickSettings(actualMaxIntervalValue, actualMaxDistanceValue);
+ INFO_PRINTF2(_L("Maximum interval: %d"), actualMaxIntervalValue.Int());
+ INFO_PRINTF2(_L("Maximum distance : %d"), actualMaxDistanceValue);
+
+ TInt expectMaxIntervalValue;
+ if ( !GetIntFromConfig(aSection, KExpectedDblMaxInitialTime(), expectMaxIntervalValue))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KExpectedDblMaxInitialTime());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actualMaxIntervalValue.Int()!=expectMaxIntervalValue )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+
+ TInt expectMaxDistanceValue;
+ if ( !GetIntFromConfig(aSection, KExpectedDblDistance(), expectMaxDistanceValue))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KExpectedDblDistance());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actualMaxDistanceValue!=expectMaxDistanceValue)
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdNumWindowGroups(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TInt previousCount=iNumWinGroup;
+
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+ TInt priority;
+ if ( GetIntFromConfig(aSection, KWGGivenPriority(), priority) )
+ {
+ TInt screenNumber=0;
+ if ( !GetIntFromConfig(aSection, KWGSpecifieScrnNo(), screenNumber) )
+ {
+ iNumWinGroup=iWsSession->NumWindowGroups(priority);
+ INFO_PRINTF2(_L("NumWindowGroups(TInt aPriority):%d"), iNumWinGroup);
+ }
+ else
+ {
+ iNumWinGroup=iWsSession->NumWindowGroups(screenNumber, priority);
+ INFO_PRINTF2(_L("NumWindowGroups(TInt aScreenNumber, TInt aPriority):%d"), iNumWinGroup);
+ }
+ }
+ else
+#endif
+ {
+ iNumWinGroup=iWsSession->NumWindowGroups();
+ INFO_PRINTF2(_L("NumWindowGroups():%d"), iNumWinGroup);
+ }
+
+ if ( dataOk )
+ {
+ TInt difference=0;
+ if ( GetIntFromConfig(aSection, KExpectedDiff(), difference) )
+ {
+ if ( (iNumWinGroup-previousCount)!=difference )
+ {
+ ERR_PRINTF2(_L("Previous count:%d"), previousCount);
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdWindowGroupListL(const TDesC& aSection)
+ {
+ INFO_PRINTF2(_L("iNumWinGroup:%d"), iNumWinGroup);
+ RArray<RWsSession::TWindowGroupChainInfo> numWGListRArray(1);
+ CArrayFixFlat<TInt>* numWGListCArray=new (ELeave) CArrayFixFlat<TInt>(iNumWinGroup);
+ CleanupStack::PushL(numWGListCArray);
+ CleanupClosePushL(numWGListRArray);
+
+ //True:CArrayFixFlat Flase:RArray
+ TInt priority;
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+ TBool hasPriority=CT_GraphicsUtil::ReadPriorities(*this, aSection, KWGListPriority(), priority);
+#else
+ TBool hasPriority=GetIntFromConfig(aSection, KWGListPriority(), priority);
+#endif
+
+ TBool useClassArray;
+ if ( !GetBoolFromConfig(aSection, KWGUseArray(), useClassArray) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KWGUseArray());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TInt err=KErrNone;
+ INFO_PRINTF2(_L("Use Class array:%d"), useClassArray);
+
+ if ( useClassArray )
+ {
+ if( hasPriority )
+ {
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+ TInt theScrnNum;
+ if( GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum))
+ {
+ INFO_PRINTF1(_L("WindowGroupList(CArrayFixFlat< TInt >*, TInt, TInt)"));
+ err=iWsSession->WindowGroupList(numWGListCArray, theScrnNum, priority);
+ }
+ else
+#endif
+ {
+ INFO_PRINTF1(_L("WindowGroupList(TInt, CArrayFixFlat<TInt>*)"));
+ err=iWsSession->WindowGroupList(priority, numWGListCArray);
+ }
+ }
+ else
+ {
+ INFO_PRINTF1(_L("WindowGroupList(CArrayFixFlat<TInt>*)"));
+ err=iWsSession->WindowGroupList(numWGListCArray);
+ }
+ }
+ else
+ {
+ if ( hasPriority )
+ {
+ INFO_PRINTF1(_L("WindowGroupList(TInt, RArray<RWsSession::TWindowGroupChainInfo>*)"));
+ err=iWsSession->WindowGroupList(priority, &numWGListRArray);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("WindowGroupList(RArray<RWsSession::TWindowGroupChainInfo>)"));
+ err=iWsSession->WindowGroupList(&numWGListRArray);
+ }
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ if ( useClassArray )
+ {
+ TInt actual=0;
+ INFO_PRINTF2(_L("numWGListCArray:%d"), numWGListCArray->Count());
+ for ( TInt index=0; index<numWGListCArray->Count(); ++index )
+ {
+ // Gets a list of identifiers of all window groups in all window server sessions
+ actual=(*numWGListCArray)[index];
+ INFO_PRINTF3(_L("CArrayFixFlat[%d]= :%d"), index, actual);
+ }
+ }
+ else
+ {
+ RWsSession::TWindowGroupChainInfo actual;
+ INFO_PRINTF2(_L("numWGListRArray:%d"), numWGListRArray.Count());
+ for ( TInt index=0; index<numWGListRArray.Count(); ++index )
+ {
+ // Gets a list of identifiers of all window groups in all window server sessions
+ actual=numWGListRArray[index];
+ INFO_PRINTF4(_L("RArray{%d] iId:%d iParentId:%d"), index, actual.iId, actual.iParentId);
+ }
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(2, numWGListCArray);
+ }
+
+void CT_DataWsSession::DoCmdGetFocusWindowGroup(const TDesC& aSection)
+ {
+ TInt actual=0;
+
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+ TInt theScrnNum=0;
+ if ( GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum) )
+ {
+ INFO_PRINTF1(_L("RWsSession::GetFocusWindowGroup(TInt aScreenNumber) call"));
+ actual=iWsSession->GetFocusWindowGroup(theScrnNum);
+ }
+ else
+#endif
+ {
+ INFO_PRINTF1(_L("RWsSession::GetFocusWindowGroup() call"));
+ actual=iWsSession->GetFocusWindowGroup();
+ }
+ INFO_PRINTF2(_L("Window Group Identifier:%d"), actual);
+
+ TInt expected=0;
+ if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(_L("Window group identifier is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetDefaultOwningWindow(const TDesC& aSection)
+ {
+ TInt actual=0;
+ TBool dataOk=ETrue;
+
+ TInt theScrnNum=0;
+ if( GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum))
+ {
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+ INFO_PRINTF1(_L("RWsSession::GetDefaultOwningWindow(TInt aScreenNumber) call"));
+ actual=iWsSession->GetDefaultOwningWindow(theScrnNum);
+#else
+ dataOk=EFalse;
+ ERR_PRINTF1(_L("SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS Not Supported"));
+ SetBlockResult(EFail);
+#endif
+ }
+ else
+ {
+ INFO_PRINTF1(_L("RWsSession::GetDefaultOwningWindow() call"));
+ actual=iWsSession->GetDefaultOwningWindow();
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF2(_L("default owning window:%d"), actual);
+
+ TInt expected=0;
+ if ( !GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected)
+ {
+ ERR_PRINTF1(_L("Default Owning Window is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetWindowGroupOrdinalPosition(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TInt inputWGId;
+ if ( !GetIntFromConfig(aSection, KWGOrdinalId(), inputWGId) )
+ {
+ TPtrC objectName;
+ if ( GetStringFromConfig(aSection, KFldWindowGroup(), objectName) )
+ {
+ INFO_PRINTF1(_L("Get CT_DataWindowGroup's wrapper. "));
+ CDataWrapperBase* wrapper = NULL;
+ wrapper = static_cast<CDataWrapperBase*>(GetDataWrapperL(objectName));
+ if(wrapper)
+ {
+ inputWGId=wrapper->GetIdentifier();
+ INFO_PRINTF2(_L("Window group's identifier is: %d"), inputWGId);
+ }
+ else
+ {
+ dataOk=EFalse;
+ ERR_PRINTF1(_L("Window group's wrapper pointer is NULL"));
+ SetBlockResult(EFail);
+ }
+ }
+ else
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KWGOrdinalId());
+ SetBlockResult(EFail);
+ }
+ }
+
+ TInt inputWGOrdinalPos;
+ if ( !GetIntFromConfig(aSection, KWGOrdinalPosition(), inputWGOrdinalPos) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KWGOrdinalPosition());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ TInt err=iWsSession->SetWindowGroupOrdinalPosition(inputWGId, inputWGOrdinalPos);
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetWindowGroupClientThreadId(const TDesC& aSection)
+ {
+ TInt inputWindowGroupIdentifier=0;
+ if ( !GetIntFromConfig(aSection, KWindowGroupIdentifier(), inputWindowGroupIdentifier) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KWindowGroupIdentifier());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TThreadId threadId;
+ TInt err=iWsSession->GetWindowGroupClientThreadId(inputWindowGroupIdentifier, threadId);
+ TUint64 actual=threadId.Id();
+ INFO_PRINTF1(_L("RWsSession::GetWindowGroupClientThreadId"));
+ INFO_PRINTF2(_L("actual ThreadId:%d"), actual);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetWindowGroupHandle(const TDesC& aSection)
+ {
+ TInt inputWGId=0;
+ if ( !GetIntFromConfig(aSection, KInputWGId(), inputWGId) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KInputWGId());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TInt actual=iWsSession->GetWindowGroupHandle(inputWGId);
+ INFO_PRINTF2(_L("Window group handle :%d"), actual);
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetWindowGroupOrdinalPriority(const TDesC& aSection)
+ {
+ TInt inputWGId=0;
+ if ( !GetIntFromConfig(aSection, KWGOrdinalPriority(), inputWGId))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KWGOrdinalPriority());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TInt actual=iWsSession->GetWindowGroupOrdinalPriority(inputWGId);
+ INFO_PRINTF2(_L("Window Group Ordinal Priority:%d"), actual);
+
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetWindowGroupNameFromIdentifier(const TDesC& aSection)
+ {
+ TInt inquiredWGId=0;
+ TInt rtnStatus;
+
+ if ( !GetIntFromConfig(aSection, KWGinquiredId(), inquiredWGId) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KWGinquiredId());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ TBuf<KGroupNameMaxSize> storeAWindowName;
+ INFO_PRINTF2(_L("Window Group inquired Id:%d"),inquiredWGId);
+ rtnStatus= iWsSession->GetWindowGroupNameFromIdentifier(inquiredWGId, storeAWindowName);
+ INFO_PRINTF2(_L("return status:%d"),rtnStatus);
+
+ if (rtnStatus==KErrNone)
+ {
+ INFO_PRINTF2(_L("the length of buffer:%d"),storeAWindowName.Length());
+ INFO_PRINTF1(_L("the name of window group:"));
+ INFO_PRINTF1(storeAWindowName);
+ }
+ else
+ {
+ ERR_PRINTF1(_L("GetWindowGroupNameFromIdentifier function is fail!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdFindWindowGroupIdentifier(const TDesC& aSection)
+ {
+ TInt previousId=iWindowGroupIdentifier;
+ GetIntFromConfig(aSection, KFindWGPreId(), previousId);
+ INFO_PRINTF2(_L("previous window group id:%d"), previousId);
+
+ TInt nextId;
+ TPtrC matchString;
+ if ( GetStringFromConfig(aSection, KMatchWGString(), matchString) )
+ {
+ TInt offset=0;
+ GetIntFromConfig(aSection, KFldOffset(), offset);
+ nextId=iWsSession->FindWindowGroupIdentifier(previousId, matchString, offset);
+ }
+ else
+ {
+ RThread proc;
+ TThreadId threadId=proc.Id();
+
+ TInt id;
+ if ( GetIntFromConfig(aSection, KThreadId(), id) )
+ {
+ threadId=id;
+ }
+ nextId=iWsSession->FindWindowGroupIdentifier(previousId, threadId);
+ }
+
+ if ( nextId<0 )
+ {
+ ERR_PRINTF1(_L("failed to find Window group name function !"));
+ SetError(nextId);
+ }
+ else
+ {
+ iWindowGroupIdentifier=nextId;
+ }
+ }
+
+void CT_DataWsSession::DoCmdFetchMessage(const TDesC& aSection)
+ {
+ TUid uid;
+ TPtr8 params(NULL,0);
+ TWsEvent event;
+ TInt err=iWsSession->FetchMessage(uid, params, event);
+ TInt expected;
+ if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ if ( err!=expected )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetShadowVector(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPoint setPtShdwVet;
+ if ( !GetPointFromConfig(aSection, KSetShadowVec(), setPtShdwVet) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSetShadowVec());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetShadowVector(const TPoint &aVector)"));
+ iWsSession->SetShadowVector(setPtShdwVet);
+ }
+ }
+
+void CT_DataWsSession::DoCmdShadowVector(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPoint actual=iWsSession->ShadowVector();
+ INFO_PRINTF3(_L("execute ShadowVector() x=%d y=%d"), actual.iX, actual.iY);
+
+ TPoint expected;
+ if ( !GetPointFromConfig(aSection, KExpectShadowVector(), expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KExpectShadowVector());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(_L("The current value of the shadow vector is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetBackgroundColor(const TDesC& aSection)
+ {
+ TRgb datColour;
+ if ( !GetRgbFromConfig(aSection, KBGColour, datColour) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KBGColour());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetColor(TRgb)"));
+ iWsSession->SetBackgroundColor(datColour);
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetBackgroundColor(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRgb actualBgColour=iWsSession->GetBackgroundColor();
+
+ TRgb expectBgColour;
+ if ( !GetRgbFromConfig(aSection, KExpectBgColour(), expectBgColour) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KExpectBgColour());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actualBgColour!=expectBgColour )
+ {
+ ERR_PRINTF1(_L("The current value of the shadow vector is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetSystemPointerCursor(const TDesC& aSection)
+ {
+ RWsPointerCursor sysPointerCursor=RWsPointerCursor(*iWsSession);
+
+ INFO_PRINTF1(_L("RWsSession::SetSystemPointerCursor() call"));
+ TInt inputCursorNumber=0;
+ if ( !GetIntFromConfig(aSection, KInputCursorNumber(), inputCursorNumber) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KExpectBgColour());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("CursorNumber:%d"),inputCursorNumber);
+ TInt err=iWsSession->SetSystemPointerCursor(sysPointerCursor,inputCursorNumber);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdClearSystemPointerCursor(const TDesC& aSection)
+ {
+ TInt inputCursorNumber=0;
+
+ if ( !GetIntFromConfig(aSection, KInputCursorNumber(), inputCursorNumber) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KInputCursorNumber());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("CursorNumber:%d"),inputCursorNumber);
+ INFO_PRINTF1(_L("RWsSession::ClearSystemPointerCursor"));
+ iWsSession->ClearSystemPointerCursor(inputCursorNumber);
+ }
+ }
+
+void CT_DataWsSession::DoCmdClaimSystemPointerCursorList()
+ {
+ INFO_PRINTF1(_L("RWsSession::ClaimSystemPointerCursorList() call"));
+ TInt err=iWsSession->ClaimSystemPointerCursorList();
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+
+void CT_DataWsSession::DoCmdFreeSystemPointerCursorList()
+ {
+ INFO_PRINTF1(_L("RWsSession::FreeSystemPointerCursorList() call"));
+ iWsSession->FreeSystemPointerCursorList();
+ }
+
+void CT_DataWsSession::DoCmdSetCustomTextCursorL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TInt identifier;
+ if ( !GetIntFromConfig(aSection, KFldIdentifier(), identifier) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldIdentifier);
+ SetBlockResult(EFail);
+ }
+
+ CArrayFixFlat<TSpriteMember>* spriteMember = new (ELeave) CArrayFixFlat<TSpriteMember>(1);
+ if ( !CT_GraphicsUtil::GetSpriteMemberListL(*this, aSection, KFldSpriteMember, *spriteMember) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSpriteMember);
+ SetBlockResult(EFail);
+ }
+ TArray<TSpriteMember> spriteArray = spriteMember->Array();
+
+ TSpriteFlags spriteFlags;
+ if ( !CT_GraphicsUtil::ReadSpriteFlags(*this, aSection, KFldSpriteFlags, spriteFlags) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSpriteFlags);
+ SetBlockResult(EFail);
+ }
+
+ RWsSession::TCustomTextCursorAlignment alignment;
+ if ( !CT_GraphicsUtil::ReadCustomTextCursorAlignment(*this, aSection, KFldAlignment, alignment) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldAlignment);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("SetCustomTextCursor(TInt, TArray< TSpriteMember >, TUint, TCustomTextCursorAlignment)"));
+ TInt err=iWsSession->SetCustomTextCursor(identifier, spriteArray, (TUint)spriteFlags, alignment);
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdResourceCount(const TDesC& aSection)
+ {
+ TInt resourceCount=iWsSession->ResourceCount();
+ INFO_PRINTF2(_L("RWsSession::ResourceCount() %d"), resourceCount);
+
+ // get expected difference from parameters
+ TInt expectedDifference;
+ if ( GetIntFromConfig(aSection, KExpectedDiff(), expectedDifference) )
+ {
+ TInt actualDifference=resourceCount-iResourceCount;
+ if ( actualDifference != expectedDifference )
+ {
+ ERR_PRINTF3(_L("Resource count difference is not as expected! expected: %d, actual: %d"), expectedDifference, actualDifference);
+ SetBlockResult(EFail);
+ }
+ }
+ iResourceCount = resourceCount;
+ }
+
+void CT_DataWsSession::DoCmdPasswordEntered()
+ {
+ INFO_PRINTF1(_L("RWsSession::PasswordEntered() call"));
+ iWsSession->PasswordEntered();
+ }
+
+void CT_DataWsSession::DoCmdComputeMode(const TDesC& aSection)
+ {
+ RWsSession::TComputeMode mode;
+
+ INFO_PRINTF1(_L("RWsSession::ComputeMode() call"));
+ if ( !CT_GraphicsUtil::ReadComputeMode(*this, aSection, KComputeMode(), mode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KComputeMode());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iWsSession->ComputeMode(mode);
+ }
+ }
+
+
+void CT_DataWsSession::DoCmdHeapCount(const TDesC& aSection)
+ {
+ TInt expectedCount;
+ TInt heapCount;
+
+ if ( !GetIntFromConfig(aSection, KExpectedHeapCount(), expectedCount) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KExpectedHeapCount());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("expected count: %d"), expectedCount);
+ INFO_PRINTF1(_L("RWsSession::HeapCount() call"));
+ heapCount=iWsSession->HeapCount();
+ INFO_PRINTF2(_L("RWsSession::HeapCount(): %d"), heapCount);
+ if ( expectedCount > heapCount )
+ {
+ ERR_PRINTF3(_L("Heap count is lower than expected! expected: %d, actual: %d"), expectedCount, heapCount);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetModifierState(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TEventModifier eventModifier;
+ if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KInputPermanentModifier(), eventModifier) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KInputPermanentModifier());
+ SetBlockResult(EFail);
+ }
+
+ TModifierState modifierState;
+ if( !CT_GraphicsUtil::ReadModifierState(*this, aSection, KInputPermanentModifierState(), modifierState) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KInputPermanentModifierState());
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("RWsSession::SetModifierState"));
+ TInt err = iWsSession->SetModifierState(eventModifier, modifierState);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetModifierState(const TDesC& aSection)
+ {
+ TInt actual=iWsSession->GetModifierState();
+ INFO_PRINTF2(_L("GetModifierState:%d"), actual);
+
+ TUint expected=0;
+ if ( CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldExpected(), expected) )
+ {
+ if ( actual!=(TInt)expected )
+ {
+ ERR_PRINTF1(_L("ModifierState is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdRequestOffEventsL(const TDesC& aSection)
+ {
+ TBool eventOffOn;
+ if ( !GetBoolFromConfig(aSection, KSetEventOffOn(), eventOffOn) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSetEventOffOn());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ RWindowTreeNode* treeNodeObj=NULL;
+ TPtrC treeNodeObjectName;
+ if ( GetStringFromConfig(aSection, KWTreeNodeObj(), treeNodeObjectName) )
+ {
+ treeNodeObj = static_cast<RWindowTreeNode*>(GetDataObjectL(treeNodeObjectName));
+ }
+
+ INFO_PRINTF1(_L("RWsSession::RequestOffEvents(TBool, RWindowTreeNode*) call"));
+ TInt err=iWsSession->RequestOffEvents(eventOffOn, treeNodeObj);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetDefModeMaxNumColors(const TDesC& aSection)
+ {
+ TInt colors;
+ TInt grays;
+
+ INFO_PRINTF1(_L("RWsSession::GetDefModeMaxNumColors(TInt &aColor, TInt &aGray) call"));
+
+ TDisplayMode displayMode;
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+ TInt theScrnNum=0;
+ if ( GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum) )
+ {
+ displayMode=iWsSession->GetDefModeMaxNumColors(theScrnNum, colors, grays);
+ }
+ else
+#endif
+ {
+ displayMode=iWsSession->GetDefModeMaxNumColors(colors, grays);
+ }
+ INFO_PRINTF4(_L("RWsSession::GetDefModeMaxNumColors() DisplayMode:%d Colors:%d Grays:%d"), displayMode, colors, grays);
+
+ TDisplayMode expectedDisplayMode;
+ if ( CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDefDisplayMode(), expectedDisplayMode) )
+ {
+ if ( expectedDisplayMode!=displayMode )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ TInt expected=0;
+ if ( GetIntFromConfig(aSection, KDefModeMaxNumColor(), expected) )
+ {
+ if ( expected!=colors )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ if ( GetIntFromConfig(aSection, KDefModeMaxNumGray(), expected) )
+ {
+ if ( expected!=grays )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetColorModeListL(const TDesC& aSection)
+ {
+ TBool nullPointer=EFalse;
+ GetBoolFromConfig(aSection, KFldNullPointer(), nullPointer);
+
+ CArrayFixFlat<TInt>* modeList=NULL;
+ if ( !nullPointer )
+ {
+ modeList=new (ELeave) CArrayFixFlat<TInt>(iColorModeCount);
+ }
+ CleanupStack::PushL(modeList);
+
+ TBool dataOk=ETrue;
+ TInt err=KErrNone;
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+ TInt inputScreenNo=0;
+ if ( GetIntFromConfig(aSection, KInputScrnNo(), inputScreenNo))
+ {
+ INFO_PRINTF1(_L("RWsSession::GetColorModeList(TInt aScreenNumber, CArrayFixFlat< TInt > *aModeList) call"));
+ err=iWsSession->GetColorModeList(inputScreenNo, modeList);
+ }
+ else
+#endif
+ {
+ INFO_PRINTF1(_L("RWsSession::GetColorModeList(CArrayFixFlat< TInt > *aModeList) call"));
+ err=iWsSession->GetColorModeList(modeList);
+ }
+
+ if ( err<KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ else
+ {
+ if ( dataOk )
+ {
+ if ( nullPointer )
+ {
+ iColorModeCount=err;
+ }
+ else
+ {
+ INFO_PRINTF2(_L("Color Mode List array count:%d"), modeList->Count());
+ for ( TInt index=0; index<modeList->Count(); ++index )
+ {
+ INFO_PRINTF2(_L("Content of Color Mode List:%d"), (*modeList)[index]);
+ }
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(modeList);
+ }
+
+void CT_DataWsSession::DoCmdSetPointerCursorArea(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRect setRectArea;
+ if ( !GetRectFromConfig(aSection, KPtrCurPosArea, setRectArea) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KPtrCurPosArea());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetPointerCursorPosition(TPoint)"));
+
+ TInt setScrnSizeMode;
+ if ( !GetIntFromConfig(aSection, KSetScrnSizeMode, setScrnSizeMode) )
+ {
+ iWsSession->SetPointerCursorArea(setRectArea);
+ }
+ else
+ {
+ iWsSession->SetPointerCursorArea(setScrnSizeMode,setRectArea);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdPointerCursorArea(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TRect actual;
+ TInt theScreenSizeMode=0;
+ if ( !GetIntFromConfig(aSection, KSetScrnSizeMode, theScreenSizeMode) )
+ {
+ actual=iWsSession->PointerCursorArea();
+ LogRect(_L("PointerCursorArea()"), actual);
+ }
+ else
+ {
+ actual=iWsSession->PointerCursorArea(theScreenSizeMode);
+ LogRect(_L("PointerCursorArea(TInt)"), actual);
+ }
+
+ TRect expected;
+ if ( !GetRectFromConfig(aSection, KPtrCurPosArea, expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KPtrCurPosArea);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(KLogNotExpectedValue);
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+
+void CT_DataWsSession::DoCmdSetPointerCursorMode(const TDesC& aSection)
+ {
+ TPointerCursorMode mode;
+ if ( !CT_GraphicsUtil::ReadPointerCursorMode(*this, aSection, KSetPtrCurMode(), mode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSetPtrCurMode());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iWsSession->SetPointerCursorMode(mode);
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetClientCursorMode(const TDesC& aSection)
+ {
+ TPointerCursorMode mode;
+ if ( !CT_GraphicsUtil::ReadPointerCursorMode(*this, aSection, KSetCltCurMode(), mode) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSetCltCurMode());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iWsSession->SetClientCursorMode(mode);
+ }
+ }
+
+void CT_DataWsSession::DoCmdPointerCursorMode(const TDesC& aSection)
+ {
+ INFO_PRINTF1(_L("RWsSession::PointerCursorMode() call"));
+ TPointerCursorMode actual=iWsSession->PointerCursorMode();
+ INFO_PRINTF2(_L("actual Pointer Cursor Mode:%d"), actual);
+
+ TPointerCursorMode expected;
+ if ( !CT_GraphicsUtil::ReadPointerCursorMode(*this, aSection, KFldExpected(), expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KExpectPtrCursorMode());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(_L("Pointer cursor mode is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetDefaultSystemPointerCursor(const TDesC& aSection)
+ {
+ TInt inputDefCursorNumber=0;
+ INFO_PRINTF1(_L("RWsSession::SetDefaultSystemPointerCursor() call"));
+
+ if ( !GetIntFromConfig(aSection, KInputDefaultCursorNumber(), inputDefCursorNumber))
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KInputDefaultCursorNumber());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iWsSession->SetDefaultSystemPointerCursor(inputDefCursorNumber);
+ }
+ }
+
+void CT_DataWsSession::DoCmdClearDefaultSystemPointerCursor()
+ {
+ INFO_PRINTF1(_L("RWsSession::ClearDefaultSystemPointerCursor() call"));
+ iWsSession->ClearDefaultSystemPointerCursor();
+ }
+
+void CT_DataWsSession::DoCmdSetPointerCursorPosition(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPoint ptrCurPost;
+ if ( !GetPointFromConfig(aSection, KSetPtrCurPosValue, ptrCurPost) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSetPtrCurPosValue);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetPointerCursorPosition(TPoint)"));
+ iWsSession->SetPointerCursorPosition(ptrCurPost);
+ }
+ }
+
+void CT_DataWsSession::DoCmdPointerCursorPosition(const TDesC& aSection)
+ {
+ // Get test data for command input parameter(s)
+ TPoint actualPtrCurPost=iWsSession->PointerCursorPosition();
+
+ TPoint expectPtrCurPost;
+ if ( !GetPointFromConfig(aSection, KTPoint, expectPtrCurPost) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KTPoint);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(_L("execute SetPointerCursorPosition(TPoint)"));
+ if ((expectPtrCurPost.iX!=expectPtrCurPost.iX)||(expectPtrCurPost.iY!=expectPtrCurPost.iY))
+ {
+ ERR_PRINTF1(_L("The cursor position is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetDefaultFadingParameters(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TInt setBlackMap;
+ TInt setWhiteMap;
+
+ if ( !GetIntFromConfig(aSection, KSetDefblackMapFading(), setBlackMap) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KSetDefblackMapFading);
+ SetBlockResult(EFail);
+ }
+
+ if ( !GetIntFromConfig(aSection, KSetDefwhiteMapFading(), setWhiteMap) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KSetDefwhiteMapFading);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ iWsSession->SetDefaultFadingParameters(setBlackMap, setWhiteMap);
+ }
+ }
+
+void CT_DataWsSession::DoCmdPrepareForSwitchOff()
+ {
+ INFO_PRINTF1(_L("RWsSession::PrepareForSwitchOff() call"));
+ iWsSession->PrepareForSwitchOff();
+ }
+
+
+void CT_DataWsSession::DoCmdSetBufferSizeL(const TDesC& aSection)
+ {
+ TInt theBuffersize;
+
+ if ( !GetIntFromConfig(aSection, KSetBuffer(), theBuffersize) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSetBuffer);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iWsSession->SetBufferSizeL(theBuffersize);
+ INFO_PRINTF1(_L("RWsSession::SetBufferSizeL"));
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetMaxBufferSizeL(const TDesC& aSection)
+ {
+ TInt theMaxBuffersize;
+
+ if ( !GetIntFromConfig(aSection, KSetMaxBuffer(), theMaxBuffersize) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSetBuffer);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iWsSession->SetMaxBufferSizeL(theMaxBuffersize);
+ INFO_PRINTF1(_L("RWsSession::SetMaxBufferSizeL"));
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetSystemFaded(const TDesC& aSection)
+ {
+ TBool systemFadOffOn;
+ TInt blackMap;
+ TInt whiteMap;
+
+ if ( !GetBoolFromConfig(aSection, KSetSysFading(), systemFadOffOn) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSetSysFading());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF2(_L("the status of fad window :%d"),systemFadOffOn);
+ if( GetIntFromConfig(aSection, KSetblackMapFading(), blackMap))
+ {
+ if ( !GetIntFromConfig(aSection, KSetwhiteMapFading(), whiteMap) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSetwhiteMapFading);
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iWsSession->SetSystemFaded(systemFadOffOn,blackMap,whiteMap);
+ INFO_PRINTF1(_L("RWsSession::SetSystemFaded"));
+ }
+ }
+ else
+ {
+ iWsSession->SetSystemFaded(systemFadOffOn);
+ INFO_PRINTF1(_L("RWsSession::SetSystemFaded"));
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdSetFocusScreen(const TDesC& aSection)
+ {
+ TInt theScreenNo;
+ if ( !GetIntFromConfig(aSection, KSetFocusScreen(), theScreenNo) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KSetFocusScreen());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ iWsSession->SetFocusScreen(theScreenNo);
+ INFO_PRINTF1(_L("RWsSession::SetFocusScreen"));
+ }
+ }
+
+void CT_DataWsSession::DoCmdGetFocusScreen(const TDesC& aSection)
+ {
+ TInt actual=iWsSession->GetFocusScreen();
+ INFO_PRINTF2(_L("RWsSession::GetFocusScreen()=%d"), actual);
+
+ TInt expected;
+ if ( !GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(_L("GetFocusScreen is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+
+void CT_DataWsSession::DoCmdClearAllRedrawStores()
+ {
+ INFO_PRINTF1(_L("RWsSession::ClearAllRedrawStores() call"));
+ iWsSession->ClearAllRedrawStores();
+ }
+
+
+void CT_DataWsSession::DoCmdLogCommand(const TDesC& aSection)
+ {
+ RWsSession::TLoggingCommand inputCommand;
+ if ( !CT_GraphicsUtil::ReadLoggingCommand(*this, aSection, KLogCommand(), inputCommand) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KLogCommand());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("RWsSession::LogCommand() call"));
+ iWsSession->LogCommand(inputCommand);
+ }
+ }
+
+
+void CT_DataWsSession::DoCmdLogMessage(const TDesC& aSection)
+ {
+ TPtrC theMessage;
+
+ if ( !GetStringFromConfig(aSection, KLogMessage(), theMessage) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KLogMessage());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("RWsSession::LogMessage() call"));
+ iWsSession->LogMessage(theMessage);
+ }
+ }
+
+#if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
+void CT_DataWsSession::DoCmdNumberOfScreens(const TDesC& aSection)
+ {
+ TInt actual=iWsSession->NumberOfScreens();
+ INFO_PRINTF2(_L("NumberOfScreens:%d"), actual);
+
+ TInt expected=0;
+ if ( !GetIntFromConfig(aSection, KFldExpected(), expected) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ if ( actual!=expected )
+ {
+ ERR_PRINTF1(_L("NumberOfScreens is not as expected!"));
+ SetBlockResult(EFail);
+ }
+ }
+ }
+#else
+void CT_DataWsSession::DoCmdNumberOfScreens(const TDesC& /*aSection*/)
+ {
+ ERR_PRINTF1(_L("SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS Not Supported"));
+ SetBlockResult(EFail);
+ }
+#endif
+
+void CT_DataWsSession::DoCmdSimulateRawEvent(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TRawEvent event;
+
+ TRawEvent::TType type=TRawEvent::ENone;
+ if ( !CT_GraphicsUtil::ReadType(*this, aSection, KFldType(), type) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(_L("Missing parameter %S"), &KFldType());
+ SetBlockResult(EFail);
+ }
+ else
+ {
+ event.Set(type);
+ }
+
+ TStdScanCode stdScanCode;
+ if ( CT_GraphicsUtil::ReadStdScanCode(*this, aSection, KFldStdScanCode(), stdScanCode) )
+ {
+ event.Set(type, stdScanCode);
+ }
+
+ TInt deviceNumber;
+ if ( GetIntFromConfig(aSection, KFldDeviceNumber, deviceNumber) )
+ {
+ event.SetDeviceNumber(deviceNumber);
+ }
+
+ TPoint pointerPos(0,0);
+ if ( GetPointFromConfig(aSection, KFldPos, pointerPos) )
+ {
+ event.Set(type, pointerPos.iX, pointerPos.iY);
+ }
+
+ TBool tip;
+ if ( GetBoolFromConfig(aSection, KFldTip, tip) )
+ {
+ event.SetTip(tip);
+ }
+
+ if ( dataOk )
+ {
+ INFO_PRINTF1(_L("RWsSession::SimulateRawEvent(TRawEvent) call"));
+ iWsSession->SimulateRawEvent(event);
+ }
+ }
+
+void CT_DataWsSession::DoCmdSimulateKeyEvent(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ TKeyCode keyCode;
+ if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KFldKeyCode(), keyCode) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldKeyCode());
+ SetBlockResult(EFail);
+ }
+
+ TUint modifiers=0;
+ CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifiers(), modifiers);
+
+ TInt repeats=0;
+ GetIntFromConfig(aSection, KFldRepeats(), repeats);
+
+ if ( dataOk )
+ {
+ TKeyEvent event;
+
+ event.iCode=keyCode;
+ event.iScanCode=keyCode;
+ event.iModifiers=modifiers;
+ event.iRepeats=repeats;
+ INFO_PRINTF1(_L("RWsSession::SimulateKeyEvent(TKeyEvent) call"));
+ iWsSession->SimulateKeyEvent(event);
+ }
+ }
+
+/**
+ Virtual RunL - Called on completion of an asynchronous command
+ @see MTPActiveCallback
+ @param aActive Active Object that RunL has been called on
+ @pre N/A
+ @post N/A
+ @leave system wide error code
+*/
+void CT_DataWsSession::RunL(CActive* aActive, const TInt aIndex)
+ {
+ if ( aActive==iActiveEventReady )
+ {
+ RunEventReady(aIndex);
+ }
+ else if ( aActive==iActivePriorityKeyReady )
+ {
+ RunPriorityKeyReady(aIndex);
+ }
+ else if ( aActive==iActiveRedrawReady )
+ {
+ RunRedrawReady(aIndex);
+ }
+ else
+ {
+ ERR_PRINTF1(_L("Stray signal"));
+ SetBlockResult(EFail);
+ }
+ DecOutstanding();
+ }
+
+/**
+ Virtual DoCancel - Request to cancel the asynchronous command
+ @see - MTPActiveCallback
+ @param aActive Active Object that DoCancel has been called on
+ @pre - N/A
+ @post - N/A
+ @leave system wide error code
+*/
+void CT_DataWsSession::DoCancel(CActive* aActive, const TInt aIndex)
+ {
+ if ( aActive==iActiveEventReady )
+ {
+ DoCancelEventReady(aIndex);
+ }
+ else if ( aActive==iActivePriorityKeyReady )
+ {
+ DoCancelPriorityKeyReady(aIndex);
+ }
+ else if ( aActive==iActiveRedrawReady )
+ {
+ DoCancelRedrawReady(aIndex);
+ }
+ else
+ {
+ ERR_PRINTF1(_L("Stray signal"));
+ SetBlockResult(EFail);
+ }
+ DecOutstanding();
+ }
+
+void CT_DataWsSession::RunEventReady(const TInt aIndex)
+ {
+ TInt err=iActiveEventReady->iStatus.Int();
+ INFO_PRINTF2(_L("RunEventReady %d"), err);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("RunL Error %d"), err);
+ SetAsyncError(aIndex, err);
+ }
+ }
+
+void CT_DataWsSession::DoCancelEventReady(const TInt /*aIndex*/)
+ {
+ }
+
+void CT_DataWsSession::RunPriorityKeyReady(const TInt aIndex)
+ {
+ TInt err=iActivePriorityKeyReady->iStatus.Int();
+ INFO_PRINTF2(_L("RunPriorityKeyReady %d"), err);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("RunL Error %d"), err);
+ SetAsyncError(aIndex, err);
+ }
+ }
+
+void CT_DataWsSession::DoCancelPriorityKeyReady(const TInt /*aIndex*/)
+ {
+ }
+
+void CT_DataWsSession::RunRedrawReady(const TInt aIndex)
+ {
+ TInt err=iActiveRedrawReady->iStatus.Int();
+ INFO_PRINTF2(_L("RunRedrawReady %d"), err);
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(_L("RunL Error %d"), err);
+ SetAsyncError(aIndex, err);
+ }
+ }
+
+void CT_DataWsSession::DoCancelRedrawReady(const TInt /*aIndex*/)
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsSprite.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,265 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_GraphicsUtil.h"
+#include "T_DataWsSprite.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdNew, "new");
+_LIT(KCmdConstruct, "Construct");
+_LIT(KCmdSetPosition, "SetPosition");
+
+// Fields
+_LIT(KFldWs, "ws");
+_LIT(KFldFlag, "flag");
+_LIT(KFldPoint, "pos");
+_LIT(KFldWindow, "win");
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+
+_LIT(KLogNew, "execute new RWsSprite()");
+_LIT(KLogNew2, "execute new RWsSprite(RWsSession)");
+_LIT(KLogConstruct, "execute Construct(RWindowTreeNode, const TPoint, TInt)");
+_LIT(KLogSetPosition, "execute SetPosition(TPoint)");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsSprite::CT_DataWsSprite()
+: CT_DataWsSpriteBase(),iWsSprite(NULL)
+ {
+ }
+
+CT_DataWsSprite* CT_DataWsSprite::NewL()
+ {
+ CT_DataWsSprite* ret=new (ELeave) CT_DataWsSprite();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+void CT_DataWsSprite::ConstructL()
+ {
+ }
+
+CT_DataWsSprite::~CT_DataWsSprite()
+ {
+ DestroyData();
+ }
+
+/**
+ * Called by TEF framework to set object.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsSprite::SetObjectL(TAny* aAny)
+ {
+ DestroyData();
+ iWsSprite = static_cast<RWsSprite*> (aAny);
+ }
+
+/**
+ * Called by TEF framework to disown the object.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsSprite::DisownObjectL()
+ {
+ iWsSprite = NULL;
+ }
+
+/**
+ * Destroy the object which has been constructed.
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsSprite::DestroyData()
+ {
+ delete iWsSprite;
+ iWsSprite = NULL;
+ }
+
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsSprite::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdNew )
+ {
+ DoCmdNewL(aSection);
+ }
+ else if ( aCommand==KCmdConstruct )
+ {
+ DoCmdConstructL(aSection);
+ }
+ else if ( aCommand==KCmdSetPosition )
+ {
+ DoCmdSetPosition(aSection);
+ }
+ else
+ {
+ ret=CT_DataWsSpriteBase::DoCommandL(aCommand,aSection,aAsyncErrorIndex);
+ }
+
+ return ret;
+ }
+
+/**
+ * Process new command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataWsSprite::DoCmdNewL(const TDesC& aSection)
+ {
+ TPtrC wsName;
+ RWsSession* ws=NULL;
+
+ if ( GetStringFromConfig(aSection, KFldWs, wsName) )
+ {
+ ws = static_cast<RWsSession*>(GetDataObjectL(wsName));
+ }
+
+ TInt err=KErrNone;
+
+ if ( ws!=NULL )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogNew2);
+ TRAP( err, iWsSprite=new (ELeave) RWsSprite(*ws));
+ }
+ else
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogNew);
+ TRAP( err, iWsSprite=new (ELeave) RWsSprite());
+ }
+
+ if ( err!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, err);
+ SetError(err);
+ }
+ // No command return value and output parameter to display and check
+ }
+
+/**
+ * Process Construct command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataWsSprite::DoCmdConstructL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+
+ // Get test data for command input parameter(s)
+ TPtrC winName;
+ RWindow* win=NULL;
+
+ if ( GetStringFromConfig(aSection, KFldWindow, winName) )
+ {
+ win=static_cast<RWindow*>(GetDataObjectL(winName));
+ }
+
+ if ( win==NULL )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldWindow);
+ SetBlockResult(EFail);
+ }
+
+ TUint aSpriteFlags=0;
+
+ if(!CT_GraphicsUtil::ReadSpriteFlags(*this,aSection,KFldFlag,aSpriteFlags))
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldFlag);
+ SetBlockResult(EFail);
+ }
+
+ TPoint dataPoint;
+
+ if ( !GetPointFromConfig(aSection, KFldPoint, dataPoint) )
+ {
+ dataPoint=TPoint(0,0);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogConstruct);
+ TInt returnCode=iWsSprite->Construct(*win, dataPoint,aSpriteFlags);
+
+ // Check the command return code, if !=KErrNone then stop this command
+ if ( returnCode!=KErrNone )
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+ }
+ }
+
+/**
+ * Process SetPosition command
+ *
+ * @param aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataWsSprite::DoCmdSetPosition(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ TPoint dataPoint;
+
+ if ( !GetPointFromConfig(aSection, KFldPoint, dataPoint) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldPoint);
+ SetBlockResult(EFail);
+ }
+
+ if ( dataOk )
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogSetPosition);
+ iWsSprite->SetPosition(dataPoint);
+ // No command return value and output parameter to display and check
+ }
+ // No command return value and output parameter to display and check
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_DataWsSpriteBase.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_GraphicsUtil.h"
+#include "T_DataWsSpriteBase.h"
+
+/*@{*/
+//Commands
+_LIT(KCmdActivate, "Activate");
+_LIT(KCmdAppendMember, "AppendMember");
+_LIT(KCmdUpdateMember, "UpdateMember");
+_LIT(KCmdClose, "Close");
+
+// Fields
+_LIT(KFldIndex, "index");
+_LIT(KFldOneParameter, "oneparameter");
+_LIT(KFldSpriteMember, "spritemember");
+/// Logging
+_LIT(KLogError, "Error=%d");
+_LIT(KLogMissingParameter, "Missing parameter '%S'");
+
+
+_LIT(KLogActivate, "execute Activate()");
+_LIT(KLogAppendMember, "execute AppendMember(const TSpriteMember &aMemberData)");
+_LIT(KLogUpdateMember, "execute UpdateMember(TInt aIndex)");
+_LIT(KLogUpdateMember2, "execute UpdateMember(TInt aIndex, const TSpriteMember &aMemberData)");
+_LIT(KLogClose, "execute Close()");
+/*@}*/
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CT_DataWsSpriteBase::CT_DataWsSpriteBase():CDataWrapperBase()
+ {
+ }
+
+MWsClientClass* CT_DataWsSpriteBase::GetClientClass() const
+ {
+ return GetWsSpriteBase();
+ }
+/**
+* Process a command read from the ini file
+*
+* @param aCommand the command to process
+* @param aSection the entry in the ini file requiring the command to be processed
+* @param aAsyncErrorIndex index of command. used for async calls
+*
+* @return ETrue if the command is processed
+*/
+TBool CT_DataWsSpriteBase::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+ {
+ TBool ret = ETrue;
+
+ if ( aCommand==KCmdActivate )
+ {
+ DoCmdActivate();
+ }
+ else if ( aCommand==KCmdAppendMember )
+ {
+ DoCmdAppendMemberL(aSection);
+ }
+ else if ( aCommand==KCmdUpdateMember )
+ {
+ DoCmdUpdateMemberL(aSection);
+ }
+ else if ( aCommand==KCmdClose )
+ {
+ DoCmdClose();
+ }
+ else
+ {
+ ret=EFalse;
+ }
+
+ return ret;
+ }
+
+/**
+ * Process Activate command
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsSpriteBase::DoCmdActivate()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogActivate);
+ TInt nErr=GetWsSpriteBase()->Activate();
+
+ if(nErr!=KErrNone)
+ {
+ ERR_PRINTF2(KLogError, nErr);
+ SetError(nErr);
+ }
+
+ // No command return value and output parameter to display and check
+ }
+
+/**
+ * Process AppendMember command
+ *
+ * @param: aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataWsSpriteBase::DoCmdAppendMemberL(const TDesC& aSection)
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogAppendMember);
+
+ //Init TSpriteMember
+ TSpriteMember spriteMember;
+
+ if ( !CT_GraphicsUtil::GetSpriteMemberL(*this, aSection, KFldSpriteMember, spriteMember) )
+ {
+ ERR_PRINTF2(KLogMissingParameter, &KFldSpriteMember);
+ SetBlockResult(EFail);
+ }
+
+ TInt returnCode=GetWsSpriteBase()->AppendMember(spriteMember);
+
+ if(KErrNone!=returnCode)
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+
+ // No command return value and output parameter to display and check
+ }
+
+/**
+ * Process UpdateMember command
+ *
+ * @param: aSection the entry in the ini file requiring the command to be processed
+ *
+ * @return: None
+ */
+void CT_DataWsSpriteBase::DoCmdUpdateMemberL(const TDesC& aSection)
+ {
+ TBool dataOk=ETrue;
+ //get update index
+ TInt datIndex;
+
+ if ( !GetIntFromConfig(aSection, KFldIndex, datIndex) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldIndex);
+ }
+ //get if one parameter
+ TBool bOneParameter=TRUE;
+
+ if ( !GetBoolFromConfig(aSection, KFldOneParameter, bOneParameter) )
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldOneParameter);
+ }
+
+ //Init new TSpriteMember
+ TSpriteMember spriteMember;
+
+ if ( !CT_GraphicsUtil::GetSpriteMemberL(*this, aSection, KFldSpriteMember, spriteMember) )
+ {
+ if(!bOneParameter)
+ {
+ dataOk=EFalse;
+ ERR_PRINTF2(KLogMissingParameter, &KFldSpriteMember);
+ SetBlockResult(EFail);
+ }
+ }
+
+ if(dataOk)
+ {
+ TInt returnCode=KErrNone;
+
+ if(bOneParameter)
+ {
+ INFO_PRINTF1(KLogUpdateMember);
+ GetWsSpriteBase()->UpdateMember(datIndex);
+ }
+ else
+ {
+ INFO_PRINTF1(KLogUpdateMember2);
+ returnCode=GetWsSpriteBase()->UpdateMember(datIndex,spriteMember);
+ }
+
+ if(returnCode!=KErrNone)
+ {
+ ERR_PRINTF2(KLogError, returnCode);
+ SetError(returnCode);
+ }
+ }
+ // No command return value and output parameter to display and check
+ }
+
+/**
+ * Process Close command
+ *
+ * @param: None
+ *
+ * @return: None
+ */
+void CT_DataWsSpriteBase::DoCmdClose()
+ {
+ // Execute command and log parameters
+ INFO_PRINTF1(KLogClose);
+ GetWsSpriteBase()->Close();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_GraphicsWservAPIServer.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,383 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "T_GraphicsWservAPIServer.h"
+#include "T_DataWsSession.h"
+#include "T_DataWindowGroup.h"
+#include "T_DataBlankWindow.h"
+#include "T_DataWindow.h"
+#include "T_DataBackedUpWindow.h"
+#include "T_DataWindowGc.h"
+#include "T_DataWsBitmap.h"
+#include "T_DataWsGraphicBitmap.h"
+#include "T_DataWsGraphicMsgBuf.h"
+#include "T_DataWindowInfo.h"
+#include "T_DataWsScreenDevice.h"
+#include "T_DataFbsSession.h"
+#include "T_DataFbsFont.h"
+#include "T_DataFbsBitmap.h"
+#include "T_DataBitmapUtil.h"
+#include "T_DataFbsTypefaceStore.h"
+#include "T_DataFbsColor256BitmapUtil.h"
+#include "T_DataPalette.h"
+#include "T_DataFbsBitmapDevice.h"
+#include "T_DataFbsScreenDevice.h"
+#include "T_DataAlgStyle.h"
+#include "T_DataMeasureTextInput.h"
+#include "T_DataMeasureTextOutput.h"
+#include "T_DataWsGraphicAnimation.h"
+#include "T_DataWsGraphicFrameRate.h"
+#include "T_DataWsEvent.h"
+#include "T_DataWsRedrawEvent.h"
+#include "T_DataWsPriorityKeyEvent.h"
+#include "T_DataSoundPlugIn.h"
+#include "T_DataFbsFont.h"
+#include "T_DataWsSprite.h"
+#include "T_DataWsPointerCursor.h"
+#include "T_DataDirectScreenAccess.h"
+#include "T_DataDsaSession.h"
+#include "T_DataFbsBitGc.h"
+#include "T_DataAnimDll.h"
+#include "T_DataAnim.h"
+#include "T_DataAnimForMClass.h"
+#include "T_DataWsGraphicBitmapAnimation.h"
+#include "T_DataFrame.h"
+// EPOC Includes
+#include <rsshared.h>
+
+/**
+ * @enum Constant Literals used.
+ */
+/*@{*/
+// Graphics WSERV API
+_LIT(KDataWsSession, "RWsSession");
+_LIT(KDataWindowGroup, "RWindowGroup");
+_LIT(KDataBlankWindow, "RBlankWindow");
+_LIT(KDataWindow, "RWindow");
+_LIT(KDataBackedUpWindow, "RBackedUpWindow");
+_LIT(KDataWindowGc, "CWindowGc");
+_LIT(KDataWsBitmap, "CWsBitmap");
+_LIT(KDataWsGraphicBitmap, "CWsGraphicBitmap");
+_LIT(KDataWsGraphicMsgBuf, "RWsGraphicMsgBuf");
+_LIT(KDataWsEvent, "TWsEvent");
+_LIT(KDataWsPriorityKeyEvent, "TWsPriorityKeyEvent");
+_LIT(KDataWsRedrawEvent, "TWsRedrawEvent");
+_LIT(KDataWindowInfo, "TWindowInfo");
+_LIT(KDataWsScreenDevice, "CWsScreenDevice");
+_LIT(KDataWsGraphicAnimation, "TWsGraphicAnimation");
+_LIT(KDataWsGraphicFrameRate, "TWsGraphicFrameRate");
+_LIT(KDataSoundPlugIn, "RSoundPlugIn");
+_LIT(KDataFbsFont, "CFbsFont");
+_LIT(KDataWsSprite, "RWsSprite");
+_LIT(KDataWsPointerCursor, "RWsPointerCursor");
+_LIT(KDataCDirectScreenAccess, "CDirectScreenAccess");
+_LIT(KDataRDirectScreenAccess, "RDirectScreenAccess");
+_LIT(KDataFbsBitGc, "CFbsBitGc");
+_LIT(KDataAnimDll, "RAnimDll");
+_LIT(KDataAnim, "RAnim");
+_LIT(KDataAnimForMClass, "RAnimForMClass");
+_LIT(KDataWsGraphicBitmapAnimation, "CWsGraphicBitmapAnimation");
+_LIT(KDataFrame, "CFrame");
+//from T_FBServAPI
+_LIT(KRFbsSessionData, "RFbsSession");
+_LIT(KCFbsFontData, "CFbsFont");
+_LIT(KCFbsBitmapData, "CFbsBitmap");
+_LIT(KTBitmapUtilData, "TBitmapUtil");
+_LIT(KCFbsTypefaceStoreData, "CFbsTypefaceStore");
+_LIT(KCFbsColor256BitmapUtil, "CFbsColor256BitmapUtil");
+_LIT(KCPalette, "CPalette");
+_LIT(KCFbsBitmapDevice, "CFbsBitmapDevice");
+_LIT(KCFbsScreenDevice, "CFbsScreenDevice");
+_LIT(KTAlgStyle, "TAlgStyle");
+_LIT(KTMeasureTextInput, "TMeasureTextInput");
+_LIT(KTMeasureTextOutput, "TMeasureTextOutput");
+/*@}*/
+
+
+inline CDataWrapper* CT_GraphicsWservAPIServer::CT_GraphicsWservAPIBlock::CreateDataL( const TDesC& aData )
+ {
+ CDataWrapper* wrapper = NULL;
+
+ if ( aData==KDataWsSession )
+ {
+ wrapper=CT_DataWsSession::NewL();
+ }
+ else if ( aData==KDataWindowGroup )
+ {
+ wrapper=CT_DataWindowGroup::NewL();
+ }
+ else if ( aData==KDataBlankWindow )
+ {
+ wrapper=CT_DataBlankWindow::NewL();
+ }
+ if ( aData==KDataWindow )
+ {
+ wrapper=CT_DataWindow::NewL();
+ }
+ else if ( aData==KDataBackedUpWindow )
+ {
+ wrapper=CT_DataBackedUpWindow::NewL();
+ }
+ else if ( aData==KDataWindowGc )
+ {
+ wrapper=CT_DataWindowGc::NewL();
+ }
+ else if ( aData==KDataWsBitmap )
+ {
+ wrapper=CT_DataWsBitmap::NewL();
+ }
+ else if ( aData==KDataWsGraphicBitmap )
+ {
+ wrapper=CT_DataWsGraphicBitmap::NewL();
+ }
+ else if ( aData==KDataWsGraphicMsgBuf )
+ {
+ wrapper=CT_DataWsGraphicMsgBuf::NewL();
+ }
+ else if ( aData==KDataWsEvent )
+ {
+ wrapper=CT_DataWsEvent::NewL();
+ }
+ else if ( aData==KDataWsPriorityKeyEvent )
+ {
+ wrapper=CT_DataWsPriorityKeyEvent::NewL();
+ }
+ else if ( aData==KDataWsRedrawEvent )
+ {
+ wrapper=CT_DataWsRedrawEvent::NewL();
+ }
+ else if ( aData==KDataWindowInfo )
+ {
+ wrapper=CT_DataWindowInfo::NewL();
+ }
+ else if ( aData==KDataWsScreenDevice )
+ {
+ wrapper=CT_DataWsScreenDevice::NewL();
+ }
+ else if( aData == KDataSoundPlugIn)
+ {
+ wrapper = CT_DataSoundPlugIn::NewL();
+ }
+ else if (aData==KDataCDirectScreenAccess)
+ {
+ wrapper=CT_DataDirectScreenAccess::NewL();
+ }
+ else if (aData==KDataRDirectScreenAccess)
+ {
+ wrapper=CT_DataDsaSession::NewL();
+ }
+// from T_FBServAPI
+ else if (aData == KRFbsSessionData)
+ {
+ wrapper=CT_DataFbsSession::NewL();
+ }
+ else if (aData == KCFbsFontData)
+ {
+ wrapper=CT_DataFbsFont::NewL();
+ }
+ else if (aData == KCFbsBitmapData)
+ {
+ wrapper=CT_DataFbsBitmap::NewL();
+ }
+ else if (aData == KTBitmapUtilData)
+ {
+ wrapper=CT_DataBitmapUtil::NewL();
+ }
+ else if (aData == KCFbsTypefaceStoreData)
+ {
+ wrapper=CT_DataFbsTypefaceStore::NewL();
+ }
+ else if (aData == KCFbsColor256BitmapUtil)
+ {
+ wrapper=CT_DataFbsColor256BitmapUtil::NewL();
+ }
+ else if (aData == KCPalette)
+ {
+ wrapper=CT_DataPalette::NewL();
+ }
+ else if ( aData==KCFbsBitmapDevice )
+ {
+ wrapper=CT_DataFbsBitmapDevice::NewL();
+ }
+ else if ( aData==KCFbsScreenDevice )
+ {
+ wrapper=CT_DataFbsScreenDevice::NewL();
+ }
+ else if ( aData==KTAlgStyle )
+ {
+ wrapper=CT_DataAlgStyle::NewL();
+ }
+ else if ( aData==KTMeasureTextInput )
+ {
+ wrapper=CT_DataMeasureTextInput::NewL();
+ }
+ else if ( aData==KTMeasureTextOutput )
+ {
+ wrapper=CT_DataMeasureTextOutput::NewL();
+ }
+ else if ( aData==KDataWsGraphicAnimation )
+ {
+ wrapper=new (ELeave) CT_DataWsGraphicAnimation();
+ }
+ else if ( aData==KDataWsGraphicFrameRate )
+ {
+ wrapper=new (ELeave) CT_DataWsGraphicFrameRate();
+ }
+ else if (aData==KDataFbsFont)
+ {
+ wrapper=CT_DataFbsFont::NewL();
+ }
+ //for RWsSprite
+ else if (aData==KDataWsSprite)
+ {
+ wrapper= CT_DataWsSprite::NewL();
+ }
+ //for RWsPointerCursor
+ else if (aData==KDataWsPointerCursor)
+ {
+ wrapper=CT_DataWsPointerCursor::NewL();
+ }
+ else if (aData == KDataFbsBitGc)
+ {
+ wrapper=CT_DataFbsBitGc::NewL();
+ }
+ else if( aData == KDataAnimDll)
+ {
+ wrapper = CT_DataAnimDll::NewL();
+ }
+ else if( aData == KDataAnim)
+ {
+ wrapper = CT_DataAnim::NewL();
+ }
+ else if(aData==KDataAnimForMClass)
+ {
+ wrapper=CT_DataAnimForMClass::NewL();
+ }
+ else if( aData == KDataWsGraphicBitmapAnimation)
+ {
+ wrapper = CT_DataWsGraphicBitmapAnimation::NewL();
+ }
+ else if( aData == KDataFrame)
+ {
+ wrapper = CT_DataFrame::NewL();
+ }
+ return wrapper;
+ }
+
+CT_GraphicsWservAPIServer* CT_GraphicsWservAPIServer::NewL()
+/**
+ * @return - Instance of the test server
+ * Same code for Secure and non-secure variants
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+ {
+ CT_GraphicsWservAPIServer* server = new (ELeave) CT_GraphicsWservAPIServer();
+ CleanupStack::PushL(server);
+ // CServer base class call
+ //RProcess handle = RProcess();
+ //TParsePtrC serverName(handle.FileName());
+ server->ConstructL(); /*Parsing the server name from the file name*/
+ CleanupStack::Pop(server);
+ return server;
+ }
+
+
+TInt LoadDrivers()
+ {
+#ifdef __WINS__
+ #define KPDDName _L("ECDRV")
+ #define KLDDName _L("ECOMM")
+#else
+ #define KPDDName _L("EUART1")
+ #define KLDDName _L("ECOMM")
+#endif
+ TInt rerr = KErrNone;
+
+ rerr = StartC32();
+ if( rerr!=KErrNone && rerr!=KErrAlreadyExists )
+ {
+ return rerr;
+ }
+
+ rerr = User::LoadPhysicalDevice(KPDDName);
+ if(rerr != KErrNone && rerr != KErrAlreadyExists)
+ {
+ return rerr;
+ }
+ rerr = User::LoadLogicalDevice(KLDDName);
+ if(rerr != KErrNone && rerr != KErrAlreadyExists)
+ {
+ return rerr;
+ }
+ return KErrNone;
+ }
+
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+ {
+#if (defined __DATA_CAGING__)
+ RProcess().DataCaging(RProcess::EDataCagingOn);
+ RProcess().SecureApi(RProcess::ESecureApiOn);
+#endif
+ CActiveScheduler* sched=NULL;
+ sched=new(ELeave) CActiveScheduler;
+ CActiveScheduler::Install(sched);
+ CT_GraphicsWservAPIServer* server = NULL;
+ // Create the CTestServer derived server
+ TRAPD(err,server = CT_GraphicsWservAPIServer::NewL());
+ if(!err)
+ {
+ // Sync with the client and enter the active scheduler
+ RProcess::Rendezvous(KErrNone);
+ sched->Start();
+ }
+ delete server;
+ delete sched;
+ }
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+ {
+ TInt rerr = LoadDrivers();
+ if( rerr != KErrNone )
+ {
+ return rerr;
+ }
+
+ __UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ if(cleanup == NULL)
+ {
+ return KErrNoMemory;
+ }
+#if (defined TRAP_IGNORE)
+ TRAP_IGNORE(MainL());
+#else
+ TRAPD(err,MainL());
+#endif
+ delete cleanup;
+ __UHEAP_MARKEND;
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/src/T_RAnimChild.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2005-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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "T_RAnimChild.h"
+
+T_RAnimChild::T_RAnimChild()
+{
+}
+T_RAnimChild::T_RAnimChild(RAnimDll &aDll):RAnim(aDll)
+{
+ // No implementation required
+}
+
+T_RAnimChild::~T_RAnimChild()
+{
+}
+
+TInt T_RAnimChild::Construct(const RWindowBase &aDevice, TInt aType, const TDesC8 &aParams)
+ {
+ return RAnim::Construct(aDevice, aType, aParams);
+ }
+TInt T_RAnimChild::Construct(const RWindowBase &aDevice, TInt aType, const TDesC8 &aParams, const TIpcArgs& aIpcArgs)
+ {
+ return RAnim::Construct(aDevice, aType, aParams, aIpcArgs);
+ }
+TInt T_RAnimChild::Construct(const RWsSprite &aDevice, TInt aType, const TDesC8 &aParams)
+ {
+ return RAnim::Construct(aDevice, aType, aParams);
+ }
+TInt T_RAnimChild::Construct(const RWsSprite &aDevice, TInt aType, const TDesC8 &aParams, const TIpcArgs& aIpcArgs)
+ {
+ return RAnim::Construct(aDevice, aType, aParams, aIpcArgs);
+ }
+TInt T_RAnimChild::CommandReply(TInt aOpcode)
+ {
+ return RAnim::CommandReply(aOpcode);
+ }
+TInt T_RAnimChild::CommandReply(TInt aOpcode, const TPtrC8 &aArgs)
+ {
+ return RAnim::CommandReply(aOpcode, aArgs);
+ }
+TInt T_RAnimChild::CommandReply(TInt aOpcode, const TDesC8 &aArgs, const TIpcArgs &aIpcArgs)
+ {
+ return RAnim::CommandReply( aOpcode, aArgs,aIpcArgs);
+ }
+void T_RAnimChild::Command(TInt aOpcode, const TPtrC8 &aArgs)
+ {
+ RAnim::Command( aOpcode, aArgs);
+ }
+void T_RAnimChild::Command(TInt aOpcode)
+ {
+ RAnim::Command(aOpcode);
+ }
+void T_RAnimChild::AsyncCommandReply(TRequestStatus& aRequestStatus,TInt aOpcode, const TIpcArgs& aIpcArgs)
+ {
+ RAnim::AsyncCommandReply( aRequestStatus, aOpcode, aIpcArgs);
+ }
Binary file common/tools/ats/smoketest/graphics/wserv/testdata/datafile/uibench_16bit.mbm has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/graphics/wserv/testdata/smoketest_bitmap.ini Fri Dec 18 14:46:04 2009 +0000
@@ -0,0 +1,167 @@
+[default_wserv]
+#Set to the number of screens supported on the device
+screens =1
+
+#Set to index of screen (0 start) to run tests off of
+screen =0
+
+#Set to default pointer cursor
+pointercursor =0
+
+pointercursormode =EPointerCursorNone
+
+#Set to modifier state at start of session
+modifierstate =EModifierLeftCtrl
+
+#Set to the default width of the device in twips.
+scr_twips_width =7620
+
+#Set to the default height of the device in twips.
+scr_twips_height =2858
+
+#Set to the default width of the device.
+scr_width =640
+
+#Set to the default height of the device.
+scr_height =240
+
+#Set to the default rotation of the device.
+scr_rotation = EGraphicsOrientationNormal
+
+#Set to default display mode of screen
+display_mode =EColor64K
+
+#Set to the number of colours in the richest supported colour mode
+max_colors =65536
+
+#Set to the number of grays in the richest supported colour mode
+max_grays =0
+
+#Set to display mode nearest to EColor16MA
+nearest_to_color16ma =EColor16MA
+
+#Set to display mode nearest to EColor256
+nearest_to_color256 =EColor64K
+
+#Set to display mode nearest to EColor4K
+nearest_to_color4K =EColor64K
+
+#Largest display mode value (nearest to 10000)
+large_displaymode =EColor64K
+
+#Set to index of screen (0 start) to run tests off of
+screen_negative =-9999
+
+#Pointer rect area
+pointer_rect_left =-90
+pointer_rect_top =-51
+pointer_rect_right =696
+pointer_rect_bottom =312
+
+#Num of typefaces
+typefaces =12
+
+#font heights
+font_height =131
+
+#font height for case 0194
+font_height_case0194=191
+
+#font height in pixels for the font typeface_index=10 height_index=10
+font_height_10_10=25
+
+#default soundplugin dll
+defSoundPlugin=keyclickref.dll
+defSoundPluginUid=270483700
+
+#default animplugin dll
+def_anim_plugin=t_animplugin.dll
+#max height font name
+font_maxheight=NewCourier
+
+#min height font name
+font_minheight=NewCourier
+
+[default_wserv]
+#height with typeface index 0 and height index 0.
+height_with_index_0_0 = 8
+
+#height with typeface index 0 and height index 9999.
+height_with_index_0_9999 = 242
+
+[scrdev]
+name =scrdev
+
+[fbsbmp]
+name =fbsbmp
+
+[fbsBitmap]
+name =fbsBitmap
+
+[ws]
+name =ws
+
+[win]
+name =win
+
+[wingrp]
+name =wingrp
+
+[wingc]
+name =wingc
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-new_command004]
+ws =ws
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-Construct_command005]
+//defaultscreennumber =1
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-CreateContext_command006]
+windowgc =wingc
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-new_command008]
+ws =ws
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-Construct_command009]
+clienthandle =1
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-new_command011]
+ws =ws
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-Construct_command012]
+parent =wingrp
+handle =2
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-SetRequiredDisplayMode_command013]
+mode ={default_wserv,display_mode}
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-SetBackgroundColor_command014]
+color_red =255
+color_green =255
+color_blue =255
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-SetAutoFlush_command017]
+newFlushstate =TRUE
+expectedFlushstate =FALSE
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-Activate_command019]
+device =win
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-SetBrushColor_command020]
+color_red =255
+color_green =0
+color_blue =0
+
+[GRAPHICS-WSERV-WindowGc-Setup-0002-0001-SetBrushStyle_command021]
+brushstyle =ESolidBrush
+
+[GRAPHICS-WSERV-WindowGc-PublicApi-0051-0001-Load_command002]
+bitmap_id =0
+file_name =\smoketest\bitmap\uibench_16bit.mbm
+share_if_loaded =TRUE
+use_rfile =FALSE
+
+[GRAPHICS-WSERV-WindowGc-PublicApi-0051-0001-BitBlt_command009]
+point_x =10
+point_y =11
+bitmap =fbsbmp
--- a/common/tools/ats/smoketest/localisation/apparchitecture/tef/T_CaptionStep.cpp Tue Dec 15 14:31:00 2009 +0000
+++ b/common/tools/ats/smoketest/localisation/apparchitecture/tef/T_CaptionStep.cpp Fri Dec 18 14:46:04 2009 +0000
@@ -129,7 +129,8 @@
TLanguage language = User::Language(); // keep a copy to restore it later on.
TInt ch = 0;
- for (ch=0; ch < 2; ch++)
+ // loop changed to run French only
+ for (ch=1; ch < 2; ch++)
{
TLanguage languageToTest = ELangTest; // init to supress compiler remark
switch (ch)