os/kernelhwsrv/kerneltest/e32test/window/t_colour.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/window/t_colour.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,105 @@
     1.4 +// Copyright (c) 1996-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 the License "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 +// e32test\window\t_colour.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include <e32test.h>
    1.22 +#include <e32twin.h>
    1.23 +#include <e32debug.h>
    1.24 +
    1.25 +class ColorTest
    1.26 +	{
    1.27 +public:
    1.28 +	void ModesAndText(TVideoMode aMode);
    1.29 +	void Colors();
    1.30 +	RConsole con;
    1.31 +	};
    1.32 +
    1.33 +void ColorTest::ModesAndText(TVideoMode aMode)
    1.34 +	{
    1.35 +
    1.36 +	TInt r=con.SetMode(aMode);
    1.37 +	con.SetCursorPosAbs(TPoint(1,4));
    1.38 +	if(r!=KErrNone)
    1.39 +        {
    1.40 +		con.Write(_L("Not supported."));
    1.41 +    	TConsoleKey key;
    1.42 +	    con.Read(key);
    1.43 +        }
    1.44 +	else
    1.45 +		{
    1.46 +		con.Write(_L("Normal text..."));
    1.47 +		con.SetCursorPosAbs(TPoint(1,6));
    1.48 +		con.SetTextAttribute(ETextAttributeBold);
    1.49 +		con.Write(_L("Bold text..."));
    1.50 +		con.SetCursorPosAbs(TPoint(1,8));
    1.51 +		con.SetTextAttribute(ETextAttributeInverse);
    1.52 +		con.Write(_L("Inverted text..."));
    1.53 +		con.SetCursorPosAbs(TPoint(1,10));
    1.54 +		con.SetTextAttribute(ETextAttributeHighlight);
    1.55 +		con.Write(_L("Highlighted text..."));
    1.56 +		Colors();
    1.57 +		}
    1.58 +	con.ClearScreen();
    1.59 +	con.SetTextAttribute(ETextAttributeNormal);
    1.60 +	con.SetCursorPosAbs(TPoint(3,2));
    1.61 +	}
    1.62 +	
    1.63 +void ColorTest::Colors()
    1.64 +	{
    1.65 +	RConsole col;
    1.66 +
    1.67 +	col.Create();
    1.68 +	col.Control(_L("-Vis"));
    1.69 +	col.Init(_L("Colours"),TSize(18,18));
    1.70 +	col.Control(_L("+Max"));
    1.71 +	col.SetWindowPosAbs(TPoint(1,0));
    1.72 +	col.Control(_L("+Vis -Cursor"));
    1.73 +	for(TInt t=0;t<256;t++)
    1.74 +		{
    1.75 +		if(!(t%16))
    1.76 +			col.SetCursorPosAbs(TPoint(1,1+t/16));
    1.77 +		col.SetTextColors(0,t);
    1.78 +		col.Write(_L(" "));
    1.79 +		}
    1.80 +	TConsoleKey key;
    1.81 +	col.Read(key);
    1.82 +	col.Destroy();
    1.83 +	}
    1.84 +
    1.85 +GLDEF_C TInt E32Main()
    1.86 +    {
    1.87 +	ColorTest t;
    1.88 +
    1.89 +	TInt r = t.con.Init(_L("Colour Test"),TSize(28,12));
    1.90 +	if (r != KErrNone)
    1.91 +		{
    1.92 +		RDebug::Printf("Could not create text console: %d", r);
    1.93 +		return r;
    1.94 +		}
    1.95 +	
    1.96 +	t.con.Control(_L("+Max"));
    1.97 +	t.con.SetCursorPosAbs(TPoint(3,2));
    1.98 +	t.con.Write(_L("Testing mode EMono:"));
    1.99 +	t.ModesAndText(EMono);
   1.100 +	t.con.Write(_L("Testing mode EGray4:"));
   1.101 +	t.ModesAndText(EGray4);
   1.102 +	t.con.Write(_L("Testing mode EGray16:"));
   1.103 +	t.ModesAndText(EGray16);
   1.104 +	t.con.Write(_L("Testing mode EColor256:"));
   1.105 +	t.ModesAndText(EColor256);
   1.106 +
   1.107 +	return(0);
   1.108 +    }