using System.Globalization;
using System.Text.RegularExpressions;
namespace Anubis.Tests;
///
/// SPEC 13.4: the seven text colours reach 4.5:1 on the page and on the panels, the control border 3:1 on the panels,
/// in both themes; and the style uses no colour outside appendix C.
///
[TestClass]
[TestCategory(Category.Unit)]
public sealed partial class ContrastTests
{
private static readonly string[] _texts = ["--text", "--text-2", "--text-3", "--link", "--gain", "--loss", "--attention"];
private static string Css() => File.ReadAllText(Path.Combine(Repo.Root.FullName, "src", "Anubis.Server", "Assets", "app.css"));
private static Dictionary Block(string css, string selector)
{
var start = css.IndexOf(selector + " {", StringComparison.Ordinal);
Assert.IsGreaterThanOrEqualTo(0, start, "Missing block " + selector);
var end = css.IndexOf('}', start);
return Token().Matches(css[start..end]).ToDictionary(m => m.Groups[1].Value, m => m.Groups[2].Value.ToLowerInvariant(), StringComparer.Ordinal);
}
public static IEnumerable