sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: #ifndef __TREDRSTR_H__ sl@0: #define __TREDRSTR_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include "../../tlib/testbase.h" sl@0: #include "AUTO.H" sl@0: #include "TGraphicsHarness.h" sl@0: #include "TScreenModeScaling.h" sl@0: sl@0: sl@0: class CRedrawStoreWin; sl@0: class CNoDrawWin; sl@0: class CBitmapMaskedWin; sl@0: class CResetRedrawStoreWin; sl@0: sl@0: sl@0: class CTRedrawStoring : public CTWsGraphicsBase sl@0: { sl@0: public: sl@0: CTRedrawStoring(CTestStep* aStep); sl@0: ~CTRedrawStoring(); sl@0: void ConstructL(); sl@0: sl@0: void CheckWindowsMatch(); sl@0: void CheckWindowsMatchLossy(); sl@0: void CheckWindowsNotMatch(); sl@0: void HideRevealTest(); sl@0: void MultipleHideReveal(TInt aX,TInt aY); sl@0: void RedrawWindows(); sl@0: void DoDrawingL(CWindowGc* aWinGc); sl@0: void DoDrawingL(TInt aDraw,CBitmapContext* aGc,TBool aWinGc); sl@0: void ScrollTest(); sl@0: void FadeWindowTest(); sl@0: void FadeWindowTest2L(); sl@0: void DoDrawTest(); sl@0: void DoScrollTest(); sl@0: void SetScrolling(TPoint aScrollSource, TRect aScrollTarget); sl@0: //Pure Virtual Function from CTestBase sl@0: void DoNothingInRedrawTest(); sl@0: void DoDisableRedrawStoreTest(); sl@0: void DoBitBltAndMaskedNegTestsL(); sl@0: void DoResizeTest(); sl@0: void DoTestDrawBitmapMaskedL(TBool aWsBitmap=EFalse); sl@0: void DrawBitmapAndCheckL(const TSize aSize,TDisplayMode aDisplayMode,CFbsBitmap* aSrceBitmap,CFbsBitmap* aMaskBitmap,TBool aInvertMask); sl@0: void DoFontCacheOverflowTestL(); sl@0: void FontCacheOverflowDrawingTestL(TBool aDiffGc, RWindow& aWindow); sl@0: void DoInvisibleRedrawStoreTestL( TBool aUseTransparency ); sl@0: void DoBrushDrawTestL(); sl@0: void DoPartialDrawNowTestL( TBool aUseTransparency ); sl@0: void DoBeginEndRedraw(); sl@0: void DoRedrawStoreAlphaChannelTransTest(); sl@0: sl@0: void DoExposeTestL(TInt aIteration); sl@0: void DoExposeTest2L(TInt aIteration); sl@0: void DoEmptyDrawTestL(TInt aTestMode); sl@0: void DoPolygonRedrawTestSetL(); sl@0: void DoPolygonRedrawTestL(TInt aWindowMode, TInt aTestMode); sl@0: void DoRedrawOOMTestL(); sl@0: void RedrawStoreWithBadRectL(); sl@0: protected: sl@0: virtual void RunTestCaseL(TInt aCurTestCase); sl@0: void DoAutoResetRedrawStoreTestL(TBool aTwoWins, TBool aAnimateBothWins, TBool aKeepGcActive, TBool aUpdateInRedraw); sl@0: void AutoResetRedrawStoreTestsL(); sl@0: void RedrawStoreWithSetExtentL(); sl@0: void PartialRedrawWithEmptyRedrawStoreL(); sl@0: void DoPartialRedrawWithEmptyRedrawStoreL(TInt aNumWins, TBool aDoWinOnTop, TBool aRedrawWindow, TBool aChildWindows); sl@0: CResetRedrawStoreWin* CreatePartialRedrawWinLC(const TPoint& aPos, const TSize& aSize, CTWin* aParent=NULL); sl@0: CNoDrawWin* CreateNoDrawWinLC(const TPoint &aPos, const TSize &aSize); sl@0: void GetTestWinSizeAndPos(TInt aWinIndex, TPoint &aPos, TSize &aSize) const; sl@0: void ScrollWinTest(); sl@0: public: sl@0: TInt iDrawOrder; sl@0: TBool iQueueTest; sl@0: sl@0: private: sl@0: enum TDrawingMode sl@0: { sl@0: EServerRedraw, sl@0: EClientRedrawsNormal, sl@0: EClientRedrawsScrolled, sl@0: }; sl@0: TPoint ComputeTextPosition(TPoint aPoint); sl@0: CTBackedUpWin* iCheckWin; sl@0: CFbsBitmap* iCheckBitmap; sl@0: CFbsBitmapDevice* iCheckDevice; sl@0: CFbsBitGc* iCheckGc; sl@0: CRedrawStoreWin* iTestWin; sl@0: TSize iWinSize; sl@0: TPoint iWinPos; sl@0: TDrawingMode iDrawMode; sl@0: RBlankWindow iBlankWin; sl@0: RRegion iRegion; sl@0: RWindow iWinTestGc; sl@0: TBool iWindowsFaded; sl@0: TRect iScrollTarget; sl@0: TPoint iScrollSource; sl@0: TBool iDoScrollTest; sl@0: CNoDrawWin* iNoDrawWin; sl@0: TBool iClientDidDraw; sl@0: CWsBitmap* iAlphaBitmap[3]; sl@0: TBool iAlphaSupported; sl@0: CBitmapMaskedWin* iBitmapMaskedWin; sl@0: CBitmap* iTestBitmap; sl@0: CBitMapWin* iTestBitmapWin; sl@0: TRect iWinRect; sl@0: TPoint iTestWinPoint; sl@0: TBool iXPlus; sl@0: TBool iYPlus; sl@0: TInt iState; sl@0: TInt iYPoz; sl@0: TDisplayMode iTestDisplayMode; sl@0: CFbsBitmap *iTestWinCopy; sl@0: CFbsBitmap *iCheckWinCopy; sl@0: }; sl@0: sl@0: class CRedrawStoreWin : public CTWin sl@0: { sl@0: public: sl@0: inline CRedrawStoreWin(CTRedrawStoring* aTest) : iDrawOrder(0), iTest(aTest){} sl@0: //Virtual Function from CTBaseWin sl@0: void Draw(); sl@0: public: sl@0: TInt iDrawOrder; sl@0: private: sl@0: CTRedrawStoring *iTest; sl@0: }; sl@0: sl@0: class CNoDrawWin : public CTWin sl@0: { sl@0: public: sl@0: void Draw(); sl@0: }; sl@0: sl@0: class CBrushDrawWin : public CTWin sl@0: { sl@0: public: sl@0: CBrushDrawWin(); sl@0: void Draw(); sl@0: void Redraw(); sl@0: sl@0: private: sl@0: }; sl@0: sl@0: class CBitmapMaskedWin : public CTWin sl@0: { sl@0: public: sl@0: static CBitmapMaskedWin* NewL(CFbsBitmap* aFbsBitmap,CFbsBitmap* aFbsMaskBitmap, sl@0: CWsBitmap* aWsBitmap,CWsBitmap* aWsMaskBitmap, sl@0: TRgb aBackground,TRect aRect,TBool aInvertMask,TBool aWsFbs); sl@0: ~CBitmapMaskedWin(); sl@0: //Virtual Function from CTBaseWin sl@0: void Draw(); sl@0: void SetDestRectSize(const TSize aSize); sl@0: inline void SetInvertMask(TBool aInvertMask){iInvertMask=aInvertMask;} sl@0: private: sl@0: inline CBitmapMaskedWin(CFbsBitmap* aFbsBitmap,CFbsBitmap* aFbsMaskBitmap,CWsBitmap* aWsBitmap,CWsBitmap* aWsMaskBitmap, sl@0: TRect aRect,TBool aInvertMask,TBool aWsFbs): sl@0: iFbsBitmap(aFbsBitmap),iFbsMaskBitmap(aFbsMaskBitmap), sl@0: iWsBitmap(aWsBitmap),iWsMaskBitmap(aWsMaskBitmap), sl@0: iRect(aRect),iInvertMask(aInvertMask),iWsFbs(aWsFbs) {} sl@0: private: sl@0: CFbsBitmap* iFbsBitmap; sl@0: CFbsBitmap* iFbsMaskBitmap; sl@0: CWsBitmap* iWsBitmap; sl@0: CWsBitmap* iWsMaskBitmap; sl@0: TRect iRect; sl@0: TBool iInvertMask; sl@0: TBool iWsFbs; sl@0: }; sl@0: sl@0: class CPartialRedrawWin : public CTWin sl@0: { sl@0: public: sl@0: void Init(); sl@0: virtual void Draw(); sl@0: void DrawToBmp(CGraphicsContext& aGc); sl@0: void DrawPartial(TPartialRedrawType aPartialRedrawType); sl@0: static void DrawRects(CGraphicsContext& aGc, TSize aSize, TPoint aPosition, sl@0: TBool aIsFullRedraw, TPartialRedrawType aPartialRedrawType); sl@0: void RedrawSubRectWithBitmapL(TRgb aBitmapColour); sl@0: public: sl@0: TBool iClientDrawn; sl@0: TBool iClientCanDraw; sl@0: private: sl@0: void DoDraw(CGraphicsContext& aGc); sl@0: private: sl@0: }; sl@0: sl@0: class CPartialRedrawBottomWin : public CTWin sl@0: { sl@0: public: sl@0: void Init(); sl@0: virtual void Draw(); sl@0: void DrawPartial(TRect aRect); sl@0: void DrawFullWindowRect(); sl@0: private: sl@0: void DoDraw(); sl@0: }; sl@0: sl@0: class CPartialRedrawTopWin : public CTWin sl@0: { sl@0: public: sl@0: void Init(); sl@0: virtual void Draw(); sl@0: void DrawPartial(TRect aRect); sl@0: void DrawFullWindowRect(); sl@0: private: sl@0: void DoDraw(); sl@0: }; sl@0: sl@0: class CPartialRedrawTiledWin : public CTWin sl@0: { sl@0: public: sl@0: void Init(TRgb aColour,TBool aTransparent); sl@0: virtual void Draw(); sl@0: void DrawPartial(TRect aRect); sl@0: void DrawFullWindowRect(); sl@0: private: sl@0: void DoDraw(); sl@0: private: sl@0: TRgb iColour; sl@0: }; sl@0: sl@0: class CInvisibleRedrawWin: public CTWin sl@0: { sl@0: public: sl@0: CInvisibleRedrawWin(); sl@0: TInt MakeTransparent(); sl@0: void MakeVisible( TBool aVisible ); sl@0: virtual void Redraw(); sl@0: virtual void Redraw( const TRect &aRect ); sl@0: sl@0: private: sl@0: void DrawIfVisible(); sl@0: sl@0: private: sl@0: TBool iVisible; sl@0: TBool iTransparent; sl@0: }; sl@0: sl@0: class CPartialDrawNowWin: public CTWin sl@0: { sl@0: public: sl@0: CPartialDrawNowWin(); sl@0: TInt MakeTransparent(); sl@0: void SetLodger( const TRect &aLodger ); sl@0: virtual void Redraw(); sl@0: virtual void Redraw( const TRect &aRect ); sl@0: sl@0: private: sl@0: void DrawWindowAndLodger(); sl@0: sl@0: private: sl@0: TRect iLodger; sl@0: TBool iTransparent; sl@0: }; sl@0: sl@0: class CPartialRedrawEmptyWin : public CTWin sl@0: { sl@0: public: sl@0: void Init(TRgb aColor); sl@0: virtual void Draw(); sl@0: void DrawPartial(TRect aRect); sl@0: void DrawFullWindowRect(); sl@0: inline TInt ReturnCount(); sl@0: private: sl@0: void DoDraw(); sl@0: TInt iCount; sl@0: }; sl@0: sl@0: class CPartialRedrawPolygonWin : public CTWin sl@0: { sl@0: public: sl@0: void Init(TInt aWindowMode, TRgb aColor); sl@0: virtual void Draw(); sl@0: void DrawPartial(); sl@0: void DrawFullWindowPolygonL(); sl@0: inline TInt ReturnCount(); sl@0: private: sl@0: void DoDraw(); sl@0: TInt iCount; sl@0: }; sl@0: sl@0: class CRedrawRectWin : public CTWin sl@0: { sl@0: public: sl@0: void Init(); sl@0: void DrawNow(); sl@0: void DrawFullWindowRect(); sl@0: inline TInt RedrawCount(); sl@0: void ResetWindow(TRgb aColour); sl@0: inline void SetLogging(CTWsGraphicsBase* aTest); sl@0: //Virtual function from CTBaseWin sl@0: void Draw(); sl@0: //Virtual function from CTWin sl@0: void Redraw(const TRect& aRect); sl@0: private: sl@0: void DoDraw(); sl@0: private: sl@0: TInt iRedrawCount; sl@0: TRgb iRectColour; sl@0: CTWsGraphicsBase* iLog; sl@0: }; sl@0: sl@0: class CTRedrawStoringStep : public CTGraphicsStep sl@0: { sl@0: public: sl@0: CTRedrawStoringStep(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual CTGraphicsBase* CreateTestL(); sl@0: }; sl@0: sl@0: class CResetRedrawStoreWin : public CPartialRedrawWin sl@0: { sl@0: public: sl@0: ~CResetRedrawStoreWin(); sl@0: void SetUpdateInRedraw(TBool aUpdateInRedraw); sl@0: void SetKeepGcActive(TBool aState); sl@0: void UpdateAnim(TInt aSteps); sl@0: void PreSetSize(const TSize &aSize); sl@0: TBool Failed() const; sl@0: private: sl@0: virtual void Draw(); sl@0: void DoDraw(CGraphicsContext& aGc) const; sl@0: void DoDrawAnim(CGraphicsContext& aGc) const; sl@0: TRect AnimRect() const; sl@0: private: sl@0: TInt iAnimState; sl@0: TBool iKeepGcActive; sl@0: TBool iUpdateInRedraw; sl@0: TBool iFailed; sl@0: CWindowGc* iExtraGc; sl@0: }; sl@0: sl@0: const TInt KEmptyLoopThreshold = 3; sl@0: sl@0: _LIT(KTRedrawStoringStep,"TRedrawStoring"); sl@0: sl@0: sl@0: #endif