aboutsummaryrefslogtreecommitdiffstatsci
path: root/unitTests/TestBackend.cs
blob: 4ad680e8d4b54710a8af77add93b7c5bb2ad3351 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2020  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using System.Globalization;
using Crow;
using NUnit.Framework;

namespace unitTests
{
	public class TestInterface : Interface
	{
		public TestInterface (int width = 800, int height = 600)
			: base (width, height, false, false) {
			surf = new Crow.Cairo.ImageSurface (Crow.Cairo.Format.Argb32, ClientRectangle.Width, ClientRectangle.Height);
		}
		bool isRunning;
		public bool IsRunning {
			get => isRunning;
			set => isRunning = value; 
		}

	}
	[TestFixture]
	public class TestBackend
	{
		TestInterface iFace;

		[OneTimeSetUp]
		public void Init ()
		{
			iFace = new TestInterface (800, 600);
			iFace.Init ();
		}

		//[SetUp] public void InitTest (){}
		//[TearDown] public void CleanupTest (){}

		[Test]
		public void Widget ()
			=> Assert.DoesNotThrow (()
				=> { iFace.LoadIMLFragment (@"<Widget/>"); iFace.Update (); }
				, "iFace load IML fragment failed");
		[Test]
		public void Label ()
			=> Assert.DoesNotThrow (()
				=> { iFace.LoadIMLFragment (@"<Label Text='this is a test string'/>"); iFace.Update (); }
				, "iFace load IML fragment failed");

		[Test]
		public void TemplatedControl ()
			=> Assert.DoesNotThrow (()
				=> { iFace.LoadIMLFragment (@"<CheckBox IsChecked='true'/>"); iFace.Update (); }
				, "iFace load IML fragment failed");
	}
}