Skip to content

Commit 1bf5f70

Browse files
committed
Rename Channel to ChannelValue
1 parent 2bb946b commit 1bf5f70

9 files changed

Lines changed: 114 additions & 114 deletions

File tree

AssetRipper.TextureDecoder.TestGenerator/TestClassGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private static void MakeGenericColorTests()
127127
writer.WriteLine($"[TestFixture(TypeArgs = new Type[] {{ typeof({colorName}<{channeName}>), typeof({channeName}) }})]");
128128
}
129129
}
130-
writer.WriteLine("partial class GenericColorTests<TColor, TChannel>");
130+
writer.WriteLine("partial class GenericColorTests<TColor, TChannelValue>");
131131
using (new CurlyBrackets(writer))
132132
{
133133
}
@@ -354,4 +354,4 @@ private static void WritePropertySymmetryTests(this IndentedTextWriter textWrite
354354
textWriter.WriteLine();
355355
}
356356
}
357-
}
357+
}

AssetRipper.TextureDecoder.Tests/Formats/ColorRandom.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using AssetRipper.TextureDecoder.Rgb;
22

33
namespace AssetRipper.TextureDecoder.Tests.Formats;
4-
internal static class ColorRandom<TColor, TChannel> where TColor : unmanaged, IColor<TChannel> where TChannel : unmanaged
4+
internal static class ColorRandom<TColor, TChannelValue> where TColor : unmanaged, IColor<TChannelValue> where TChannelValue : unmanaged
55
{
6-
public static TChannel MakeRandomValue()
6+
public static TChannelValue MakeRandomValue()
77
{
88
ulong value = TestContext.CurrentContext.Random.NextULong();
9-
return NumericConversion.Convert<ulong, TChannel>(value);
9+
return NumericConversion.Convert<ulong, TChannelValue>(value);
1010
}
1111

1212
public static TColor MakeRandomColor()

AssetRipper.TextureDecoder.Tests/Formats/Generic/GenericColorTests.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33

44
namespace AssetRipper.TextureDecoder.Tests.Formats.Generic;
55

6-
internal partial class GenericColorTests<TColor, TChannel> where TColor : unmanaged, IColor<TChannel> where TChannel : unmanaged
6+
internal partial class GenericColorTests<TColor, TChannelValue> where TColor : unmanaged, IColor<TChannelValue> where TChannelValue : unmanaged
77
{
88
[Test]
99
public void CorrectSizeTest()
1010
{
11-
Assert.That(Unsafe.SizeOf<TColor>(), Is.EqualTo(Color.GetChannelCount<TColor>() * Unsafe.SizeOf<TChannel>()));
11+
Assert.That(Unsafe.SizeOf<TColor>(), Is.EqualTo(Color.GetChannelCount<TColor>() * Unsafe.SizeOf<TChannelValue>()));
1212
}
1313

1414
[Test]
1515
public void PropertyIsSymmetric_R()
1616
{
1717
TColor color = MakeRandomColor();
18-
TChannel r = color.R;
18+
TChannelValue r = color.R;
1919
color.R = r;
2020
Assert.That(color.R, Is.EqualTo(r));
2121
}
@@ -24,7 +24,7 @@ public void PropertyIsSymmetric_R()
2424
public void PropertyIsSymmetric_G()
2525
{
2626
TColor color = MakeRandomColor();
27-
TChannel g = color.G;
27+
TChannelValue g = color.G;
2828
color.G = g;
2929
Assert.That(color.G, Is.EqualTo(g));
3030
}
@@ -33,7 +33,7 @@ public void PropertyIsSymmetric_G()
3333
public void PropertyIsSymmetric_B()
3434
{
3535
TColor color = MakeRandomColor();
36-
TChannel b = color.B;
36+
TChannelValue b = color.B;
3737
color.B = b;
3838
Assert.That(color.B, Is.EqualTo(b));
3939
}
@@ -42,7 +42,7 @@ public void PropertyIsSymmetric_B()
4242
public void PropertyIsSymmetric_A()
4343
{
4444
TColor color = MakeRandomColor();
45-
TChannel a = color.A;
45+
TChannelValue a = color.A;
4646
color.A = a;
4747
Assert.That(color.A, Is.EqualTo(a));
4848
}
@@ -51,9 +51,9 @@ public void PropertyIsSymmetric_A()
5151
public void ChannelsAreIndependent_R()
5252
{
5353
TColor color = MakeRandomColor();
54-
TChannel g = color.G;
55-
TChannel b = color.B;
56-
TChannel a = color.A;
54+
TChannelValue g = color.G;
55+
TChannelValue b = color.B;
56+
TChannelValue a = color.A;
5757
color.R = MakeRandomValue();
5858
Assert.Multiple(() =>
5959
{
@@ -67,9 +67,9 @@ public void ChannelsAreIndependent_R()
6767
public void ChannelsAreIndependent_G()
6868
{
6969
TColor color = MakeRandomColor();
70-
TChannel r = color.R;
71-
TChannel b = color.B;
72-
TChannel a = color.A;
70+
TChannelValue r = color.R;
71+
TChannelValue b = color.B;
72+
TChannelValue a = color.A;
7373
color.G = MakeRandomValue();
7474
Assert.Multiple(() =>
7575
{
@@ -83,9 +83,9 @@ public void ChannelsAreIndependent_G()
8383
public void ChannelsAreIndependent_B()
8484
{
8585
TColor color = MakeRandomColor();
86-
TChannel r = color.R;
87-
TChannel g = color.G;
88-
TChannel a = color.A;
86+
TChannelValue r = color.R;
87+
TChannelValue g = color.G;
88+
TChannelValue a = color.A;
8989
color.B = MakeRandomValue();
9090
Assert.Multiple(() =>
9191
{
@@ -99,9 +99,9 @@ public void ChannelsAreIndependent_B()
9999
public void ChannelsAreIndependent_A()
100100
{
101101
TColor color = MakeRandomColor();
102-
TChannel r = color.R;
103-
TChannel g = color.G;
104-
TChannel b = color.B;
102+
TChannelValue r = color.R;
103+
TChannelValue g = color.G;
104+
TChannelValue b = color.B;
105105
color.A = MakeRandomValue();
106106
Assert.Multiple(() =>
107107
{
@@ -115,7 +115,7 @@ public void ChannelsAreIndependent_A()
115115
public void GetMethodMatchesProperties()
116116
{
117117
TColor color = MakeRandomColor();
118-
color.GetChannels(out TChannel r, out TChannel g, out TChannel b, out TChannel a);
118+
color.GetChannels(out TChannelValue r, out TChannelValue g, out TChannelValue b, out TChannelValue a);
119119
Assert.Multiple(() =>
120120
{
121121
Assert.That(color.R, Is.EqualTo(r));
@@ -129,7 +129,7 @@ public void GetMethodMatchesProperties()
129129
public void MethodsAreSymmetric()
130130
{
131131
TColor color = MakeRandomColor();
132-
color.GetChannels(out TChannel r, out TChannel g, out TChannel b, out TChannel a);
132+
color.GetChannels(out TChannelValue r, out TChannelValue g, out TChannelValue b, out TChannelValue a);
133133
color.SetChannels(r, g, b, a);
134134
Assert.Multiple(() =>
135135
{
@@ -140,7 +140,7 @@ public void MethodsAreSymmetric()
140140
});
141141
}
142142

143-
private static TChannel MakeRandomValue() => ColorRandom<TColor, TChannel>.MakeRandomValue();
143+
private static TChannelValue MakeRandomValue() => ColorRandom<TColor, TChannelValue>.MakeRandomValue();
144144

145-
private static TColor MakeRandomColor() => ColorRandom<TColor, TChannel>.MakeRandomColor();
145+
private static TColor MakeRandomColor() => ColorRandom<TColor, TChannelValue>.MakeRandomColor();
146146
}

AssetRipper.TextureDecoder.Tests/Formats/Generic/GenericColorTests.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@ namespace AssetRipper.TextureDecoder.Tests.Formats.Generic;
8888
[TestFixture(TypeArgs = new Type[] { typeof(ColorRGB<decimal>), typeof(decimal) })]
8989
[TestFixture(TypeArgs = new Type[] { typeof(ColorRGBA<decimal>), typeof(decimal) })]
9090
[TestFixture(TypeArgs = new Type[] { typeof(ColorA<decimal>), typeof(decimal) })]
91-
partial class GenericColorTests<TColor, TChannel>
91+
partial class GenericColorTests<TColor, TChannelValue>
9292
{
9393
}

AssetRipper.TextureDecoder.Tests/Formats/LosslessConversion.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
namespace AssetRipper.TextureDecoder.Tests.Formats;
44
internal static class LosslessConversion
55
{
6-
internal static void Assert<TColor1, TChannel1, TColor2, TChannel2>()
7-
where TChannel1 : unmanaged
8-
where TChannel2 : unmanaged
9-
where TColor1 : unmanaged, IColor<TChannel1>
10-
where TColor2 : unmanaged, IColor<TChannel2>
6+
internal static void Assert<TColor1, TChannelValue1, TColor2, TChannelValue2>()
7+
where TChannelValue1 : unmanaged
8+
where TChannelValue2 : unmanaged
9+
where TColor1 : unmanaged, IColor<TChannelValue1>
10+
where TColor2 : unmanaged, IColor<TChannelValue2>
1111
{
12-
TColor1 original = ColorRandom<TColor1, TChannel1>.MakeRandomColor();
13-
TColor2 converted = original.Convert<TColor1, TChannel1, TColor2, TChannel2>();
14-
TColor1 convertedBack = converted.Convert<TColor2, TChannel2, TColor1, TChannel1>();
12+
TColor1 original = ColorRandom<TColor1, TChannelValue1>.MakeRandomColor();
13+
TColor2 converted = original.Convert<TColor1, TChannelValue1, TColor2, TChannelValue2>();
14+
TColor1 convertedBack = converted.Convert<TColor2, TChannelValue2, TColor1, TChannelValue1>();
1515
NUnit.Framework.Assert.That(convertedBack, Is.EqualTo(original));
1616
}
17-
}
17+
}

0 commit comments

Comments
 (0)