Imported Upstream version 5.16.0.100

Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-08-07 15:19:03 +00:00
parent 0a9828183b
commit 7d7f676260
4419 changed files with 170950 additions and 90273 deletions

View File

@@ -36,6 +36,7 @@ namespace System.Drawing.Drawing2D {
public sealed class LinearGradientBrush : Brush
{
RectangleF rectangle;
private bool _interpolationColorsWasSet;
internal LinearGradientBrush (IntPtr native)
{
@@ -142,6 +143,14 @@ namespace System.Drawing.Drawing2D {
public Blend Blend {
get {
// Interpolation colors and blends don't work together very well. Getting the Blend when InterpolationColors
// is set set puts the Brush into an unusable state afterwards.
// Bail out here to avoid that.
if (_interpolationColorsWasSet)
{
return null;
}
int count;
Status status = GDIPlus.GdipGetLineBlendCount (NativeBrush, out count);
GDIPlus.CheckStatus (status);
@@ -196,6 +205,11 @@ namespace System.Drawing.Drawing2D {
public ColorBlend InterpolationColors {
get {
if (!_interpolationColorsWasSet)
{
throw new ArgumentException("Property must be set to a valid ColorBlend object to use interpolation colors.");
}
int count;
Status status = GDIPlus.GdipGetLinePresetBlendCount (NativeBrush, out count);
GDIPlus.CheckStatus (status);
@@ -239,6 +253,8 @@ namespace System.Drawing.Drawing2D {
Status status = GDIPlus.GdipSetLinePresetBlend (NativeBrush, blend, positions, count);
GDIPlus.CheckStatus (status);
_interpolationColorsWasSet = true;
}
}
@@ -357,6 +373,8 @@ namespace System.Drawing.Drawing2D {
Status status = GDIPlus.GdipSetLineLinearBlend (NativeBrush, focus, scale);
GDIPlus.CheckStatus (status);
_interpolationColorsWasSet = false;
}
public void SetSigmaBellShape (float focus)
@@ -371,6 +389,8 @@ namespace System.Drawing.Drawing2D {
Status status = GDIPlus.GdipSetLineSigmaBlend (NativeBrush, focus, scale);
GDIPlus.CheckStatus (status);
_interpolationColorsWasSet = false;
}
public void TranslateTransform (float dx, float dy)

View File

@@ -207,9 +207,6 @@ System.Drawing.Printing/PrinterSettings.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnitConvert.cs
System.Drawing.Printing/PrintEventArgs.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventHandler.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermission.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionAttribute.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionLevel.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintAction.cs
System.Drawing.Printing/PrintPageEventArgs.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventHandler.cs
@@ -228,3 +225,8 @@ System.Drawing.Text/PrivateFontCollection.cs
../../../external/corefx/src/Common/src/System/Drawing/ColorUtil.netcoreapp21.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.Unix.cs
../../../external/corefx/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermission.cs
../../../external/corefx/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermissionAttribute.cs
../../../external/corefx/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermissionLevel.cs

View File

@@ -253,7 +253,7 @@ namespace System.Drawing
throw new NotImplementedException (msg);
case Status.WrongState:
msg = Locale.GetText ("Object is not in a state that can allow this operation [GDI+ status: {0}]", status);
throw new ArgumentException (msg);
throw new InvalidOperationException (msg);
case Status.FontFamilyNotFound:
msg = Locale.GetText ("The requested FontFamily could not be found [GDI+ status: {0}]", status);
throw new ArgumentException (msg);

View File

@@ -27,6 +27,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if MONO_FEATURE_CAS
using NUnit.Framework;
using System;
using System.Drawing.Printing;
@@ -132,3 +134,5 @@ namespace MonoTests.System.Drawing.Printing {
}
}
}
#endif

View File

@@ -25,6 +25,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if MONO_FEATURE_CAS
using NUnit.Framework;
using System;
@@ -466,3 +467,4 @@ namespace MonoTests.System.Drawing.Printing {
}
}
}
#endif

View File

@@ -104,6 +104,7 @@ namespace MonoTests.System.Drawing.Printing {
[Test]
[Platform (Exclude = "Win", Reason = "Depends on CUPS which is usually not installed on Windows")]
[Ignore]
public void Bug602934_PrinterSettingsReturnActualValues ()
{
if (PrinterSettings.InstalledPrinters.Count < 1)

View File

@@ -187,7 +187,7 @@ namespace MonoTests.System.Drawing {
[Test]
public void ConvertFrom_x4 ()
{
Assert.Throws<Exception> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
Assert.Throws<ArgumentException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
"*1, 1"));
}

View File

@@ -236,7 +236,6 @@ namespace MonoTests.System.Drawing {
Rectangle rect = new Rectangle (2, 2, 5, 5);
Assert.AreEqual (Status.Ok, GDIPlus.GdipBitmapLockBits (bmp, ref rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb, bd), "locked");
Assert.AreEqual (Status.Win32Error, GDIPlus.GdipBitmapLockBits (bmp, ref rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb, bd), "second lock");
Assert.AreEqual (rect.Width, bd.Width, "Width");
Assert.AreEqual (rect.Height, bd.Height, "Height");

View File

@@ -125,7 +125,7 @@ namespace MonoTests.System.Drawing
ptconv.ConvertFrom (null, CultureInfo.InvariantCulture, "*1, 1");
Assert.Fail ("CF#5-1");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "CF#5-2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "CF#5-2");
Assert.IsNotNull (ex.InnerException, "CF#5-3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "CF#5-4");
}
@@ -315,7 +315,7 @@ namespace MonoTests.System.Drawing
ptconv.ConvertFromInvariantString ("hello");
Assert.Fail ("#1");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "#2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.InnerException, "#3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#3");
}
@@ -350,7 +350,7 @@ namespace MonoTests.System.Drawing
ptconv.ConvertFromString ("hello");
Assert.Fail ("#1");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "#2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.InnerException, "#3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#3");
}

View File

@@ -134,7 +134,7 @@ namespace MonoTests.System.Drawing
"*1, 1, 1, 1");
Assert.Fail ("CF#5: must throw Exception");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "CF#5-2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "CF#5-2");
Assert.IsNotNull (ex.InnerException, "CF#5-3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "CF#5-4");
}
@@ -384,7 +384,7 @@ namespace MonoTests.System.Drawing
rconv.ConvertFromInvariantString ("hello");
Assert.Fail ("#1");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "#2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.InnerException, "#3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#3");
}
@@ -421,7 +421,7 @@ namespace MonoTests.System.Drawing
rconv.ConvertFromString ("hello");
Assert.Fail ("#1");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "#2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.InnerException, "#3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#3");
}

View File

@@ -128,7 +128,7 @@ namespace MonoTests.System.Drawing
"*1, 1");
Assert.Fail ("CF#5-1: must throw Exception");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "CF#5-2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "CF#5-2");
Assert.IsNotNull (ex.InnerException, "CF#5-3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "CF#5-4");
}
@@ -320,7 +320,7 @@ namespace MonoTests.System.Drawing
szconv.ConvertFromInvariantString ("hello");
Assert.Fail ("#1");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "#2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.InnerException, "#3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#3");
}
@@ -357,7 +357,7 @@ namespace MonoTests.System.Drawing
szconv.ConvertFromString ("hello");
Assert.Fail ("#1");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "#2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.InnerException, "#3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#3");
}

View File

@@ -129,7 +129,7 @@ namespace MonoTests.System.Drawing
"*1, 1");
Assert.Fail ("CF#5-1: must throw Exception");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "CF#5-2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "CF#5-2");
Assert.IsNotNull (ex.InnerException, "CF#5-3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "CF#5-4");
}
@@ -323,7 +323,7 @@ namespace MonoTests.System.Drawing
szconv.ConvertFromInvariantString ("hello");
Assert.Fail ("#1");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "#2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.InnerException, "#3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#3");
}
@@ -360,7 +360,7 @@ namespace MonoTests.System.Drawing
szconv.ConvertFromString ("hello");
Assert.Fail ("#1");
} catch (Exception ex) {
Assert.AreEqual (typeof (Exception), ex.GetType (), "#2");
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.InnerException, "#3");
Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#3");
}