emacsPackages.treemacs: replace python3 program (#364623)
[NixPkgs.git] / pkgs / by-name / av / avalonia / 0001-use-files-for-unicode-character-database.patch
blob5d0ecef4a44b0039f9a7dd1027033dd2f1890d82
1 From f4c599a48d153d15ccb1879ff511617c8e310515 Mon Sep 17 00:00:00 2001
2 From: David McFarland <corngood@gmail.com>
3 Date: Sat, 10 Aug 2024 23:14:12 -0300
4 Subject: [PATCH 1/2] use files for unicode character database
6 ---
7 .../BiDiClassTestDataGenerator.cs | 1 -
8 .../TextFormatting/BiDiTestDataGenerator.cs | 1 -
9 .../GraphemeBreakClassTrieGenerator.cs | 1 -
10 .../GraphemeBreakTestDataGenerator.cs | 1 -
11 .../LineBreakEnumuratorTests.cs | 1 -
12 .../TextFormatting/UnicodeDataGenerator.cs | 28 +++++++++++++++++--
13 .../TextFormatting/UnicodeEnumsGenerator.cs | 1 -
14 7 files changed, 26 insertions(+), 8 deletions(-)
16 diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTestDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTestDataGenerator.cs
17 index f6b01d737..bc7278ef8 100644
18 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTestDataGenerator.cs
19 +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTestDataGenerator.cs
20 @@ -3,7 +3,6 @@
21 using System.Collections.Generic;
22 using System.IO;
23 using System.Linq;
24 -using System.Net.Http;
25 using Avalonia.Base.UnitTests.Media.TextFormatting;
27 namespace Avalonia.Visuals.UnitTests.Media.TextFormatting
28 diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs
29 index 28d37130a..5e26edf49 100644
30 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs
31 +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs
32 @@ -3,7 +3,6 @@
33 using System.Collections.Generic;
34 using System.IO;
35 using System.Linq;
36 -using System.Net.Http;
37 using Avalonia.Base.UnitTests.Media.TextFormatting;
38 using Avalonia.Media.TextFormatting.Unicode;
40 diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs
41 index 1a8d41caa..185b6ea62 100644
42 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs
43 +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs
44 @@ -1,7 +1,6 @@
45 using System;
46 using System.Collections.Generic;
47 using System.IO;
48 -using System.Net.Http;
49 using System.Text.RegularExpressions;
50 using Avalonia.Media.TextFormatting.Unicode;
52 diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs
53 index 029f8e236..44c2aaf6a 100644
54 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs
55 +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs
56 @@ -3,7 +3,6 @@
57 using System.Collections.Generic;
58 using System.IO;
59 using System.Linq;
60 -using System.Net.Http;
61 using Avalonia.Base.UnitTests.Media.TextFormatting;
63 namespace Avalonia.Visuals.UnitTests.Media.TextFormatting
64 diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs
65 index 3db9a32b6..b8df1f446 100644
66 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs
67 +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs
68 @@ -3,7 +3,6 @@
69 using System.Collections.Generic;
70 using System.IO;
71 using System.Linq;
72 -using System.Net.Http;
73 using Avalonia.Media.TextFormatting;
74 using Avalonia.Media.TextFormatting.Unicode;
75 using Xunit;
76 diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs
77 index f05a1e574..7e698ae0a 100644
78 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs
79 +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs
80 @@ -1,16 +1,40 @@
81 using System;
82 using System.Collections.Generic;
83 using System.IO;
84 -using System.Net.Http;
85 using System.Text.RegularExpressions;
86 +using System.Threading.Tasks;
87 using Avalonia.Media.TextFormatting.Unicode;
88 using Xunit;
90 namespace Avalonia.Base.UnitTests.Media.TextFormatting
92 + class HttpContent : IDisposable {
93 + readonly string url;
94 + public HttpContent(string url) => this.url = url;
96 + public void Dispose() {}
97 + public Task<Stream> ReadAsStreamAsync() =>
98 + Task.FromResult<Stream>(File.OpenRead(url));
99 + }
101 + class HttpResponseMessage : IDisposable {
102 + HttpContent content;
103 + public HttpResponseMessage(string url) => Content = new(url);
105 + public void Dispose() {}
106 + public bool IsSuccessStatusCode => true;
107 + public HttpContent Content { get; init; }
110 + class HttpClient : IDisposable {
111 + public void Dispose() {}
112 + public Task<HttpResponseMessage> GetAsync(string url) =>
113 + Task.FromResult<HttpResponseMessage>(new (url));
116 internal static class UnicodeDataGenerator
118 - public const string Ucd = "https://www.unicode.org/Public/15.0.0/ucd/";
119 + public static readonly string Ucd = Environment.GetEnvironmentVariable("UNICODE_CHARACTER_DATABASE");
121 public static UnicodeTrie GenerateBiDiTrie(out BiDiDataEntries biDiDataEntries, out Dictionary<int, BiDiDataItem> biDiData)
123 diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs
124 index 110e57cbd..7073ea508 100644
125 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs
126 +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs
127 @@ -2,7 +2,6 @@
128 using System.Collections.Generic;
129 using System.IO;
130 using System.Linq;
131 -using System.Net.Http;
133 namespace Avalonia.Base.UnitTests.Media.TextFormatting
136 2.42.2