forked from chickensoft-games/GodotTestDriver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LabelDriver.cs
43 lines (39 loc) · 1.2 KB
/
LabelDriver.cs
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
namespace Chickensoft.GodotTestDriver.Drivers;
using System;
using Godot;
using JetBrains.Annotations;
/// <summary>
/// Driver for the <see cref="Label"/> control.
/// </summary>
/// <typeparam name="T">Label type.</typeparam>
[PublicAPI]
public class LabelDriver<T> : ControlDriver<T> where T : Label
{
/// <summary>
/// Creates a new generic LabelDriver.
/// </summary>
/// <param name="producer">Producer that creates a Label subclass.</param>
/// <param name="description">Driver description.</param>
public LabelDriver(Func<T> producer, string description = "") : base(producer, description)
{
}
/// <summary>
/// The current text of the label.
/// </summary>
public string Text => PresentRoot.Text;
}
/// <summary>
/// Driver for the <see cref="Label"/> control.
/// </summary>
[PublicAPI]
public sealed class LabelDriver : LabelDriver<Label>
{
/// <summary>
/// Creates a new LabelDriver.
/// </summary>
/// <param name="producer">Producer that creates a Label subclass.</param>
/// <param name="description">Driver description.</param>
public LabelDriver(Func<Label> producer, string description = "") : base(producer, description)
{
}
}