-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split graphics in 2 libraries a core and a full one (#121)
- Loading branch information
Showing
158 changed files
with
5,695 additions
and
3,578 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
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
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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// Copyright (c) .NET Foundation and Contributors | ||
// Portions Copyright (c) Microsoft Corporation. All rights reserved. | ||
// See LICENSE file in the project root for full license information. | ||
|
||
using nanoFramework.TestFramework; | ||
using System.Drawing; | ||
|
||
namespace nanoFramework.UI | ||
{ | ||
[TestClass] | ||
public class ColorTests | ||
{ | ||
[TestMethod] | ||
public void ColorTestBasicSerialization() | ||
{ | ||
// Arrange | ||
var col = Color.Red; | ||
|
||
// Act | ||
var col2 = Color.FromHex(col.ToString()); | ||
|
||
// Assert | ||
Assert.AreEqual(col, col2); | ||
} | ||
|
||
[TestMethod] | ||
public void ColorTestColorSerialization() | ||
{ | ||
// Arrange | ||
var col = "Red"; | ||
|
||
// Act | ||
var col2 = Color.FromName(col); | ||
|
||
// Assert | ||
Assert.IsNotNull(col2); | ||
Assert.AreEqual(Color.Red, col2); | ||
} | ||
|
||
[TestMethod] | ||
public void ColorTestColorCaseSerialization() | ||
{ | ||
// Arrange | ||
var col = "rEd"; | ||
|
||
// Act | ||
var col2 = Color.FromName(col); | ||
|
||
// Assert | ||
Assert.IsNotNull(col2); | ||
Assert.AreEqual(Color.Red, col2); | ||
} | ||
|
||
[TestMethod] | ||
public void ColorEqualTest() | ||
{ | ||
// Arrange | ||
var col1 = Color.Red; | ||
var col2 = Color.Red; | ||
|
||
Assert.AreEqual(col1, col2); | ||
Assert.IsTrue(col1 == col2); | ||
} | ||
|
||
[DataRow(new object[] { (byte)0b0000_0111, (byte)0b0000_0011, (byte)0b0000_0111, (ushort)0x0000 })] | ||
[DataRow(new object[] { (byte)0b0000_1111, (byte)0b0000_0111, (byte)0b0000_1111, (ushort)0b0000_1000_0010_0001 })] | ||
[DataRow(new object[] { (byte)0b0000_1111, (byte)0b0000_0111, (byte)0b1000_1111, (ushort)0b0000_1000_0011_0001 })] | ||
[DataRow(new object[] { (byte)0b0000_1111, (byte)0b1000_0111, (byte)0b1000_1111, (ushort)0b0000_1100_0011_0001 })] | ||
[DataRow(new object[] { (byte)0b1000_1111, (byte)0b1000_0111, (byte)0b1000_1111, (ushort)0b1000_1100_0011_0001 })] | ||
public void TestBgr565(byte b, byte g, byte r, ushort correctResult) | ||
{ | ||
// Arrange | ||
var col = Color.FromArgb(255, r, g, b); | ||
|
||
// Act | ||
var result = col.ToBgr565(); | ||
|
||
// Assert | ||
Assert.AreEqual(correctResult, result); | ||
} | ||
|
||
[DataRow(new object[] { (byte)0b0000_0111, (byte)0b0000_0011, (byte)0b0000_0111, (byte)ColorOrder.Rgb, (byte)8, (byte)8, (byte)8, (uint)0b0000_0111_0000_0011_0000_0111 })] | ||
[DataRow(new object[] { (byte)0b0000_0111, (byte)0b0000_0011, (byte)0b0000_0111, (byte)ColorOrder.Rgb, (byte)5, (byte)6, (byte)5, (uint)0b0000_0000_0000_0000_0000_0000 })] | ||
[DataRow(new object[] { (byte)0b0000_1111, (byte)0b0000_0111, (byte)0b0000_1111, (byte)ColorOrder.Rgb, (byte)5, (byte)6, (byte)5, (uint)0b0000_0000_0000_1000_0010_0001 })] | ||
[DataRow(new object[] { (byte)0b0000_1111, (byte)0b0000_0111, (byte)0b0000_1111, (byte)ColorOrder.Rgb, (byte)8, (byte)6, (byte)5, (uint)0b0000_0000_0111_1000_0010_0001 })] | ||
[DataRow(new object[] { (byte)0b0000_1111, (byte)0b0000_0111, (byte)0b0000_1111, (byte)ColorOrder.Rbg, (byte)8, (byte)6, (byte)5, (uint)0b0000_0000_0111_1000_0100_0001 })] | ||
public void TestRgbFormat(byte r, byte g, byte b, byte order, byte numR, byte numG, byte numB, uint correctResult) | ||
{ | ||
// Arrange | ||
var col = Color.FromArgb(0, r, g, b); | ||
|
||
// Act | ||
var result = col.ToRgbFormat((ColorOrder)order, numR, numG, numB); | ||
|
||
// Assert | ||
Assert.AreEqual(correctResult, result); | ||
} | ||
} | ||
} |
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,55 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup Label="Globals"> | ||
<NanoFrameworkProjectSystemPath>$(MSBuildExtensionsPath)\nanoFramework\v1.0\</NanoFrameworkProjectSystemPath> | ||
</PropertyGroup> | ||
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props')" /> | ||
<ItemGroup> | ||
<ProjectCapability Include="TestContainer" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectTypeGuids>{11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<ProjectGuid>cc585116-52d9-4fa0-bf8d-6f8e1c9894ff</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<FileAlignment>512</FileAlignment> | ||
<RootNamespace>ColorTests</RootNamespace> | ||
<AssemblyName>NFUnitTest</AssemblyName> | ||
<IsCodedUITest>False</IsCodedUITest> | ||
<IsTestProject>true</IsTestProject> | ||
<TestProjectType>UnitTest</TestProjectType> | ||
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion> | ||
</PropertyGroup> | ||
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" /> | ||
<PropertyGroup> | ||
<RunSettingsFilePath>$(MSBuildProjectDirectory)\nano.runsettings</RunSettingsFilePath> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="ColorTests.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="mscorlib"> | ||
<HintPath>..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll</HintPath> | ||
</Reference> | ||
<Reference Include="nanoFramework.TestFramework"> | ||
<HintPath>..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.TestFramework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="nanoFramework.UnitTestLauncher"> | ||
<HintPath>..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.UnitTestLauncher.exe</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="nano.runsettings" /> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\nanoFramework.Graphics.Core\nanoFramework.Graphics.Core.nfproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="packages.lock.json" /> | ||
</ItemGroup> | ||
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" /> | ||
</Project> |
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,16 @@ | ||
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("nanoFramework.Graphics.Core.Tests")] | ||
[assembly: AssemblyCompany("nanoFramework Contributors")] | ||
[assembly: AssemblyProduct("nanoFramework.Graphics.Tests")] | ||
[assembly: AssemblyCopyright("Copyright © nanoFramework Contributors 2020")] | ||
|
||
// 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)] |
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,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RunSettings> | ||
<!-- Configurations that affect the Test Framework --> | ||
<RunConfiguration> | ||
<ResultsDirectory>.\TestResults</ResultsDirectory><!-- Path relative to solution directory --> | ||
<TestSessionTimeout>120000</TestSessionTimeout><!-- Milliseconds --> | ||
<TargetFrameworkVersion>net48</TargetFrameworkVersion> | ||
<TargetPlatform>x64</TargetPlatform> | ||
</RunConfiguration> | ||
<nanoFrameworkAdapter> | ||
<Logging>None</Logging> <!--Set to the desired level of logging for Unit Test execution. Possible values are: None, Detailed, Verbose, Error. --> | ||
<IsRealHardware>False</IsRealHardware><!--Set to true to run tests on real hardware. --> | ||
</nanoFrameworkAdapter> | ||
</RunSettings> |
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,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="nanoFramework.CoreLibrary" version="1.14.2" targetFramework="netnano1.0" /> | ||
<package id="nanoFramework.TestFramework" version="2.1.71" targetFramework="netnano1.0" developmentDependency="true" /> | ||
</packages> |
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,19 @@ | ||
{ | ||
"version": 1, | ||
"dependencies": { | ||
".NETnanoFramework,Version=v1.0": { | ||
"nanoFramework.CoreLibrary": { | ||
"type": "Direct", | ||
"requested": "[1.14.2, 1.14.2]", | ||
"resolved": "1.14.2", | ||
"contentHash": "j1mrz4mitl5LItvmHMsw1aHzCAfvTTgIkRxA0mhs5mSpctJ/BBcuNwua5j3MspfRNKreCQPy/qZy/D9ADLL/PA==" | ||
}, | ||
"nanoFramework.TestFramework": { | ||
"type": "Direct", | ||
"requested": "[2.1.71, 2.1.71]", | ||
"resolved": "2.1.71", | ||
"contentHash": "V2SYltqAwkw2ZSAZlyG515qIt2T3PL7v8UMF0GrknmTleA0HJ1qNHDXw4ymaV+RVrMexP9c27UuzQZBAKFxo9Q==" | ||
} | ||
} | ||
} | ||
} |
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,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> | ||
<metadata> | ||
<id>nanoFramework.Graphics.Core</id> | ||
<version>$version$</version> | ||
<title>nanoFramework.Graphics.Core</title> | ||
<authors>nanoframework</authors> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<license type="file">LICENSE.md</license> | ||
<releaseNotes> | ||
</releaseNotes> | ||
<developmentDependency>false</developmentDependency> | ||
<readme>docs\README.md</readme> | ||
<projectUrl>https://github.com/nanoframework/nanoFramework.Graphics.Core</projectUrl> | ||
<icon>images\nf-logo.png</icon> | ||
<repository type="git" url="https://github.com/nanoframework/nanoFramework.Graphics.Core" commit="$commit$" /> | ||
<copyright>Copyright (c) .NET Foundation and Contributors</copyright> | ||
<description>This package includes the nanoFramework.Graphics.Core assembly for .NET nanoFramework C# projects.</description> | ||
<tags>nanoFramework C# csharp netmf netnf nanoFramework.Graphics.Core</tags> | ||
<dependencies> | ||
<dependency id="nanoFramework.CoreLibrary" version="1.14.2" /> | ||
</dependencies> | ||
</metadata> | ||
<files> | ||
<file src="nanoFramework.Graphics.Core\bin\Release\nanoFramework.Graphics.Core.dll" target="lib\nanoFramework.Graphics.Core.dll" /> | ||
<file src="nanoFramework.Graphics.Core\bin\Release\nanoFramework.Graphics.Core.pdb" target="lib\nanoFramework.Graphics.Core.pdb" /> | ||
<file src="nanoFramework.Graphics.Core\bin\Release\nanoFramework.Graphics.Core.pdbx" target="lib\nanoFramework.Graphics.Core.pdbx" /> | ||
<file src="nanoFramework.Graphics.Core\bin\Release\nanoFramework.Graphics.Core.pe" target="lib\nanoFramework.Graphics.Core.pe" /> | ||
<file src="nanoFramework.Graphics.Core\bin\Release\nanoFramework.Graphics.Core.xml" target="lib\nanoFramework.Graphics.Core.xml" /> | ||
<file src="assets\readme.txt" target="" /> | ||
<file src="README.md" target="docs\" /> | ||
<file src="assets\nf-logo.png" target="images" /> | ||
<file src="LICENSE.md" target="" /> | ||
</files> | ||
</package> |
Oops, something went wrong.