summaryrefslogtreecommitdiff
path: root/ElmSharp.Test/TC/SpinnerTest1.cs
blob: ebf292f9c66a43aba9e191d5862c86798728ea93 (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
57
58
59
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ElmSharp.Test
{
    class SpinnerTest1 : TestCaseBase
    {
        public override string TestName => "SpinnerTest1";
        public override string TestDescription => "To test basic operation of Spinner";

        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);
            conformant.Show();
            Table table = new Table(window);
            conformant.SetContent(table);
            table.Show();

            Spinner spn1 = new Spinner(window)
            {
                Text = "Slider Test",
                LabelFormat = "%1.2f Value",
                Minimum = 1,
                Maximum = 12,
                Value = 1.5,
                Step = 0.5,
                Interval = 0.5,
                AlignmentX = -1,
                AlignmentY = 0.5,
                WeightX = 1,
                WeightY = 1
            };
            spn1.AddSpecialValue(5, "Five !!!!");

            Label lb1 = new Label(window)
            {
                AlignmentX = -1,
                AlignmentY = 0,
                WeightX = 1,
                WeightY = 1
            };

            table.Pack(spn1, 1, 1, 2, 1);
            table.Pack(lb1, 1, 2, 2, 1);

            spn1.Show();
            lb1.Show();

            spn1.ValueChanged += (s, e) =>
            {
                lb1.Text = string.Format("Value Changed: {0}", spn1.Value);
                lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
            };
        }
    }
}