Skip to content

Commit

Permalink
Merge branch 'fix/1'
Browse files Browse the repository at this point in the history
  • Loading branch information
paralleltree committed Jun 5, 2016
2 parents f9bb915 + 3f512f9 commit caaf1a1
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Now available on [NuGet](https://www.nuget.org/packages/Scallion)
Execute the following command in the Package Manager Console:

```
PM> Install-Package Scallion -Pre
PM> Install-Package Scallion
```

Or download an archive from [Releases](https://github.com/paralleltree/Scallion/releases).
Expand Down
2 changes: 1 addition & 1 deletion Scallion.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
[assembly: ComVisible(false)]
[assembly: Guid("2b69216b-f367-46a9-8d9b-56b16771019c")]

[assembly: AssemblyVersion("0.9.0.1")]
[assembly: AssemblyVersion("0.9.1.0")]
1 change: 1 addition & 0 deletions Scallion.Tests/Scallion.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Internal\HelperExtensions.cs" />
<Compile Include="UnitTests\Core\MoSerializerTest.cs" />
<Compile Include="UnitTests\DomainModels\MotionTest.cs" />
<Compile Include="UnitTests\IOTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
36 changes: 36 additions & 0 deletions Scallion.Tests/UnitTests/Core/MoSerializerTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;

using NUnit.Framework;
using Scallion.DomainModels;
using Scallion.DomainModels.Components;

namespace Scallion.Tests.UnitTests.Core
{
[TestFixture]
internal class MoSerializerTest
{
[Test]
public void WriteLongStringTest()
{
Assert.DoesNotThrow(() =>
{
var m = new Motion()
{
ModelName = "テストモデル"
};
// Add a bone whose name length is longer than the maximum.
m.Bones.Add(new Bone()
{
Name = "テストモデルのテストボーン",
KeyFrames = new List<BoneKeyFrame>() { new BoneKeyFrame() }
});
// Then, try to save it.
m.Save("out.vmd");
}, "An error occurred while saving a Motion.");
}
}
}
3 changes: 2 additions & 1 deletion Scallion/Core/MoSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public void WriteByte(byte value)
public void WriteByteString(string value, int bytesCount)
{
var data = new byte[bytesCount];
FileEncoding.GetBytes(value).CopyTo(data, 0);
var arr = FileEncoding.GetBytes(value);
Array.Copy(arr, data, Math.Min(bytesCount, arr.Length));
_stream.Write(data);
}

Expand Down
5 changes: 5 additions & 0 deletions Scallion/DomainModels/Motion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public IEnumerable<IKBone> IKBones
/// </summary>
public Motion()
{
Bones = new List<Bone>();
Morphs = new List<Morph>();
Camera = new Camera();
Light = new Light();
SelfShadow = new SelfShadow();
VisibilityKeyFrames = new List<VisibilityKeyFrame>();
}

Expand Down
4 changes: 2 additions & 2 deletions Scallion/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
[assembly: ComVisible(false)]
[assembly: Guid("3934e015-89f5-4214-80df-71b57f62c2cd")]

[assembly: AssemblyVersion("0.9.0.1")]
[assembly: AssemblyInformationalVersion("0.9.0")]
[assembly: AssemblyVersion("0.9.1.0")]
[assembly: AssemblyInformationalVersion("0.9.1")]

// Exposes internal components to the testing project.
[assembly: InternalsVisibleTo("Scallion.Tests")]

0 comments on commit caaf1a1

Please sign in to comment.