add unit test and finish operator test
This commit is contained in:
1 parent
d31704951d
commit
ef55d94ae9
35 files changed
+509
-135
No files matched your search
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29418.71
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BallanceTASEditor", "BallanceTASEditor.csproj", "{3127A635-B9E5-4C78-8414-0B9B196EC25E}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BallanceTASEditor", "BallanceTASEditor\BallanceTASEditor.csproj", "{3127A635-B9E5-4C78-8414-0B9B196EC25E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BallanceTASEditorTests", "BallanceTASEditorTests\BallanceTASEditorTests.csproj", "{EC35111D-6259-4C69-B7E4-F4E727AC0E1A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -15,6 +17,10 @@ Global
|
||||
{3127A635-B9E5-4C78-8414-0B9B196EC25E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3127A635-B9E5-4C78-8414-0B9B196EC25E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3127A635-B9E5-4C78-8414-0B9B196EC25E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC35111D-6259-4C69-B7E4-F4E727AC0E1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EC35111D-6259-4C69-B7E4-F4E727AC0E1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EC35111D-6259-4C69-B7E4-F4E727AC0E1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC35111D-6259-4C69-B7E4-F4E727AC0E1A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -8,11 +8,12 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>BallanceTASEditor</RootNamespace>
|
||||
<AssemblyName>BallanceTASEditor</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -23,6 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -32,6 +34,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
@@ -49,7 +52,7 @@
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="zlib.net, Version=1.0.3.0, Culture=neutral, PublicKeyToken=47d7877cb3620160">
|
||||
<HintPath>packages\zlib.net.1.0.4.0\lib\zlib.net.dll</HintPath>
|
||||
<HintPath>..\packages\zlib.net.1.0.4.0\lib\zlib.net.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -116,6 +119,7 @@
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
File renamed without changes.
@@ -29,6 +29,7 @@ namespace BallanceTASEditor.Core.FileOperation {
|
||||
private bool? isSet;
|
||||
|
||||
private uint internalOffset;
|
||||
private List<uint> changedItems;
|
||||
|
||||
public SetOperation(SelectionRange _field, SelectionRange _absoluteRange, bool? _isSet) : base() {
|
||||
field = _field;
|
||||
@@ -40,13 +41,19 @@ namespace BallanceTASEditor.Core.FileOperation {
|
||||
for (int i = (int)field.start; i <= (int)field.end; i++) {
|
||||
internalOffset |= ConstValue.Mapping[(FrameDataField)i];
|
||||
}
|
||||
|
||||
changedItems = new List<uint>();
|
||||
}
|
||||
|
||||
public override void Do(ref LinkedList<FrameData> mMem, ref LinkedListNode<FrameData> mPointer, ref long mPointerIndex) {
|
||||
base.Do(ref mMem, ref mPointer, ref mPointerIndex);
|
||||
if (mPointer == null) return;
|
||||
|
||||
changedItems.Clear();
|
||||
foreach (var item in mMem.IterateWithSelectionRange(absoluteRange, mPointer, mPointerIndex)) {
|
||||
// backup item first
|
||||
changedItems.Add(item.Value.keystates);
|
||||
|
||||
if (isSet == null) item.Value.ReverseKeyStates(internalOffset);
|
||||
else if (isSet == true) item.Value.SetKeyStates(internalOffset);
|
||||
else if (isSet == false) item.Value.UnsetKeyStates(internalOffset);
|
||||
@@ -57,11 +64,11 @@ namespace BallanceTASEditor.Core.FileOperation {
|
||||
base.Undo(ref mMem, ref mPointer, ref mPointerIndex);
|
||||
if (mPointer == null) return;
|
||||
|
||||
int counter = 0;
|
||||
foreach (var item in mMem.IterateWithSelectionRange(absoluteRange, mPointer, mPointerIndex)) {
|
||||
// just like do operation, but switch set and unset operation
|
||||
if (isSet == null) item.Value.ReverseKeyStates(internalOffset);
|
||||
else if (isSet == true) item.Value.UnsetKeyStates(internalOffset);
|
||||
else if (isSet == false) item.Value.SetKeyStates(internalOffset);
|
||||
// restore data
|
||||
item.Value.keystates = changedItems[counter];
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,7 +100,7 @@ namespace BallanceTASEditor.Core.FileOperation {
|
||||
|
||||
// find proper pointer after remove first. but we do not apply it in there.
|
||||
// if state is true, it mean the deleted content is placed before pointer previously. we should consider pointer data and we should correct them.
|
||||
LinkedListNode <FrameData> newPointer;
|
||||
LinkedListNode<FrameData> newPointer;
|
||||
long newPointerIndex;
|
||||
if (mPointerIndex >= absoluteRange.start) {
|
||||
// if point within removed content, we need to shift it to the head of removed content,
|
||||
@@ -215,7 +222,8 @@ namespace BallanceTASEditor.Core.FileOperation {
|
||||
|
||||
// if the items are added before pointer, the index should add with the count of added items
|
||||
// but pointer don't need to be shifted.
|
||||
if (mPointerIndex > absolutePos)
|
||||
if ((isAddBefore && mPointerIndex >= absolutePos) ||
|
||||
(!isAddBefore && mPointerIndex > absolutePos))
|
||||
mPointerIndex += count;
|
||||
}
|
||||
}
|
||||
@@ -245,7 +253,7 @@ namespace BallanceTASEditor.Core.FileOperation {
|
||||
mPointerIndex = oldPointerIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class InsertOperation : RevocableOperation {
|
||||
private long absolutePos;
|
||||
private LinkedList<FrameData> data;
|
||||
@@ -253,32 +261,39 @@ namespace BallanceTASEditor.Core.FileOperation {
|
||||
private bool isOverwritten;
|
||||
|
||||
private LinkedListNode<FrameData> addStartNode;
|
||||
private LinkedList<FrameData> oldItems;
|
||||
private bool isBlankList;
|
||||
private LinkedListNode<FrameData> oldPointer;
|
||||
private long oldPointerIndex;
|
||||
|
||||
// because insert including remove oeration(overwritten mode)
|
||||
// so we need include this for code re-use
|
||||
private RemoveOperation internalRemoveOper;
|
||||
|
||||
private const long LINKEDLIST_HEAD = -1;
|
||||
private const long LINKEDLIST_TAIL = -2;
|
||||
|
||||
public InsertOperation(long _absolutePos, LinkedList<FrameData> _data, bool _isInsertBefore, bool _isOverwritten) : base() {
|
||||
absolutePos = _absolutePos;
|
||||
data = _data;
|
||||
isInsertBefore = _isInsertBefore;
|
||||
isOverwritten = _isOverwritten;
|
||||
|
||||
oldItems = new LinkedList<FrameData>();
|
||||
}
|
||||
|
||||
public override void Do(ref LinkedList<FrameData> mMem, ref LinkedListNode<FrameData> mPointer, ref long mPointerIndex) {
|
||||
base.Do(ref mMem, ref mPointer, ref mPointerIndex);
|
||||
if (data.Count == 0) return;
|
||||
|
||||
// init backups list and backups 2 data
|
||||
oldItems.Clear();
|
||||
oldPointer = mPointer;
|
||||
oldPointerIndex = mPointerIndex;
|
||||
// because this oper have internal oper, so we need backup data after potential remove oper
|
||||
// so in there, no object need to be backuped
|
||||
|
||||
// if the list is blank, overwritten is invalid, just normal add them.
|
||||
if (mPointer == null) {
|
||||
// backups start pointer
|
||||
// backups
|
||||
oldPointer = mPointer;
|
||||
oldPointerIndex = mPointerIndex;
|
||||
addStartNode = null;
|
||||
isBlankList = true;
|
||||
|
||||
foreach (var item in data.IterateFull()) {
|
||||
mMem.AddFirst(item.Value);
|
||||
@@ -287,6 +302,12 @@ namespace BallanceTASEditor.Core.FileOperation {
|
||||
mPointerIndex = 0;
|
||||
} else {
|
||||
LinkedListNode<FrameData> node = mMem.FastGetNode(mPointer, mPointerIndex, absolutePos);
|
||||
|
||||
// absolutePos is class member and shouldn't be changed.
|
||||
// but in overwritten mode, this value need to be changed so we create a temp value in there
|
||||
// to instead the fucntion of original variable
|
||||
var modifiedAbsolutePos = absolutePos;
|
||||
|
||||
// if list is not a blank list, we should consider overwritten
|
||||
// if in overwritten mode, we need to overwrite data from selected item.
|
||||
// otherwise, not in overwritten mode, just normally add them just like add operation.
|
||||
@@ -294,83 +315,80 @@ namespace BallanceTASEditor.Core.FileOperation {
|
||||
// in overwritten mode, if follwoing item is not enough to fufill the count of overwritten data
|
||||
// normally add them
|
||||
// we use delete and add method to do this
|
||||
// another protential dangerous spot is pointer can be overwritten, its dangerous,
|
||||
// so we need create a backup pos to store its relative postion and in add stage set pointer to the new data.
|
||||
|
||||
// now, try init internal remove oper if in overwritten mode
|
||||
// first, we need compare the length of remained item located in mMem and the length of added item
|
||||
// then construct remove oper
|
||||
long remainLength;
|
||||
if (isInsertBefore) remainLength = absolutePos + 1;
|
||||
else remainLength = mMem.Count - absolutePos;
|
||||
|
||||
long dataLength = data.Count;
|
||||
long expectedLength = dataLength > remainLength ? remainLength : dataLength;
|
||||
long expectedPos;
|
||||
if (isInsertBefore) expectedPos = absolutePos - expectedLength + 1;
|
||||
else expectedPos = absolutePos + expectedLength - 1;
|
||||
|
||||
if (isInsertBefore)
|
||||
internalRemoveOper = new RemoveOperation(new SelectionRange(expectedPos, absolutePos));
|
||||
else
|
||||
internalRemoveOper = new RemoveOperation(new SelectionRange(absolutePos, expectedPos));
|
||||
|
||||
var backupsNode = isInsertBefore ? node.Next : node.Previous;
|
||||
// backups start pointer
|
||||
addStartNode = backupsNode;
|
||||
|
||||
long gottenPointerPos = -1;
|
||||
for(long i = 0; i < data.Count; i++) {
|
||||
if (node == null) break;
|
||||
if (node == mPointer) gottenPointerPos = i;
|
||||
mMem.Remove(node);
|
||||
|
||||
// backup and shift to next
|
||||
if (isInsertBefore) {
|
||||
oldItems.AddFirst(node);
|
||||
node = node.Previous;
|
||||
} else {
|
||||
oldItems.AddLast(node);
|
||||
node = node.Next;
|
||||
}
|
||||
}
|
||||
|
||||
node = backupsNode;
|
||||
if (node == null) {
|
||||
foreach (var item in data.IterateFullReversed()) {
|
||||
// add from head
|
||||
mMem.AddFirst(item);
|
||||
}
|
||||
} else {
|
||||
long counter = 0;
|
||||
if (isInsertBefore) {
|
||||
foreach (var item in data.IterateFull()) {
|
||||
if (node == null) {
|
||||
// insert from tail instead
|
||||
mMem.AddLast(item.Value);
|
||||
} else {
|
||||
mMem.AddBefore(node, item.Value);
|
||||
}
|
||||
|
||||
if (counter == gottenPointerPos)
|
||||
mPointer = node.Previous;
|
||||
counter++;
|
||||
}
|
||||
} else {
|
||||
foreach (var item in data.IterateFullReversed()) {
|
||||
if (node == null) {
|
||||
// insert from head instead
|
||||
mMem.AddFirst(item.Value);
|
||||
} else {
|
||||
mMem.AddAfter(node, item.Value);
|
||||
}
|
||||
|
||||
if (counter == gottenPointerPos)
|
||||
mPointer = node.Next;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// backups start pointer
|
||||
addStartNode = node;
|
||||
node = isInsertBefore ? node.Next : node.Previous;
|
||||
internalRemoveOper.Do(ref mMem, ref mPointer, ref mPointerIndex);
|
||||
// now, we can treat it as normal insert(without overwritten)
|
||||
// but with one exception: absolutePos
|
||||
// we need re calc absolutePos bucause we have called remove oper
|
||||
|
||||
if (isInsertBefore) {
|
||||
foreach (var item in data.IterateFull()) {
|
||||
mMem.AddBefore(node, item.Value);
|
||||
}
|
||||
if (node == null)
|
||||
modifiedAbsolutePos = LINKEDLIST_TAIL;
|
||||
else
|
||||
modifiedAbsolutePos = absolutePos + 1 - expectedLength;
|
||||
} else {
|
||||
foreach (var item in data.IterateFullReversed()) {
|
||||
if (node == null)
|
||||
modifiedAbsolutePos = LINKEDLIST_HEAD;
|
||||
else
|
||||
modifiedAbsolutePos -= 1;
|
||||
}
|
||||
|
||||
}
|
||||
// backups
|
||||
oldPointer = mPointer;
|
||||
oldPointerIndex = mPointerIndex;
|
||||
addStartNode = node;
|
||||
isBlankList = false;
|
||||
|
||||
if (isInsertBefore) {
|
||||
foreach (var item in data.IterateFull()) {
|
||||
if (node == null)
|
||||
mMem.AddLast(item.Value);
|
||||
else
|
||||
mMem.AddBefore(node, item.Value);
|
||||
}
|
||||
} else {
|
||||
foreach (var item in data.IterateFullReversed()) {
|
||||
if (node == null)
|
||||
mMem.AddFirst(item.Value);
|
||||
else
|
||||
mMem.AddAfter(node, item.Value);
|
||||
}
|
||||
}
|
||||
if (mPointerIndex > absolutePos)
|
||||
mPointerIndex += data.Count;
|
||||
}
|
||||
|
||||
if (modifiedAbsolutePos != LINKEDLIST_TAIL && modifiedAbsolutePos != LINKEDLIST_HEAD) {
|
||||
if ((isInsertBefore && mPointerIndex >= modifiedAbsolutePos) ||
|
||||
(!isInsertBefore && mPointerIndex > modifiedAbsolutePos))
|
||||
mPointerIndex += data.Count;
|
||||
}
|
||||
else if (modifiedAbsolutePos == LINKEDLIST_HEAD)
|
||||
mPointerIndex += data.Count;
|
||||
|
||||
// remove have chance to remove entire list
|
||||
// so we need restore pointer in that situation
|
||||
if (mPointer == null) {
|
||||
mPointer = mMem.First;
|
||||
mPointerIndex = mPointer == null ? -1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,41 +396,41 @@ namespace BallanceTASEditor.Core.FileOperation {
|
||||
base.Undo(ref mMem, ref mPointer, ref mPointerIndex);
|
||||
if (data.Count == 0) return;
|
||||
|
||||
if (addStartNode == null) {
|
||||
if (isBlankList) {
|
||||
// original state is blank
|
||||
// just clear mmem is ok
|
||||
mMem.Clear();
|
||||
|
||||
// re-set pointer
|
||||
mPointer = oldPointer;
|
||||
mPointerIndex = oldPointerIndex;
|
||||
} else {
|
||||
// in overwrite or not in overwrite mode, we all need to remove inserted data first
|
||||
if (isInsertBefore) {
|
||||
for (long i = 0; i < data.Count; i++) {
|
||||
mMem.Remove(addStartNode.Previous);
|
||||
if (addStartNode == null)
|
||||
mMem.RemoveLast();
|
||||
else
|
||||
mMem.Remove(addStartNode.Previous);
|
||||
}
|
||||
} else {
|
||||
for (long i = 0; i < data.Count; i++) {
|
||||
mMem.Remove(addStartNode.Next);
|
||||
if (addStartNode == null)
|
||||
mMem.RemoveFirst();
|
||||
else
|
||||
mMem.Remove(addStartNode.Next);
|
||||
}
|
||||
}
|
||||
|
||||
// re-set pointer
|
||||
mPointer = oldPointer;
|
||||
mPointerIndex = oldPointerIndex;
|
||||
|
||||
// if we use overwrite mode, we need re-add lost data
|
||||
if (isOverwritten) {
|
||||
if (isInsertBefore) {
|
||||
foreach (var item in oldItems.IterateFull()) {
|
||||
oldItems.Remove(item);
|
||||
mMem.AddBefore(addStartNode, item);
|
||||
}
|
||||
} else {
|
||||
foreach (var item in oldItems.IterateFullReversed()) {
|
||||
oldItems.Remove(item);
|
||||
mMem.AddAfter(addStartNode, item);
|
||||
}
|
||||
}
|
||||
internalRemoveOper.Undo(ref mMem, ref mPointer, ref mPointerIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// re-set pointer
|
||||
mPointer = oldPointer;
|
||||
mPointerIndex = oldPointerIndex;
|
||||
}
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -18,7 +18,7 @@ namespace BallanceTASEditor.Core {
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
mPointer = mMem.First;
|
||||
mPointerIndex = 0;
|
||||
mPointerIndex = mPointer == null ? -1 : 0;
|
||||
|
||||
mRedoStack = new LimitedStack<RevocableOperation>();
|
||||
mUndoStack = new LimitedStack<RevocableOperation>();
|
||||
@@ -52,7 +52,7 @@ namespace BallanceTASEditor.Core {
|
||||
public void Get(List<FrameDataDisplay> container, int count) {
|
||||
// no item. clean container
|
||||
if (mPointer == null) {
|
||||
for(int j = 0; j < count; j++) {
|
||||
for (int j = 0; j < count; j++) {
|
||||
container[j].isEnable = false;
|
||||
}
|
||||
return;
|
||||
@@ -62,12 +62,12 @@ namespace BallanceTASEditor.Core {
|
||||
var cachePointer = mPointer;
|
||||
var startIndex = mPointerIndex;
|
||||
int i;
|
||||
for(i = 0; i < count && cachePointer != null; i++, startIndex++) {
|
||||
for (i = 0; i < count && cachePointer != null; i++, startIndex++) {
|
||||
container[i].Reload(startIndex, cachePointer.Value);
|
||||
container[i].isEnable = true;
|
||||
cachePointer = cachePointer.Next;
|
||||
}
|
||||
for(; i < count; i++) {
|
||||
for (; i < count; i++) {
|
||||
container[i].isEnable = false;
|
||||
}
|
||||
}
|
||||
@@ -222,5 +222,34 @@ namespace BallanceTASEditor.Core {
|
||||
mFilename = newfile;
|
||||
Save();
|
||||
}
|
||||
|
||||
|
||||
#if DEBUG
|
||||
// following code only should be used in debug mode and served for testbench
|
||||
public TASFile(LinkedList<FrameData> items) {
|
||||
mFilename = "";
|
||||
mMem = items;
|
||||
mPointer = mMem.First;
|
||||
mPointerIndex = mPointer == null ? -1 : 0;
|
||||
|
||||
mRedoStack = new LimitedStack<RevocableOperation>();
|
||||
mUndoStack = new LimitedStack<RevocableOperation>();
|
||||
}
|
||||
|
||||
public string Output2TestString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (mPointer == null) sb.Append("null;");
|
||||
else sb.Append($"{mPointer.Value.keystates.ToString()};");
|
||||
sb.Append($"{mPointerIndex};");
|
||||
|
||||
foreach (var item in mMem.IterateFull()) {
|
||||
sb.Append(item.Value.keystates.ToString());
|
||||
sb.Append(",");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -149,7 +149,7 @@ namespace BallanceTASEditor.Core {
|
||||
return (num >= start && num <= end);
|
||||
}
|
||||
public long GetCount() {
|
||||
return end - start;
|
||||
return end - start + 1;
|
||||
}
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+18
-17
@@ -1,53 +1,54 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.42000
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace BallanceTASEditor.Properties {
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 强类型资源类,用于查找本地化字符串等。
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if ((resourceMan == null)) {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BallanceTASEditor.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 覆盖当前线程的 CurrentUICulture 属性
|
||||
/// 使用此强类型的资源类的资源查找。
|
||||
/// 重写当前线程的 CurrentUICulture 属性
|
||||
/// 重写当前线程的 CurrentUICulture 属性。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
File renamed without changes.
+9
-9
@@ -1,22 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace BallanceTASEditor.Properties {
|
||||
|
||||
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
||||
File renamed without changes.
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.2.5\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.5\build\net45\MSTest.TestAdapter.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{EC35111D-6259-4C69-B7E4-F4E727AC0E1A}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>BallanceTASEditorTests</RootNamespace>
|
||||
<AssemblyName>BallanceTASEditorTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.5\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.5\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise />
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="Core\TASFileTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BallanceTASEditor\BallanceTASEditor.csproj">
|
||||
<Project>{3127A635-B9E5-4C78-8414-0B9B196EC25E}</Project>
|
||||
<Name>BallanceTASEditor</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.5\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.5\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.5\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.5\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.2.5\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.5\build\net45\MSTest.TestAdapter.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,164 @@
|
||||
using BallanceTASEditor.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BallanceTASEditor.Core.TASStruct;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace BallanceTASEditor.Core.Tests {
|
||||
[TestClass()]
|
||||
public class TASFileTests {
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow("1,2,3,4,5", 0, "15;0;15,15,15,4,5,", FrameDataField.Key_Up, FrameDataField.Key_Right, 0, 2, true)]
|
||||
[DataRow("1,2,3,4,5", 0, "0;0;0,0,0,4,5,", FrameDataField.Key_Up, FrameDataField.Key_Right, 0, 2, false)]
|
||||
[DataRow("1,2,3,4,5", 0, "14;0;14,13,12,4,5,", FrameDataField.Key_Up, FrameDataField.Key_Right, 0, 2, null)]
|
||||
public void SetTest(string originStr, long prevShift, string expectedStr, FrameDataField field_start, FrameDataField field_end, long absoluteRange_start, long absoluteRange_end, bool? isSet) {
|
||||
var test = new TASFile(dataGenerator(originStr));
|
||||
test.Shift(prevShift);
|
||||
var originalText = test.Output2TestString();
|
||||
|
||||
// test function
|
||||
test.Set(new SelectionRange((long)field_start, (long)field_end), new SelectionRange(absoluteRange_start, absoluteRange_end), isSet);
|
||||
var changedText = test.Output2TestString();
|
||||
Assert.AreEqual(expectedStr, changedText);
|
||||
|
||||
// test undo
|
||||
test.Undo();
|
||||
Assert.AreEqual(originalText, test.Output2TestString());
|
||||
|
||||
// test redo
|
||||
test.Redo();
|
||||
Assert.AreEqual(changedText, test.Output2TestString());
|
||||
|
||||
// test undo
|
||||
test.Undo();
|
||||
Assert.AreEqual(originalText, test.Output2TestString());
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow("1,2,3,4,5", 0, "3;0;3,4,5,", 0, 1)]
|
||||
[DataRow("1,2,3,4,5", 0, "null;-1;", 0, 4)]
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,3,", 3, 4)]
|
||||
[DataRow("1,2,3,4,5", 0, "2;0;2,3,4,5,", 0, 0)]
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,3,4,", 4, 4)]
|
||||
[DataRow("1,2,3,4,5", 2, "1;0;1,5,", 1, 3)]
|
||||
[DataRow("1,2,3,4,5", 2, "5;0;5,", 0, 3)]
|
||||
[DataRow("1,2,3,4,5", 2, "1;0;1,", 1, 4)]
|
||||
[DataRow("1,2,3,4,5", 3, "4;0;4,5,", 0, 2)]
|
||||
[DataRow("1,2,3,4,5", 4, "5;1;4,5,", 0, 2)]
|
||||
public void RemoveTest(string originStr, long prevShift, string expectedStr, long absoluteRange_start, long absoluteRange_end) {
|
||||
var test = new TASFile(dataGenerator(originStr));
|
||||
test.Shift(prevShift);
|
||||
var originalText = test.Output2TestString();
|
||||
|
||||
// test function
|
||||
test.Remove(new SelectionRange(absoluteRange_start, absoluteRange_end));
|
||||
var changedText = test.Output2TestString();
|
||||
Assert.AreEqual(expectedStr, changedText);
|
||||
|
||||
// test undo
|
||||
test.Undo();
|
||||
Assert.AreEqual(originalText, test.Output2TestString());
|
||||
|
||||
// test redo
|
||||
test.Redo();
|
||||
Assert.AreEqual(changedText, test.Output2TestString());
|
||||
|
||||
// test undo
|
||||
test.Undo();
|
||||
Assert.AreEqual(originalText, test.Output2TestString());
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,0,0,0,3,4,5,", 2, 3, 240 / 1f, true)]
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,3,0,0,0,4,5,", 2, 3, 240 / 1f, false)]
|
||||
[DataRow("1,2,3,4,5", 2, "3;5;1,2,0,0,0,3,4,5,", 2, 3, 240 / 1f, true)]
|
||||
[DataRow("1,2,3,4,5", 2, "3;2;1,2,3,0,0,0,4,5,", 2, 3, 240 / 1f, false)]
|
||||
|
||||
[DataRow("1,2,3,4,5", 0, "1;3;0,0,0,1,2,3,4,5,", 0, 3, 240 / 1f, true)]
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,3,4,5,0,0,0,", 4, 3, 240 / 1f, false)]
|
||||
public void AddTest(string originStr, long prevShift, string expectedStr, long absolutePos, long count, float deltaTime, bool isAddBefore) {
|
||||
var test = new TASFile(dataGenerator(originStr));
|
||||
test.Shift(prevShift);
|
||||
var originalText = test.Output2TestString();
|
||||
|
||||
// test function
|
||||
test.Add(absolutePos, count, deltaTime, isAddBefore);
|
||||
var changedText = test.Output2TestString();
|
||||
Assert.AreEqual(expectedStr, changedText);
|
||||
|
||||
// test undo
|
||||
test.Undo();
|
||||
Assert.AreEqual(originalText, test.Output2TestString());
|
||||
|
||||
// test redo
|
||||
test.Redo();
|
||||
Assert.AreEqual(changedText, test.Output2TestString());
|
||||
|
||||
// test undo
|
||||
test.Undo();
|
||||
Assert.AreEqual(originalText, test.Output2TestString());
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow("1,2,3,4,5", 0, "6;0;6,7,8,9,10,", 0, "6,7,8,9,10", false, true)]
|
||||
[DataRow("1,2,3,4,5", 0, "6;0;6,7,8,9,10,", 4, "6,7,8,9,10", true, true)]
|
||||
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,6,7,8,3,4,5,", 2, "6,7,8", true, false)]
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,3,6,7,8,4,5,", 2, "6,7,8", false, false)]
|
||||
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,3,4,5,6,7,", 4, "6,7", false, false)]
|
||||
[DataRow("1,2,3,4,5", 0, "1;2;6,7,1,2,3,4,5,", 0, "6,7", true, false)]
|
||||
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,6,7,4,5,", 2, "6,7", true, true)]
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,6,7,5,", 2, "6,7", false, true)]
|
||||
[DataRow("1,2,3,4,5", 0, "4;3;6,7,8,4,5,", 2, "6,7,8", true, true)]
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,6,7,8,", 2, "6,7,8", false, true)]
|
||||
[DataRow("1,2,3,4,5", 0, "4;4;6,7,8,9,4,5,", 2, "6,7,8,9", true, true)]
|
||||
[DataRow("1,2,3,4,5", 0, "1;0;1,2,6,7,8,9,", 2, "6,7,8,9", false, true)]
|
||||
|
||||
[DataRow("1,2,3,4,5", 2, "1;0;1,6,7,4,5,", 2, "6,7", true, true)]
|
||||
[DataRow("1,2,3,4,5", 2, "2;1;1,2,6,7,5,", 2, "6,7", false, true)]
|
||||
[DataRow("1,2,3,4,5", 2, "4;3;6,7,8,4,5,", 2, "6,7,8", true, true)]
|
||||
[DataRow("1,2,3,4,5", 2, "2;1;1,2,6,7,8,", 2, "6,7,8", false, true)]
|
||||
[DataRow("1,2,3,4,5", 2, "4;4;6,7,8,9,4,5,", 2, "6,7,8,9", true, true)]
|
||||
[DataRow("1,2,3,4,5", 2, "2;1;1,2,6,7,8,9,", 2, "6,7,8,9", false, true)]
|
||||
|
||||
[DataRow("1,2,3,4,5", 2, "3;5;1,2,6,7,8,3,4,5,", 2, "6,7,8", true, false)]
|
||||
[DataRow("1,2,3,4,5", 2, "3;2;1,2,3,6,7,8,4,5,", 2, "6,7,8", false, false)]
|
||||
public void InsertTest(string originStr, long prevShift, string expectedStr, long absolutePos, string insertedData, bool isInsertBefore, bool isOverwritten) {
|
||||
var test = new TASFile(dataGenerator(originStr));
|
||||
test.Shift(prevShift);
|
||||
var originalText = test.Output2TestString();
|
||||
|
||||
// test function
|
||||
test.Insert(absolutePos, dataGenerator(insertedData), isInsertBefore, isOverwritten);
|
||||
var changedText = test.Output2TestString();
|
||||
Assert.AreEqual(expectedStr, changedText);
|
||||
|
||||
// test undo
|
||||
test.Undo();
|
||||
Assert.AreEqual(originalText, test.Output2TestString());
|
||||
|
||||
// test redo
|
||||
test.Redo();
|
||||
Assert.AreEqual(changedText, test.Output2TestString());
|
||||
|
||||
// test undo
|
||||
test.Undo();
|
||||
Assert.AreEqual(originalText, test.Output2TestString());
|
||||
}
|
||||
|
||||
// example input: 1,2,3,4,5
|
||||
private LinkedList<FrameData> dataGenerator(string inputData) {
|
||||
var ls = new LinkedList<FrameData>();
|
||||
foreach (var item in inputData.Split(',')) {
|
||||
ls.AddLast(new FrameData(float.Parse(item), uint.Parse(item)));
|
||||
}
|
||||
return ls;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("BallanceTASEditorTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("BallanceTASEditorTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//将 ComVisible 设置为 false 将使此程序集中的类型
|
||||
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("ec35111d-6259-4c69-b7e4-f4e727ac0e1a")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="2.2.5" targetFramework="net45" />
|
||||
<package id="MSTest.TestFramework" version="2.2.5" targetFramework="net45" />
|
||||
</packages>
|
||||
Reference in new issue
Block a user