forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master-ru' of git.arumoon.ru:Workbench-Team/space-stati…
…on-14 into arumoon-server
- Loading branch information
Showing
59 changed files
with
2,140 additions
and
2,304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
<Control xmlns="https://spacestation14.io" | ||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<PanelContainer VerticalExpand="True" HorizontalExpand="True"> | ||
<PanelContainer.PanelOverride> | ||
<gfx:StyleBoxFlat BackgroundColor="#202124" /> | ||
</PanelContainer.PanelOverride> | ||
<RichTextLabel Name="Name" Margin="8 8 8 8" HorizontalAlignment="Left"/> | ||
<Button Name="Delete" | ||
MinWidth="30" | ||
HorizontalAlignment="Right" | ||
Text="{Loc 'news-write-ui-delete-text'}" | ||
Access="Public" | ||
Margin="6 6 6 6"> | ||
</Button> | ||
</PanelContainer> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="0 0 0 12"> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" VerticalExpand="True"> | ||
<PanelContainer HorizontalExpand="True" VerticalExpand="True"> | ||
<PanelContainer.PanelOverride> | ||
<gfx:StyleBoxFlat BackgroundColor="#4c6530"/> | ||
</PanelContainer.PanelOverride> | ||
<Label Name="Name" Margin="6 6 6 6" HorizontalAlignment="Center"/> | ||
</PanelContainer> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<PanelContainer HorizontalExpand="True" VerticalExpand="True"> | ||
<PanelContainer.PanelOverride> | ||
<gfx:StyleBoxFlat BackgroundColor="#33333f"/> | ||
</PanelContainer.PanelOverride> | ||
<RichTextLabel Name="Author" HorizontalExpand="True" VerticalAlignment="Bottom" Margin="6 6 6 6"/> | ||
<Button Name="Delete" | ||
Text="{Loc 'news-write-ui-delete-text'}" | ||
HorizontalAlignment="Right" | ||
Margin="8 6 6 6" | ||
Access="Public"/> | ||
</PanelContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</Control> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
Content.IntegrationTests/Tests/Serialization/SerializationTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Robust.Shared.Reflection; | ||
using Robust.Shared.Serialization.Manager; | ||
using Robust.Shared.Serialization.Manager.Attributes; | ||
using Robust.Shared.Serialization.Markdown.Value; | ||
|
||
namespace Content.IntegrationTests.Tests.Serialization; | ||
|
||
[TestFixture] | ||
public sealed class SerializationTest | ||
{ | ||
/// <summary> | ||
/// Check that serializing generic enums works as intended. This should really be in engine, but engine | ||
/// integrations tests block reflection and I am lazy.. | ||
/// </summary> | ||
[Test] | ||
public async Task SerializeGenericEnums() | ||
{ | ||
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true }); | ||
var server = pairTracker.Pair.Server; | ||
var seriMan = server.ResolveDependency<ISerializationManager>(); | ||
var refMan = server.ResolveDependency<IReflectionManager>(); | ||
|
||
Enum value = TestEnum.Bb; | ||
|
||
var node = seriMan.WriteValue(value, notNullableOverride:true); | ||
var valueNode = node as ValueDataNode; | ||
Assert.NotNull(valueNode); | ||
|
||
var expected = refMan.GetEnumReference(value); | ||
Assert.That(valueNode!.Value, Is.EqualTo(expected)); | ||
|
||
var errors = seriMan.ValidateNode<Enum>(valueNode).GetErrors(); | ||
Assert.That(errors.Any(), Is.False); | ||
|
||
var deserialized = seriMan.Read<Enum>(node, notNullableOverride:true); | ||
Assert.That(deserialized, Is.EqualTo(value)); | ||
|
||
// Repeat test with enums in a data definitions. | ||
var data = new TestData | ||
{ | ||
Value = TestEnum.Cc, | ||
Sequence = new() {TestEnum.Dd, TestEnum.Aa} | ||
}; | ||
|
||
node = seriMan.WriteValue(data, notNullableOverride:true); | ||
|
||
errors = seriMan.ValidateNode<TestData>(node).GetErrors(); | ||
Assert.That(errors.Any(), Is.False); | ||
|
||
var deserializedData = seriMan.Read<TestData>(node, notNullableOverride:false); | ||
|
||
Assert.That(deserializedData.Value, Is.EqualTo(data.Value)); | ||
Assert.That(deserializedData.Sequence.Count, Is.EqualTo(data.Sequence.Count)); | ||
Assert.That(deserializedData.Sequence[0], Is.EqualTo(data.Sequence[0])); | ||
Assert.That(deserializedData.Sequence[1], Is.EqualTo(data.Sequence[1])); | ||
|
||
// Check that Generic & non-generic serializers are incompativle. | ||
Enum genericValue = TestEnum.Bb; | ||
TestEnum typedValue = TestEnum.Bb; | ||
|
||
var genericNode = seriMan.WriteValue(genericValue, notNullableOverride:true); | ||
var typedNode = seriMan.WriteValue(typedValue); | ||
|
||
Assert.That(seriMan.ValidateNode<Enum>(genericNode).GetErrors().Any(), Is.False); | ||
Assert.That(seriMan.ValidateNode<TestEnum>(genericNode).GetErrors().Any(), Is.True); | ||
Assert.That(seriMan.ValidateNode<Enum>(typedNode).GetErrors().Any(), Is.True); | ||
Assert.That(seriMan.ValidateNode<TestEnum>(typedNode).GetErrors().Any(), Is.False); | ||
|
||
await pairTracker.CleanReturnAsync(); | ||
} | ||
|
||
private enum TestEnum : byte { Aa, Bb, Cc, Dd } | ||
|
||
[DataDefinition] | ||
private sealed class TestData | ||
{ | ||
[DataField("value")] public Enum Value = default!; | ||
[DataField("sequence")] public List<Enum> Sequence = default!; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.