Skip to content

Commit

Permalink
[coregraphics] Make MatrixOrder a normal enum instead of a nested enum (
Browse files Browse the repository at this point in the history
#5036)

This enum might prove useful to other APIs in the future so move outside of `CGAffineTransform`.
  • Loading branch information
VincentDondain authored and spouliot committed Oct 25, 2018
1 parent 74576fa commit 51e7a47
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
5 changes: 0 additions & 5 deletions src/CoreGraphics/CGAffineTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ public void Multiply (CGAffineTransform b)
y0 = a.x0 * b.yx + a.y0 * b.yy + b.y0;
}

public enum MatrixOrder {
Prepend = 0,
Append = 1,
}

public void Scale (nfloat sx, nfloat sy, MatrixOrder order)
{
switch (order) {
Expand Down
16 changes: 16 additions & 0 deletions src/CoreGraphics/CGEnums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// CGEnums.cs: Enumerations
//
// Author:
// Vincent Dondain (vidondai@microsoft.com)
//
// Copyright 2018 Microsoft
//

namespace CoreGraphics {

public enum MatrixOrder {
Prepend = 0,
Append = 1,
}
}
1 change: 1 addition & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ COREGRAPHICS_CORE_SOURCES = \
CoreGraphics/CGColorSpace.cs \
CoreGraphics/CGContext.cs \
CoreGraphics/CGDisplay.cs \
CoreGraphics/CGEnums.cs \
CoreGraphics/CGGeometry.cs \
CoreGraphics/CGGradient.cs \
CoreGraphics/CGImage.cs \
Expand Down
6 changes: 3 additions & 3 deletions tests/monotouch-test/CoreGraphics/AffineTransformTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void Scale ()

var transform2 = CGAffineTransform.MakeTranslation (1, 2);
// t' = [ sx 0 0 sy 0 0 ] * t – Swift equivalent
transform2.Scale (3, 4, CGAffineTransform.MatrixOrder.Prepend);
transform2.Scale (3, 4, MatrixOrder.Prepend);

Assert.AreEqual ((nfloat)3, transform2.xx);
Assert.AreEqual ((nfloat)0, transform2.yx);
Expand Down Expand Up @@ -204,7 +204,7 @@ public void Translate ()
Assert.AreEqual ((nfloat)3, transform.y0, "y0");

transform = new CGAffineTransform (1, 2, 3, 4, 5, 6);
transform.Translate (2, -3, CGAffineTransform.MatrixOrder.Prepend);
transform.Translate (2, -3, MatrixOrder.Prepend);

Assert.AreEqual ((nfloat)1, transform.xx, "xx");
Assert.AreEqual ((nfloat)2, transform.yx, "yx");
Expand Down Expand Up @@ -259,7 +259,7 @@ public void Rotate ()
Assert.That ((double) (-6), Is.EqualTo ((double) transform.y0).Within (0.000001), "y0");

transform = new CGAffineTransform (1, 2, 3, 4, 5, 6);
transform.Rotate ((nfloat)Math.PI, CGAffineTransform.MatrixOrder.Prepend);
transform.Rotate ((nfloat)Math.PI, MatrixOrder.Prepend);

Assert.That ((double)(-1), Is.EqualTo ((double)transform.xx).Within (0.000001), "xx");
Assert.That ((double)(-2), Is.EqualTo ((double)transform.yx).Within (0.000001), "yx");
Expand Down

1 comment on commit 51e7a47

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Running XM tests on '10.7', Test docs' 🔥 : hudson.AbortException: Xamarin.Mac tests on macOS 10.7 failed (dontlink (system))

Build succeeded
API Diff (from stable)
⚠️ API Diff (from PR only) (🔥 breaking changes 🔥)
Generator Diff (no change)
🔥 Xamarin.Mac tests on macOS 10.7 failed (dontlink (system)) 🔥
Test run succeeded

Please sign in to comment.