Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
2007-10-17 Sebastien Pouliot <sebastien@ximian.com>
* HostIgnoreList.cs: Now use the DISTRO variable to track tests to
ignore.
2007-01-07 Sebastien Pouliot <sebastien@ximian.com>
* HostIgnoreList.cs: New class to ignore some tests on specific hosts.
Useful for monobuild where old versions of libraries (e.g. fontconfig)
are failing some unit tests (that we don't want to ignore for all
platforms/distros).
2006-09-18 Boris Kirzner <borisk@mainsoft.com>
* Test20.J2EE.vmwcsproj : fixed reference path.
2006-09-12 Boris Kirzner <borisk@mainsoft.com>
* Test20.csproj,Test20.J2EE.vmwcsproj: updated references path.
2006-08-28 Boris Kirzner <borisk@mainsoft.com>
* System.Drawing.Test20.J2EE.sln, System.Drawing.Test20.sln,
Test20.csproj, Test20.J2EE.vmwcsproj: added solution
and project files for NET_2_0 tests.
2006-01-25 Boris Kirzner <borisk@mainsoft.com>
* Test.vmwcsproj,Test.dotnet.csproj: added reference to NUnit projects.
2006-01-23 Boris Kirzner <borisk@mainsoft.com>
* Test.vmwcsproj: perform java output validation.
2005-09-06 Boris Kirzner <borisk@mainsoft.com>
* Test.dotnet.csproj, Test.vmwcsproj: Added GraphicsPathIterator.cs.
2005-08-16 Andrew Skiba <andrews@mainsoft.com>
* Test.dotnet.csproj, Test.vmwcsproj: Embed Bitmap1.png, add Bitmap1.bmp
2005-08-10 Boris Kirzner <borisk@mainsoft.com>
* Test.dotnet.csproj, Test.vmwcsproj: Added GraphicsPath.cs.
2005-08-09 Andrew Skiba <andrews@mainsoft.com>
* Test.dotnet.csproj, Test.vmcsproj: add ColorConverter.cs and ColorTranslator.cs
2005-08-08 Andrew Skiba <andrews@mainsoft.com>
* Test.dotnet.csproj, Test.vmcsproj: move these projects from DrawingTest/Test and include Mono tests in addition to Mainsoft tests.
2004-03-17 Ravindra <rkumar@novell.com>
* System.Drawing.Drawing2D: Created repository for tests of
this namespace.
* System.Drawing.Imaging: Created repository for tests of
this namespace.
* System.Drawing.Printing: Created repository for tests of
this namespace.
* System.Drawing.Text: Created repository for tests of this
namespace.
* ChangeLog: Added.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
//
// HostIgnoreList helper
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.IO;
using NUnit.Framework;
namespace MonoTests {
// now misnamed - we check for the DISTRO env variable
public class HostIgnoreList {
private const string IgnoreListName = "nunit-host-ignore-list";
private static ArrayList ignore_list;
static HostIgnoreList ()
{
string hostname = Environment.GetEnvironmentVariable ("DISTRO");
if (hostname == null)
return;
if (File.Exists (IgnoreListName)) {
using (StreamReader sr = new StreamReader (IgnoreListName)) {
string line = sr.ReadLine ();
while (line != null) {
if (line.StartsWith (hostname)) {
IgnoreList.Add (line.Substring (hostname.Length + 1));
}
line = sr.ReadLine ();
}
}
}
}
public static IList IgnoreList {
get {
if (ignore_list == null)
ignore_list = new ArrayList ();
return ignore_list;
}
}
public static void CheckTest (string testname)
{
if (ignore_list == null)
return;
if (IgnoreList.Contains (testname)) {
string msg = String.Format ("Test '{0}' was ignored because it's defined in the '{1}' ignore list.",
testname, IgnoreListName);
Assert.Ignore (msg);
}
}
}
}

View File

@@ -0,0 +1,83 @@
//
// CategoryNameCollectionCas.cs
// - CAS unit tests for System.Drawing.Design.CategoryNameCollection
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.Drawing.Design;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
namespace MonoCasTests.System.Drawing.Design {
[TestFixture]
[Category ("CAS")]
public class CategoryNameCollectionCas {
private ConstructorInfo ctor;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
// this executes at fulltrust
ConstructorInfo[] infos = typeof (CategoryNameCollection).GetConstructors ();
ctor = infos[0];
}
[SetUp]
public void SetUp ()
{
if (!SecurityManager.SecurityEnabled)
Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
}
[Test]
[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
public void Create ()
{
new CategoryNameCollection (new string[0]);
}
// we use reflection to call CategoryNameCollection class as it's
// protected by a LinkDemand (which will be converted into full demand,
// i.e. a stack walk) when reflection is used (i.e. it gets testable).
[Test]
[SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
[ExpectedException (typeof (SecurityException))]
public void Create_LinkDemand ()
{
// requires FullTrust, so denying anything break the requirements
Assert.IsNotNull (ctor, "constructor");
ctor.Invoke (new object[1] { (string[])null });
}
}
}

View File

@@ -0,0 +1,39 @@
2006-12-21 Sebastien Pouliot <sebastien@ximian.com>
* TestToolboxItem.cs: More test cases (mostly 2.0 stuff).
2006-11-28 Sebastien Pouliot <sebastien@ximian.com>
* UITypeEditorCas.cs: Reuse new unit test cases in CAS tests.
* UITypeEditorTest.cs: New. Unit tests for UITypeEditor.
2006-05-25 Gert Driesen <drieseng@users.sourceforge.net>
* PropertyValueUIItemCas.cs: Fix compilation using csc 1.x.
2006-05-24 Sebastien Pouliot <sebastien@ximian.com>
* TestToolboxItem.cs: Update ComponentType check to work under MS 2.0.
2005-12-05 Jordi Mas i Hernandez <jordimash@gmail.com>
* TestToolboxItem.cs: New unit test
2005-09-16 Sebastien Pouliot <sebastien@ximian.com>
* CategoryNameCollectionCas.cs: New. CAS unit tests to check for
LinkDemand for SkipVerification.
* PaintValueEventArgsCas.cs: New. CAS unit tests to check for
LinkDemand for SkipVerification.
* PropertyValueUIItemCas.cs: New. CAS unit tests to check for
LinkDemand for SkipVerification.
* ToolboxComponentsCreatedEventArgsCas.cs: New. CAS unit tests to
check for LinkDemand for SkipVerification.
* ToolboxComponentsCreatingEventArgsCas.cs: New. CAS unit tests to
check for LinkDemand for SkipVerification.
* ToolboxItemCas.cs: New. CAS unit tests to check for LinkDemand for
SkipVerification.
* ToolboxItemCollectionCas.cs: New. CAS unit tests to check for
LinkDemand for SkipVerification.
* UITypeEditorCas.cs: New. CAS unit tests to check for LinkDemand for
SkipVerification.

View File

@@ -0,0 +1,85 @@
//
// PaintValueEventArgsCas.cs
// - CAS unit tests for System.Drawing.Design.PaintValueEventArgs
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.Drawing;
using System.Drawing.Design;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
namespace MonoCasTests.System.Drawing.Design {
[TestFixture]
[Category ("CAS")]
public class PaintValueEventArgsCas {
private ConstructorInfo ctor;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
// this executes at fulltrust
ConstructorInfo[] infos = typeof (PaintValueEventArgs).GetConstructors ();
ctor = infos[0];
}
[SetUp]
public void SetUp ()
{
if (!SecurityManager.SecurityEnabled)
Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
}
[Test]
[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
public void Create ()
{
Rectangle r = new Rectangle ();
new PaintValueEventArgs (null, null, Graphics.FromImage (new Bitmap (10, 10)), r);
}
// we use reflection to call PaintValueEventArgs class as it's protected
// by a LinkDemand (which will be converted into full demand, i.e. a
// stack walk) when reflection is used (i.e. it gets testable).
[Test]
[SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
[ExpectedException (typeof (SecurityException))]
public void Create_LinkDemand ()
{
// requires FullTrust, so denying anything break the requirements
Assert.IsNotNull (ctor, "constructor");
ctor.Invoke (new object[4]);
}
}
}

View File

@@ -0,0 +1,89 @@
//
// PropertyValueUIItemCas.cs
// - CAS unit tests for System.Drawing.Design.PropertyValueUIItem
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
namespace MonoCasTests.System.Drawing.Design {
[TestFixture]
[NUnit.Framework.Category ("CAS")]
public class PropertyValueUIItemCas {
private ConstructorInfo ctor;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
// this executes at fulltrust
ConstructorInfo[] infos = typeof (PropertyValueUIItem).GetConstructors ();
ctor = infos[0];
}
[SetUp]
public void SetUp ()
{
if (!SecurityManager.SecurityEnabled)
Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
}
private void PropertyValueUIItemInvoke (ITypeDescriptorContext context, PropertyDescriptor descriptor, PropertyValueUIItem invokedItem)
{
}
[Test]
[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
public void Create ()
{
new PropertyValueUIItem (new Bitmap (10, 10), new PropertyValueUIItemInvokeHandler(PropertyValueUIItemInvoke), null);
}
// we use reflection to call PropertyValueUIItem class as it's protected
// by a LinkDemand (which will be converted into full demand, i.e. a stack
// walk) when reflection is used (i.e. it gets testable).
[Test]
[SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
[ExpectedException (typeof (SecurityException))]
public void Create_LinkDemand ()
{
// requires FullTrust, so denying anything break the requirements
Assert.IsNotNull (ctor, "constructor");
ctor.Invoke (new object [3]);
}
}
}

View File

@@ -0,0 +1,450 @@
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Authors:
//
// Jordi Mas i Hernandez, jordimash@gmail.com
//
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Reflection;
using System.Drawing;
using System.Drawing.Design;
using NUnit.Framework;
namespace MonoTests.System.Drawing.Design {
[TestFixture]
public class TestToolboxItem {
private AssemblyName an;
private Bitmap bitmap;
private ToolboxItemFilterAttribute[] filter;
private AssemblyName[] dependent;
class OurToolboxItem: ToolboxItem {
public OurToolboxItem ()
{
}
public void _CheckUnlocked ()
{
CheckUnlocked ();
}
public Type _GetType (IDesignerHost host, AssemblyName an, string tn, bool r)
{
return GetType (host, an, tn, r);
}
#if NET_2_0
public object Filter (string propertyName, object value)
{
return FilterPropertyValue (propertyName, value);
}
public void _ValidatePropertyType (string propertyName, object value, Type expectedType, bool allowNull)
{
ValidatePropertyType (propertyName, value, expectedType, allowNull);
}
public object _ValidatePropertyValue (string propertyName, object value)
{
return ValidatePropertyValue (propertyName, value);
}
#endif
}
[TestFixtureSetUp]
public void FixtureSetUp ()
{
bitmap = new Bitmap (20, 20);
an = new AssemblyName ();
filter = new ToolboxItemFilterAttribute[0];
dependent = new AssemblyName[0];
}
[Test]
public void DefaultValues ()
{
ToolboxItem item = new ToolboxItem ();
Assert.IsNull (item.AssemblyName, "AssemblyName");
Assert.IsNull (item.Bitmap, "Bitmap");
Assert.AreEqual (String.Empty, item.DisplayName, "DisplayName");
Assert.AreEqual (typeof (ToolboxItemFilterAttribute[]), item.Filter.GetType (), "Filter/Type");
Assert.AreEqual (0, item.Filter.Count, "Filter");
Assert.AreEqual (String.Empty, item.TypeName, "TypeName");
#if NET_2_0
Assert.IsNull (item.Company, "Company");
Assert.AreEqual (".NET Component", item.ComponentType, "ComponentType");
Assert.IsNull (item.DependentAssemblies, "DependentAssemblies");
Assert.IsNull (item.Description, "Description");
Assert.IsFalse (item.IsTransient, "IsTransient");
Assert.AreEqual (0, item.Properties.Count, "Properties");
Assert.AreEqual (String.Empty, item.Version, "Version");
#endif
}
[Test]
public void NullValues ()
{
ToolboxItem item = new ToolboxItem ();
item.AssemblyName = null;
Assert.IsNull (item.AssemblyName, "AssemblyName");
item.Bitmap = null;
Assert.IsNull (item.Bitmap, "Bitmap");
item.DisplayName = null;
Assert.AreEqual (String.Empty, item.DisplayName, "DisplayName");
item.Filter = null;
Assert.AreEqual (0, item.Filter.Count, "Filter");
item.TypeName = null;
Assert.AreEqual (String.Empty, item.TypeName, "TypeName");
#if NET_2_0
item.Company = null;
Assert.AreEqual (String.Empty, item.Company, "Company");
// can't assign null without a NRE
item.DependentAssemblies = new AssemblyName [0];
Assert.AreEqual (0, item.DependentAssemblies.Length, "DependentAssemblies");
item.Description = null;
Assert.AreEqual (String.Empty, item.Description, "Description");
item.IsTransient = true;
Assert.IsTrue (item.IsTransient, "IsTransient");
Assert.AreEqual (9, item.Properties.Count, "Properties");
item.Lock ();
Assert.AreEqual (9, item.Properties.Count, "Properties/Lock");
#endif
}
[Test]
public void TestProperties ()
{
ToolboxItem item = new ToolboxItem ();
AssemblyName name = new AssemblyName ();
name.Name = "OurAssembly";
item.AssemblyName = name;
Assert.AreEqual (name.Name.ToString (), "OurAssembly", "TP#1");
item.TypeName = "TypeName1";
Assert.AreEqual ("TypeName1", item.TypeName, "TP#2");
item.DisplayName = "ShowName";
Assert.AreEqual (item.DisplayName, "ShowName", "TP#3");
item.TypeName = "TypeNameSt";
Assert.AreEqual (item.TypeName, "TypeNameSt", "TP#4");
Bitmap bmp = new Bitmap (200, 200);
item.Bitmap = bmp;
Assert.AreEqual (bmp, item.Bitmap, "TP#5");
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void TestCheckUnlocked1 ()
{
OurToolboxItem item = new OurToolboxItem ();
item.Lock ();
item._CheckUnlocked ();
}
[Test]
public void TestCheckUnlocked2 ()
{
OurToolboxItem item = new OurToolboxItem ();
item._CheckUnlocked ();
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void GetType_Null_Null_Null_False ()
{
new OurToolboxItem ()._GetType (null, null, null, false);
}
[Test]
public void GetType_Null_Null_String_False ()
{
OurToolboxItem item = new OurToolboxItem ();
Assert.IsNull (item._GetType (null, null, "string", false), "GetType");
}
[Test]
public void Initialize_Null ()
{
ToolboxItem item = new ToolboxItem ();
item.Initialize (null);
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void Initialize_Locked_Null ()
{
ToolboxItem item = new ToolboxItem ();
item.Lock ();
item.Initialize (null);
}
[Test]
public void Locked_Twice ()
{
ToolboxItem item = new ToolboxItem ();
item.Lock ();
item.Lock ();
}
#if NET_2_0
[Test]
public void TestNewProperties ()
{
ToolboxItem item = new ToolboxItem ();
item.Company = "OurCompany";
Assert.AreEqual ("OurCompany", item.Company, "TNP#1");
Assert.AreEqual (".NET Component", item.ComponentType, "TNP#2");
item.Description = "Description";
Assert.AreEqual ("Description", item.Description, "TNP#3");
item.IsTransient = true;
Assert.AreEqual (true, item.IsTransient, "TNP#4");
}
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void DependentAssemblies_Null ()
{
new ToolboxItem ().DependentAssemblies = null;
}
[Test]
public void DependentAssemblies_Empty ()
{
ToolboxItem item = new ToolboxItem ();
item.DependentAssemblies = new AssemblyName[0];
Assert.AreEqual (0, item.DependentAssemblies.Length, "Length");
}
[Test]
public void DependentAssemblies ()
{
AssemblyName[] names = new AssemblyName [1];
names[0] = new AssemblyName ();
ToolboxItem item = new ToolboxItem ();
item.DependentAssemblies = names;
Assert.AreEqual (1, item.DependentAssemblies.Length, "Length");
Assert.IsTrue (Object.ReferenceEquals (names[0], item.DependentAssemblies[0]), "ReferenceEquals");
names[0] = null;
Assert.IsNotNull (item.DependentAssemblies[0], "0");
}
[Test]
public void Filter ()
{
OurToolboxItem item = new OurToolboxItem ();
Assert.IsNull (item.Filter ("AssemblyName", null), "AssemblyName,null");
// they are "equal" (publicly wise) but have a different hash code
Assert.AreEqual (typeof (AssemblyName), item.Filter ("AssemblyName", an).GetType (), "AssemblyName,an");
Assert.IsNull (item.Filter ("Bitmap", null), "Bitmap,null");
Assert.AreSame (bitmap, item.Filter ("Bitmap", bitmap), "Bitmap,bitmap");
Assert.AreEqual (String.Empty, item.Filter ("DisplayName", null), "DisplayName,null");
Assert.AreSame (String.Empty, item.Filter ("DisplayName", String.Empty), "DisplayName,string");
Assert.AreEqual (filter, item.Filter ("Filter", null), "Filter,null");
Assert.AreSame (filter, item.Filter ("Filter", filter), "Filter,ToolboxItemFilterAttribute[]");
Assert.AreEqual (String.Empty, item.Filter ("TypeName", null), "TypeName,null");
Assert.AreSame (String.Empty, item.Filter ("TypeName", String.Empty), "TypeName,string");
Assert.IsNull (item.Filter ("Company", null), "Company,null");
Assert.AreSame (String.Empty, item.Filter ("Company", String.Empty), "Company,string");
Assert.AreEqual (null, item.Filter ("DependentAssemblies", null), "DependentAssemblies,null");
// note: not same
Assert.AreEqual (dependent, item.Filter ("DependentAssemblies", filter), "DependentAssemblies,AssemblyName[]");
Assert.IsFalse (Object.ReferenceEquals (dependent, item.Filter ("DependentAssemblies", filter)), "DependentAssemblies,AssemblyName[]/Reference");
Assert.IsNull (item.Filter ("Description", null), "Description,null");
Assert.AreSame (String.Empty, item.Filter ("Description", String.Empty), "Description,string");
Assert.IsTrue ((bool) item.Filter ("IsTransient", true), "IsTransient,true");
Assert.IsFalse ((bool) item.Filter ("IsTransient", false), "IsTransient,false");
}
[Test]
public void GetType_Null ()
{
ToolboxItem item = new ToolboxItem ();
Assert.IsNull (item.GetType (null), "GetType(null)");
}
[Test]
public void ValidatePropertyType ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyType ("IsTransient", true, typeof (bool), false);
item._ValidatePropertyType ("IsTransient", String.Empty, typeof (string), false);
}
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void ValidatePropertyType_Type_Null ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyType ("IsTransient", true, null, false);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ValidatePropertyType_IsTransient_WrongType ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyType ("IsTransient", new object (), typeof (bool), false);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ValidatePropertyType_DontAllowNull ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyType ("IsTransient", null, typeof (bool), false);
}
[Test]
public void ValidatePropertyValue ()
{
OurToolboxItem item = new OurToolboxItem ();
object o = new object ();
Assert.IsNull (item._ValidatePropertyValue (null, null), "null,null");
Assert.AreSame (o, item._ValidatePropertyValue (null, o), "null,object");
Assert.IsNull (item._ValidatePropertyValue ("string", null), "string,null");
Assert.AreSame (o, item._ValidatePropertyValue ("string", o), "string,object");
Assert.IsNull (item._ValidatePropertyValue ("AssemblyName", null), "AssemblyName,null");
Assert.AreSame (an, item._ValidatePropertyValue ("AssemblyName", an), "AssemblyName,an");
Assert.IsNull (item._ValidatePropertyValue ("Bitmap", null), "Bitmap,null");
Assert.AreSame (bitmap, item._ValidatePropertyValue ("Bitmap", bitmap), "Bitmap,bitmap");
Assert.AreEqual (String.Empty, item._ValidatePropertyValue ("DisplayName", null), "DisplayName,null");
Assert.AreSame (String.Empty, item._ValidatePropertyValue ("DisplayName", String.Empty), "DisplayName,string");
Assert.AreEqual (filter, item._ValidatePropertyValue ("Filter", null), "Filter,null");
Assert.AreEqual (filter, item._ValidatePropertyValue ("Filter", filter), "Filter,ToolboxItemFilterAttribute[]");
//Assert.IsFalse (Object.ReferenceEquals (filter, item._ValidatePropertyValue ("Filter", filter)), "Filter,ToolboxItemFilterAttribute[]/Reference");
Assert.AreEqual (String.Empty, item._ValidatePropertyValue ("TypeName", null), "TypeName,null");
Assert.AreSame (String.Empty, item._ValidatePropertyValue ("TypeName", String.Empty), "TypeName,string");
Assert.AreEqual (String.Empty, item._ValidatePropertyValue ("Company", null), "Company,null");
Assert.AreSame (String.Empty, item._ValidatePropertyValue ("Company", String.Empty), "Company,string");
Assert.AreEqual (null, item._ValidatePropertyValue ("DependentAssemblies", null), "DependentAssemblies,null");
Assert.AreEqual (dependent, item._ValidatePropertyValue ("DependentAssemblies", dependent), "DependentAssemblies,AssemblyName[]");
Assert.IsTrue (Object.ReferenceEquals (dependent, item._ValidatePropertyValue ("DependentAssemblies", dependent)), "DependentAssemblies,AssemblyName[]/Reference");
Assert.AreEqual (String.Empty, item._ValidatePropertyValue ("Description", null), "Description,null");
Assert.AreSame (String.Empty, item._ValidatePropertyValue ("Description", String.Empty), "Description,string");
Assert.IsTrue ((bool)item._ValidatePropertyValue ("IsTransient", true), "IsTransient,true");
Assert.IsFalse ((bool)item._ValidatePropertyValue ("IsTransient", false), "IsTransient,false");
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ValidatePropertyValue_AssemblyName_WrongType ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyValue ("AssemblyName", false);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ValidatePropertyValue_Bitmap_WrongType ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyValue ("Bitmap", false);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ValidatePropertyValue_DisplayName_WrongType ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyValue ("DisplayName", false);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ValidatePropertyValue_Filter_WrongType ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyValue ("Filter", false);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ValidatePropertyValue_TypeName_WrongType ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyValue ("TypeName", false);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ValidatePropertyValue_Company_WrongType ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyValue ("Company", false);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ValidatePropertyValue_Description_WrongType ()
{
OurToolboxItem item = new OurToolboxItem ();
item._ValidatePropertyValue ("Description", false);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ValidatePropertyValue_IsTransient_Null ()
{
// only documented case
new OurToolboxItem ()._ValidatePropertyValue ("IsTransient", null);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ValidatePropertyValue_IsTransient_WrongType ()
{
// only documented case
new OurToolboxItem ()._ValidatePropertyValue ("IsTransient", new object ());
}
#endif
}
}

View File

@@ -0,0 +1,83 @@
//
// ToolboxComponentsCreatedEventArgsCas.cs - CAS unit tests
// for System.Drawing.Design.ToolboxComponentsCreatedEventArgs
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.Drawing.Design;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
namespace MonoCasTests.System.Drawing.Design {
[TestFixture]
[Category ("CAS")]
public class ToolboxComponentsCreatedEventArgsCas {
private ConstructorInfo ctor;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
// this executes at fulltrust
ConstructorInfo[] infos = typeof (ToolboxComponentsCreatedEventArgs).GetConstructors ();
ctor = infos[0];
}
[SetUp]
public void SetUp ()
{
if (!SecurityManager.SecurityEnabled)
Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
}
[Test]
[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
public void Create ()
{
new ToolboxComponentsCreatedEventArgs (null);
}
// we use reflection to call ToolboxComponentsCreatedEventArgs class as
// it's protected by a LinkDemand (which will be converted into full demand,
// i.e. a stack walk) when reflection is used (i.e. it gets testable).
[Test]
[SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
[ExpectedException (typeof (SecurityException))]
public void Create_LinkDemand ()
{
// requires FullTrust, so denying anything break the requirements
Assert.IsNotNull (ctor, "constructor");
ctor.Invoke (new object[1] { null });
}
}
}

View File

@@ -0,0 +1,83 @@
//
// ToolboxComponentsCreatingEventArgsCas.cs - CAS unit tests
// for System.Drawing.Design.ToolboxComponentsCreatingEventArgs
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.Drawing.Design;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
namespace MonoCasTests.System.Drawing.Design {
[TestFixture]
[Category ("CAS")]
public class ToolboxComponentsCreatingEventArgsCas {
private ConstructorInfo ctor;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
// this executes at fulltrust
ConstructorInfo[] infos = typeof (ToolboxComponentsCreatingEventArgs).GetConstructors ();
ctor = infos[0];
}
[SetUp]
public void SetUp ()
{
if (!SecurityManager.SecurityEnabled)
Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
}
[Test]
[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
public void Create ()
{
new ToolboxComponentsCreatingEventArgs (null);
}
// we use reflection to call ToolboxComponentsCreatingEventArgs class as
// it's protected by a LinkDemand (which will be converted into full demand,
// i.e. a stack walk) when reflection is used (i.e. it gets testable).
[Test]
[SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
[ExpectedException (typeof (SecurityException))]
public void Create_LinkDemand ()
{
// requires FullTrust, so denying anything break the requirements
Assert.IsNotNull (ctor, "constructor");
ctor.Invoke (new object[1] { null });
}
}
}

View File

@@ -0,0 +1,82 @@
//
// ToolboxItemCas.cs - CAS unit tests for System.Drawing.Design.ToolboxItem
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.Drawing.Design;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
namespace MonoCasTests.System.Drawing.Design {
[TestFixture]
[Category ("CAS")]
public class ToolboxItemCas {
private ConstructorInfo ctor;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
// this executes at fulltrust
ConstructorInfo[] infos = typeof (ToolboxItem).GetConstructors ();
ctor = infos[0];
}
[SetUp]
public void SetUp ()
{
if (!SecurityManager.SecurityEnabled)
Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
}
[Test]
[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
public void Create ()
{
new ToolboxItem ();
}
// we use reflection to call ToolboxItem class as it's protected by a
// LinkDemand (which will be converted into full demand, i.e. a stack
// walk) when reflection is used (i.e. it gets testable).
[Test]
[SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
[ExpectedException (typeof (SecurityException))]
public void Create_LinkDemand ()
{
// requires FullTrust, so denying anything break the requirements
Assert.IsNotNull (ctor, "constructor");
ctor.Invoke (null);
}
}
}

View File

@@ -0,0 +1,83 @@
//
// ToolboxItemCollectionCas.cs
// - CAS unit tests for System.Drawing.Design.ToolboxItemCollection
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.Drawing.Design;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
namespace MonoCasTests.System.Drawing.Design {
[TestFixture]
[Category ("CAS")]
public class ToolboxItemCollectionCas {
private ConstructorInfo ctor;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
// this executes at fulltrust
ConstructorInfo[] infos = typeof (ToolboxItemCollection).GetConstructors ();
ctor = infos[0];
}
[SetUp]
public void SetUp ()
{
if (!SecurityManager.SecurityEnabled)
Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
}
[Test]
[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
public void Create ()
{
new ToolboxItemCollection (new ToolboxItem [0]);
}
// we use reflection to call ToolboxItemCollection class as it's protected
// by a LinkDemand (which will be converted into full demand, i.e. a stack
// walk) when reflection is used (i.e. it gets testable).
[Test]
[SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
[ExpectedException (typeof (SecurityException))]
public void Create_LinkDemand ()
{
// requires FullTrust, so denying anything break the requirements
Assert.IsNotNull (ctor, "constructor");
ctor.Invoke (new object[1] { new ToolboxItem[0] });
}
}
}

View File

@@ -0,0 +1,106 @@
//
// UITypeEditorCas.cs - CAS unit tests for System.Drawing.Design.UITypeEditor
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.Drawing.Design;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
using MonoTests.System.Drawing.Design;
namespace MonoCasTests.System.Drawing.Design {
[TestFixture]
[Category ("CAS")]
public class UITypeEditorCas {
private ConstructorInfo ctor;
private UITypeEditorTest unit;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
// this executes at fulltrust
ConstructorInfo[] infos = typeof (UITypeEditor).GetConstructors ();
ctor = infos[0];
unit = new UITypeEditorTest ();
unit.FixtureSetUp ();
}
[SetUp]
public void SetUp ()
{
if (!SecurityManager.SecurityEnabled)
Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
}
[Test]
[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
public void Create ()
{
new UITypeEditor ();
}
[Test]
[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
public void UnitTests ()
{
unit.DefaultValues ();
}
#if !TARGET_JVM
[Test]
[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
public void UnitTests_PaintValue ()
{
unit.PaintValue_PaintValueEventArgs_Null ();
unit.PaintValue_PaintValueEventArgs ();
unit.PaintValue ();
}
#endif
// we use reflection to call UITypeEditor class as it's protected by a
// LinkDemand (which will be converted into full demand, i.e. a stack
// walk) when reflection is used (i.e. it gets testable).
[Test]
[SecurityPermission (SecurityAction.Deny, SkipVerification = true)]
[ExpectedException (typeof (SecurityException))]
public void Create_LinkDemand ()
{
// requires FullTrust, so denying anything break the requirements
Assert.IsNotNull (ctor, "constructor");
ctor.Invoke (null);
}
}
}

View File

@@ -0,0 +1,88 @@
//
// UITypeEditorTest.cs - Unit tests for System.Drawing.Design.UITypeEditor
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.Drawing;
using System.Drawing.Design;
namespace MonoTests.System.Drawing.Design {
[TestFixture]
public class UITypeEditorTest {
private UITypeEditor editor;
private Graphics graphics;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
editor = new UITypeEditor ();
Bitmap bitmap = new Bitmap (20, 20);
graphics = Graphics.FromImage (bitmap);
}
[Test]
public void DefaultValues ()
{
Assert.AreSame (graphics, editor.EditValue (null, graphics), "EditValue(2)");
Assert.AreSame (graphics, editor.EditValue (null, null, graphics), "EditValue(3)");
Assert.AreEqual (UITypeEditorEditStyle.None, editor.GetEditStyle (), "GetEditStyle()");
Assert.AreEqual (UITypeEditorEditStyle.None, editor.GetEditStyle (null), "GetEditStyle(null)");
Assert.IsFalse (editor.GetPaintValueSupported (), "GetPaintValueSupported()");
Assert.IsFalse (editor.GetPaintValueSupported (null), "GetPaintValueSupported(null)");
#if NET_2_0
Assert.IsFalse (editor.IsDropDownResizable, "IsDropDownResizable");
#endif
}
#if !TARGET_JVM
[Test]
public void PaintValue_PaintValueEventArgs_Null ()
{
editor.PaintValue (null);
}
[Test]
public void PaintValue_PaintValueEventArgs ()
{
editor.PaintValue (new PaintValueEventArgs (null, null, graphics, Rectangle.Empty));
}
[Test]
public void PaintValue ()
{
editor.PaintValue (null, graphics, Rectangle.Empty);
}
#endif
}
}

View File

@@ -0,0 +1,250 @@
2010-07-15 Sebastien Pouliot <sebastien@ximian.com>
* LinearGradientBrushTest.cs: Add test case for #537396 (empty rects)
2009-08-28 Atsushi Enomoto <atsushi@ximian.com>
* TestBlend.cs, TestMatrix.cs : nunit test upgrade to modern style.
2008-12-23 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs, LinearGradientBrushTest.cs, TestMatrix.cs:
Add delta when comparing floating point values since there can be
small differences between different platforms.
2008-12-10 Atsushi Enomoto <atsushi@ximian.com>
* LinearGradientBrushTest.cs, GraphicsPathTest.cs,
TestMatrix.cs : fix tests wrt rounding that were failing on .NET
too (exposed by nunit24).
2008-11-01 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathIteratorTest.cs: New. Add some (incomplete) unit
tests for GraphicsPathIterator. Test cases are mostly to ensure
null check compatibility with MS.
* LinearGradientBrushTest.cs: Add test case when setting null
on properties.
* PathGradientBrushTest.cs: Add test case when setting null
on properties.
2008-09-03 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Add unit test to check for an open curve
points.
2008-09-02 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Add a bunch of unit tests to check when
points can be compressed (removed) when adding shapes to a path.
2008-08-04 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Add test case for "half" closed paths.
[Bug #413461]
2007-10-30 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added IsVisible test cases on ellipses
(#325502)
2007-07-31 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added more test cases for Reverse based on the
C test cases provided in #81859.
2007-07-30 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added more test cases for Reverse, the complex
ones don't work yet (see #81859).
2007-03-30 Sebastien Pouliot <sebastien@ximian.com>
* TestMatrix.cs: Allow a small delta when comparing floats. This
allows the ARM to work properly (e.g. -9.999995 versus -10).
2006-09-26 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added test case for Reverse (and found out that
the types aren't reversed, only the points are).
2006-09-18 Boris Kirzner <borisk@mainsoft.com>
* TestColorBlend.cs,TestHatchBrush.cs : marked tests not working
for TARGET_JVM.
2006-08-16 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Ignore some test cases if we cannot get any
font family from GDI+.
* TestHatchBrush.cs: Ignore some test cases if we cannot get any font
family from GDI+. Update to NUnit 2.2+ and fix getOutSufix method
2006-06-09 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added test cases for IsVisible methods.
2006-06-07 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added test cases for IsOutlineVisible methods.
2006-06-01 Sebastien Pouliot <sebastien@ximian.com>
* TestHatchBrush.cs: Some were surprisingly similar until...
2006-05-24 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Ignore some test cases that aren't implemented
in libgdiplus and have different results in MS 1.x/2.0 (or between
different executions, yuck).
2006-05-09 Sebastien Pouliot <sebastien@ximian.com>
* PathGradientBrushTest.cs: New. Unit tests (mostly) based on the test
cases created for LinearGradientBrush.
2006-05-08 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added test cases for Widen and Wrap with empty
path (expected behaviour) and paths that have a single point (stranger
behaviour). Changed comments on GetBounds_WithPen test case as it will
probably never work under Mono due to difference in precisions.
2006-05-05 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added more test cases for GetBounds and found
out the results are very imprecise when curves are used (hence
difficult to test but much easier to implement ;-)
2006-05-03 Sebastien Pouliot <sebastien@ximian.com>
* LinearGradientBrushTest.cs: Added new test case for #78185 (from
Bill Holmes).
2006-05-01 Sebastien Pouliot <sebastien@ximian.com>
* LinearGradientBrushTest.cs: Added new test case for #78179 (from
Bill Holmes).
2006-04-28 Sebastien Pouliot <sebastien@ximian.com>
* TestColorBlend.cs: Added new test cases to verify if the TODO were
still valid. Updated existing test cases to nunit 2.2 api.
* GraphicsPathTest.cs: Added new test cases for AddCurve and it's
different behaviour (in some methods) when only two points are used
to define a curve.
2006-04-27 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Activate two unit tests where we use AddLines
to add a single point to a path.
2006-04-27 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added new test cases for AddString.
2006-04-20 Sebastien Pouliot <sebastien@ximian.com>
* LinearGradientBrushTest.cs: Remove "NonWorking" from many test
cases. Added more test cases for non-invertible matrix and to ensure
all matrix-based transformation are correct.
2006-04-19 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Add test cases for Wrap and Widen (most of them
are current "NotWorking").
2006-04-10 Sebastien Pouliot <sebastien@ximian.com>
* TestMatrix.cs: Added new test cases for contructors accepting
rectangles and points.
2006-03-30 Sebastien Pouliot <sebastien@ximian.com>
* LinearGradientBrushTest.cs: Added a bunch of test cases to check
for the "initial" matrix of the brush (which we don't set).
* TestMatrix.cs: Added test cases about matrix identity precision.
2006-03-29 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Add test cases for every Add* method to check
their (different) behaviour wrt starting and closing figures in the
path they are added.
2006-03-28 Sebastien Pouliot <sebastien@ximian.com>
* TestMatrix.cs: Added new test cases.
2006-03-22 Sebastien Pouliot <sebastien@ximian.com>
* LinearGradientBrushTest.cs: New. Some unit tests (moslty failing).
2006-03-14 Sebastien Pouliot <sebastien@ximian.com>
* TestMatrix.cs: Added new test cases to test libgdiplus validations.
2006-03-13 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added new test cases for SetMarkers,
ClearMarkers, CloseFigure and CloseAllFigures on an empty path.
2006-01-27 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Removed "NotWorking" from existing Flatten
tests and added more test cases (for each type of shape).
2006-01-16 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: Added test cases for GetBounds and re-activated
some parts of the tests that checked bounds (Add* tests).
2006-01-13 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: New. Added multiple test cases to check null
handling and how the points are generated for the Add* methods.
* PathDataTest.cs: New. Added clone test case.
2006-01-12 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPathTest.cs: New. Basic test cases for empty path and
cloning.
* PathDataTest.cs: New. Test cases for PathData.
2005-09-16 Sebastien Pouliot <sebastien@ximian.com>
* TestBlend.cs, TestColorBlend.cs, TestHatchBrush.cs, TestMatrix.cs:
Deny UnmanagedCode permission to all tests. This shows (when executed
under MS runtime) that S.D API is safe and doesn't requires high
privileges to run - even if we know that, deep down, this calls into
GDI+.
2005-08-25 Jordi Mas i Hernandez <jordi@ximian.com>
* TestMatrix.cs: New test cases
2005-08-24 Jordi Mas i Hernandez <jordi@ximian.com>
* TestMatrix.cs: New Matrix unit case
2004-06-03 Ravindra <rkumar@novell.com>
* TestHatchBrush.cs: Added missing test cases for all the hatch
styles.
2004-05-18 Ravindra <rkumar@novell.com>
* TestHatchBrush.cs: Added a test case for HatchBrush.cs.
* TestBlend.cs: dos2unix format and namespace changed to
MonoTests.System.Drawing.Drawing2D.
* TestColorBlend.cs: dos2unix format and namespace changed to
MonoTests.System.Drawing.Drawing2D.
2004-03-17 Ravindra <rkumar@novell.com>
* TestBlend.cs: Added.
* TestColorBlend.cs: Added.
2004-03-17 Ravindra <rkumar@novell.com>
* System.Drawing.Drawing2D: Created a repository for
System.Drawing.Drawing2D tests.
* ChangeLog: Added.

View File

@@ -0,0 +1 @@
e8232565933069b1ed8408c17cd52091a0462042

View File

@@ -0,0 +1,87 @@
//
// System.Drawing.Drawing2D.PathData unit tests
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Security.Permissions;
using NUnit.Framework;
namespace MonoTests.System.Drawing.Drawing2D {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class PathDataTest {
[Test]
public void PathData_Empty ()
{
PathData data = new PathData ();
Assert.IsNull (data.Points, "Points");
Assert.IsNull (data.Types, "Types");
data.Points = new PointF[0];
data.Types = new byte[0];
Assert.AreEqual (0, data.Points.Length, "Points-0");
Assert.AreEqual (0, data.Types.Length, "Types-0");
data.Points = null;
data.Types = null;
Assert.IsNull (data.Points, "Points-1");
Assert.IsNull (data.Types, "Types-1");
}
[Test]
public void PathData_LengthMismatch ()
{
PathData data = new PathData ();
data.Points = new PointF[2];
data.Types = new byte[1];
Assert.AreEqual (2, data.Points.Length, "Points-2");
Assert.AreEqual (1, data.Types.Length, "Types-1");
}
[Test]
public void PathData_UnclonedProperties ()
{
PathData data = new PathData ();
data.Points = new PointF[1] { new PointF (1f, 1f) };
data.Types = new byte[1] { 1 };
Assert.AreEqual (1f, data.Points[0].X, "Points.X");
Assert.AreEqual (1f, data.Points[0].Y, "Points.Y");
Assert.AreEqual (1, data.Types[0], "Types");
data.Points[0] = new PointF (0f, 0f);
Assert.AreEqual (0f, data.Points[0].X, "Points.X.1");
Assert.AreEqual (0f, data.Points[0].Y, "Points.Y.1");
data.Types[0] = 0;
Assert.AreEqual (0, data.Types[0], "Types-1");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,83 @@
//
// Tests for System.Drawing.Drawing2D.Blend.cs
//
// Author:
// Ravindra (rkumar@novell.com)
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Security.Permissions;
namespace MonoTests.System.Drawing.Drawing2D
{
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class BlendTest
{
[TearDown]
public void TearDown () { }
[SetUp]
public void SetUp () { }
[Test]
public void TestConstructors ()
{
Blend blend0 = new Blend ();
Assert.AreEqual (1, blend0.Factors.Length, "C#1");
Assert.AreEqual (1, blend0.Positions.Length, "C#2");
Blend blend1 = new Blend (1);
Assert.AreEqual (1, blend1.Factors.Length, "C#3");
Assert.AreEqual (1, blend1.Positions.Length, "C#4");
}
[Test]
public void TestProperties ()
{
Blend blend0 = new Blend ();
Assert.AreEqual (0, blend0.Factors[0], "P#1");
Assert.AreEqual (0, blend0.Positions[0], "P#2");
Blend blend1 = new Blend (1);
float[] positions = {0.0F, 0.5F, 1.0F};
float[] factors = {0.0F, 0.5F, 1.0F};
blend1.Factors = factors;
blend1.Positions = positions;
Assert.AreEqual (factors[0], blend1.Factors[0], "P#3");
Assert.AreEqual (factors[1], blend1.Factors[1], "P#4");
Assert.AreEqual (factors[2], blend1.Factors[2], "P#5");
Assert.AreEqual (positions[0], blend1.Positions[0], "P#6");
Assert.AreEqual (positions[1], blend1.Positions[1], "P#7");
Assert.AreEqual (positions[2], blend1.Positions[2], "P#8");
}
}
}

Some files were not shown because too many files have changed in this diff Show More