首次提交:本地项目同步到Gitea

This commit is contained in:
zhusenlin
2026-01-24 08:45:54 +08:00
commit 4a6b23db69
256 changed files with 25311 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Io.Github.Kerwinxu.LibShapes.Core.Command;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Io.Github.Kerwinxu.LibShapes.Core.Command.Tests
{
[TestClass()]
public class CommandRecorderTests
{
[TestMethod()]
public void UndoTest()
{
//// 这个是测试一下是否可以有undo和redo
//// 1. 先有画布
//UserControlCanvas canvas = new UserControlCanvas();
//// 2. 然后新建一个线段
//Shape.ShapeLine line = new Shape.ShapeLine() {
// X=10,
// Y=20,
// Width=30,
// Height=40
//};
////手动添加进去
//canvas.addShape(line);
//// 需要手动建立这个新建命令
//// todo
////canvas.commandRecorder.addCommand(
//// new Command.CommandCreate() {
//// canvas = canvas,
//// NewShape=line
//// });
//// 3. 添加一个矩形
//Shape.ShapeRectangle rect = new Shape.ShapeRectangle()
//{
// X = 50,
// Y = 60,
// Width = 70,
// Height = 80
//};
////手动添加进去
//canvas.addShape(rect);
//// 需要手动建立这个新建命令
//canvas.commandRecorder.addCommand(
// new Command.CommandCreate()
// {
// canvas = canvas,
// NewShape = rect
// });
//// 4. 删除最后一个
//canvas.changeSelect(rect);
//canvas.deleteShapes();
//// 5. 判断有几个形状
//Assert.AreEqual(1, canvas.shapes.lstShapes.Count);
//// 6. 然后执行undo
//canvas.commandRecorder.Undo();
//// 7. 判断有几个形状
//Assert.AreEqual(2, canvas.shapes.lstShapes.Count);
//// 8. 执行redo
//canvas.commandRecorder.Redo();
//// 9. 判断有几个形状
//Assert.AreEqual(1, canvas.shapes.lstShapes.Count);
}
}
}

View File

@@ -0,0 +1,29 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Io.Github.Kerwinxu.LibShapes.Core.Shape;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Io.Github.Kerwinxu.LibShapes.Core.Shape.Tests
{
[TestClass()]
public class ShapeEleTests
{
[TestMethod()]
public void DeepCloneTest()
{
// 这里用一个线段来测试一下
var line1 = new ShapeLine();
line1.X = 10;
line1.Y = 20;
line1.Width = 30;
line1.Height = 40;
var line1_2 = line1.DeepClone();
Assert.AreEqual<ShapeLine>(line1, (ShapeLine)line1_2);
//Assert.Fail();
}
}
}

View File

@@ -0,0 +1,27 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Io.Github.Kerwinxu.LibShapes.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Io.Github.Kerwinxu.LibShapes.Core.Serialize;
namespace Io.Github.Kerwinxu.LibShapes.Core.Tests
{
[TestClass()]
public class ShapesTests
{
[TestMethod()]
public void DeepCloneTest()
{
// 先测试一个空白的Shape
Shapes shapes = new Shapes();
JsonSerialize jsonSerialize = new JsonSerialize();
string json = jsonSerialize.SerializeObject(shapes);
var shapes2 = jsonSerialize.DeserializeObject<Shapes>(json);
Assert.AreNotEqual(shapes2, null);
//Assert.Fail();
}
}
}

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2A458D82-324D-40C5-9398-1F1EC605DD9E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LibShapesTests</RootNamespace>
<AssemblyName>LibShapesTests</AssemblyName>
<TargetFrameworkVersion>v4.8</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 />
</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>
</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>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Windows.Forms" />
</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>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="Core\Command\CommandRecorderTests.cs" />
<Compile Include="Core\ShapesTests.cs" />
<Compile Include="Core\Shape\ShapeEleTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LibShapes\LibShapes.csproj">
<Project>{EE859868-A204-44E8-85B3-B080AE587C38}</Project>
<Name>LibShapes</Name>
</ProjectReference>
</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" />
<!-- 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>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LibShapesTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hewlett-Packard")]
[assembly: AssemblyProduct("LibShapesTests")]
[assembly: AssemblyCopyright("Copyright © Hewlett-Packard 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2a458d82-324d-40c5-9398-1f1ec605dd9e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]