Cosmos/Tests/GraphicTest/Kernel.cs
José Pedro 490506edab Added back the MemberwiseClone plug.
Fixed issue with dotnet sdk version.
2017-05-16 22:29:02 +01:00

78 lines
2.3 KiB
C#

using System;
using Sys = Cosmos.System;
using Cosmos.TestRunner;
using Cosmos.System.Graphics;
/*
* Please note this is an atypical TestRunner:
* - no Assertion can be done
* - it cannot be executed automatically
*
* it exists to make easier tests while changing low level stuff (it would be better and faster to use the Demo kernel but
* sometimes it is a problem to make it see modifications done at low level)
*
* Remember to comment this test again on TestKernelSets.cs when you are ready to merge your modifications!
*/
namespace GraphicTest
{
public class Kernel : Sys.Kernel
{
Canvas canvas;
protected override void BeforeRun()
{
Console.WriteLine("Cosmos booted successfully. Let's go in Graphic Mode");
canvas = FullScreenCanvas.GetFullScreenCanvas();
canvas.Clear(Color.Blue);
}
protected override void Run()
{
try
{
mDebugger.Send("Run");
/* A red Point */
Pen pen = new Pen(Color.Red);
canvas.DrawPoint(pen, 69, 69);
/* A GreenYellow horizontal line */
pen.Color = Color.GreenYellow;
canvas.DrawLine(pen, 250, 100, 400, 100);
/* An IndianRed vertical line */
pen.Color = Color.IndianRed;
canvas.DrawLine(pen, 350, 150, 350, 250);
/* A MintCream diagonal line */
pen.Color = Color.MintCream;
canvas.DrawLine(pen, 250, 150, 400, 250);
/* A PaleVioletRed rectangle */
pen.Color = Color.PaleVioletRed;
canvas.DrawRectangle(pen, 350, 350, 80, 60);
Console.ReadKey();
/* Let's try to change mode...*/
canvas.Mode = new Mode(800, 600, ColorDepth.ColorDepth32);
/* A LimeGreen rectangle */
pen.Color = Color.LimeGreen;
canvas.DrawRectangle(pen, 450, 450, 80, 60);
Console.ReadKey();
TestController.Completed();
}
catch (Exception e)
{
mDebugger.Send("Exception occurred: " + e.Message);
mDebugger.Send(e.Message);
TestController.Failed();
}
}
}
}