1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/t_gdcoverage/wsgdcov.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,94 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Client that calls the plugin that does the actual coverage tests
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 + @test
1.24 + @internalComponent - Internal Symbian coverage test code,
1.25 +*/
1.26 +
1.27 +#include "wsgdcov.h"
1.28 +
1.29 +const TUid KGraphicDrawerCoverageInterfaceId = {0x10285D5A};
1.30 +const TUid KGraphicDrawerCoverageImplId = {0x10285D5B};
1.31 +
1.32 +EXPORT_C CWsGdCoverage* CWsGdCoverage::NewL()
1.33 + {
1.34 + return NewL(0);
1.35 + }
1.36 +
1.37 +EXPORT_C CWsGdCoverage* CWsGdCoverage::NewL(TInt aScreenId)
1.38 + {
1.39 + CWsGdCoverage* self = new(ELeave) CWsGdCoverage;
1.40 + CleanupStack::PushL(self);
1.41 + TBuf8<1> data;
1.42 + data.Append((TUint8)aScreenId);
1.43 + self->BaseConstructL(KGraphicDrawerCoverageInterfaceId, KGraphicDrawerCoverageImplId, data);
1.44 + CleanupStack::Pop(self);
1.45 + self->iIsReady = ETrue;
1.46 + return self;
1.47 + }
1.48 +
1.49 +EXPORT_C CWsGdCoverage::~CWsGdCoverage()
1.50 + {
1.51 + iIsReady = EFalse;
1.52 + }
1.53 +
1.54 +void CWsGdCoverage::HandleMessage(const TDesC8& aData)
1.55 + {
1.56 + if (aData.Size()>1 && aData[0]==KGdCoverageInfoSig)
1.57 + {
1.58 + if (aData.Size() <= sizeof(TGdCoverageInfo))
1.59 + {
1.60 + Mem::Copy(iReq, aData.Ptr(), aData.Size());
1.61 + }
1.62 + }
1.63 + iCallBack.CallBack();
1.64 + }
1.65 +
1.66 +void CWsGdCoverage::OnReplace()
1.67 + {
1.68 + }
1.69 +
1.70 +EXPORT_C TInt CWsGdCoverage::RunTest(TInt aCode)
1.71 + {
1.72 + if (!iIsReady)
1.73 + return KErrNotReady;
1.74 +
1.75 + TBuf8<1> cmd;
1.76 + cmd.Append(aCode);
1.77 +
1.78 + SendMessage(cmd);
1.79 + return Flush();
1.80 + }
1.81 +
1.82 +EXPORT_C TInt CWsGdCoverage::QueryPlugin(TGdCoverageInfo& aInfo)
1.83 + {
1.84 + TBuf8<1> cmd;
1.85 + cmd.Append(KGdCoverageCmdQuery);
1.86 + SendMessage(cmd);
1.87 + TInt err = Flush();
1.88 + if (err!=KErrNone)
1.89 + return err;
1.90 + iReq = &aInfo;
1.91 + return KErrNone;
1.92 + }
1.93 +
1.94 +EXPORT_C void CWsGdCoverage::SetCallBack(TCallBack aCallBack)
1.95 + {
1.96 + iCallBack = aCallBack;
1.97 + }