Skip to content

Commit

Permalink
Bump HaruhiChokuretsuLib version, add BackgroundItem test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonko0493 committed Jan 31, 2023
1 parent f62bac4 commit da9359e
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/SerialLoops.Lib/Items/BackgroundItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public SKBitmap GetBackground()

return bitmap;
}
else if (BackgroundType == BgType.KINETIC_VECTOR)
else if (BackgroundType == BgType.KINETIC_SCREEN)
{
return Graphic2.GetScreenImage(Graphic1);
}
Expand Down
2 changes: 1 addition & 1 deletion src/SerialLoops.Lib/SerialLoops.Lib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HaruhiChokuretsuLib" Version="0.10.0" />
<PackageReference Include="HaruhiChokuretsuLib" Version="0.11.0" />
<PackageReference Include="NitroPacker.Core" Version="2.0.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/SerialLoops/Editors/BackgroundEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override Panel GetEditorPanel()
Orientation = Orientation.Vertical,
Items =
{
new ImageView() { Image = new SKImage(((BackgroundItem)Description).GetBackground()) },
new ImageView() { Image = new SKGuiImage(((BackgroundItem)Description).GetBackground()) },
}
};
}
Expand Down
14 changes: 14 additions & 0 deletions src/SerialLoops/SKGuiImage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Eto.Drawing;
using SkiaSharp;

namespace SerialLoops
{
public class SKGuiImage : Bitmap
{
public SKBitmap skBitmap { get; set; }

public SKGuiImage(SKBitmap skBitmap) : base(skBitmap.Encode(SKEncodedImageFormat.Png, 1).AsStream())
{
}
}
}
15 changes: 0 additions & 15 deletions src/SerialLoops/SKImage.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/SerialLoops/SerialLoops.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HaruhiChokuretsuLib" Version="0.10.0" />
<PackageReference Include="System.Text.Json" Version="7.0.1" />
</ItemGroup>

Expand Down
14 changes: 14 additions & 0 deletions test/SerialLoops.Tests/ItemTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using HaruhiChokuretsuLib.Archive.Data;
using HaruhiChokuretsuLib.Archive.Event;
using HaruhiChokuretsuLib.Archive.Graphics;
using HaruhiChokuretsuLib.Util;
using NUnit.Framework;
using SerialLoops.Lib.Items;
Expand Down Expand Up @@ -37,5 +38,18 @@ public void EventItemCreationTest(string evtFile)

Assert.That(evt.Name[0..^1], Is.EqualTo(eventItem.Name));
}

[Test]
public void BackgroundItemCreationTest()
{
GraphicsFile grp1 = new();
GraphicsFile grp2 = new();
grp1.Name = "KBG00_128DNX";
grp2.Name = "KBG00BNS";
grp1.Initialize(File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "inputs", "graphics", "KBG00_128.bin")), 0, _log);
grp2.Initialize(File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "inputs", "graphics", "KBG00.bin")), 0, _log);
BackgroundItem item = new($"BG_{grp2.Name}") { Graphic1 = grp1, Graphic2 = grp2, BackgroundType = BgType.KINETIC_SCREEN };
item.GetBackground();
}
}
}
4 changes: 0 additions & 4 deletions test/SerialLoops.Tests/SerialLoops.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="inputs\graphics\" />
</ItemGroup>

</Project>
Binary file added test/SerialLoops.Tests/inputs/graphics/KBG00.bin
Binary file not shown.
Binary file not shown.

0 comments on commit da9359e

Please sign in to comment.