Get pinch to use new source pattern
Fixed a bug with multiple items in combine
This commit is contained in:
parent
33ee8cb9ea
commit
9b799df0e9
7 changed files with 165 additions and 48 deletions
|
|
@ -321,6 +321,20 @@ namespace MatterControl.Tests.MatterControl
|
|||
[Test, Category("InteractiveScene")]
|
||||
public void AabbCalculatedCorrectlyForPinchedFitObjects()
|
||||
{
|
||||
DoAabbCalculatedCorrectlyForPinchedFitObjects();
|
||||
}
|
||||
|
||||
async void DoAabbCalculatedCorrectlyForPinchedFitObjects()
|
||||
{
|
||||
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
|
||||
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
|
||||
|
||||
// Automation runner must do as much as program.cs to spin up platform
|
||||
string platformFeaturesProvider = "MatterHackers.MatterControl.WindowsPlatformsFeatures, MatterControl.Winforms";
|
||||
AppContext.Platform = AggContext.CreateInstanceFrom<INativePlatformFeatures>(platformFeaturesProvider);
|
||||
AppContext.Platform.InitPluginFinder();
|
||||
AppContext.Platform.ProcessCommandline();
|
||||
|
||||
// build without pinch
|
||||
{
|
||||
var root = new Object3D();
|
||||
|
|
@ -348,9 +362,9 @@ namespace MatterControl.Tests.MatterControl
|
|||
fit.SizeY = 20;
|
||||
fit.SizeZ = 20;
|
||||
|
||||
var pinch = new PinchObject3D();
|
||||
var pinch = new PinchObject3D_2();
|
||||
pinch.Children.Add(fit);
|
||||
pinch.Invalidate(new InvalidateArgs(pinch, InvalidateType.Properties));
|
||||
await pinch.Rebuild();
|
||||
root.Children.Add(pinch);
|
||||
var rootAabb = root.GetAxisAlignedBoundingBox();
|
||||
Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(-10, -10, -10), new Vector3(10, 10, 10)), .001));
|
||||
|
|
@ -375,10 +389,10 @@ namespace MatterControl.Tests.MatterControl
|
|||
|
||||
var translate = new TranslateObject3D(cube, 11, 0, 0);
|
||||
|
||||
var pinch = new PinchObject3D();
|
||||
var pinch = new PinchObject3D_2();
|
||||
pinch.Children.Add(translate);
|
||||
root.Children.Add(pinch);
|
||||
pinch.Invalidate(new InvalidateArgs(pinch, InvalidateType.Properties));
|
||||
await pinch.Rebuild();
|
||||
var rootAabb = root.GetAxisAlignedBoundingBox();
|
||||
Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(1, -10, -10), new Vector3(21, 10, 10)), .001));
|
||||
}
|
||||
|
|
@ -395,9 +409,9 @@ namespace MatterControl.Tests.MatterControl
|
|||
|
||||
var translate = new TranslateObject3D(fit, 11, 0, 0);
|
||||
|
||||
var pinch = new PinchObject3D();
|
||||
var pinch = new PinchObject3D_2();
|
||||
pinch.Children.Add(translate);
|
||||
pinch.Invalidate(new InvalidateArgs(pinch, InvalidateType.Properties));
|
||||
await pinch.Rebuild();
|
||||
root.Children.Add(pinch);
|
||||
var rootAabb = root.GetAxisAlignedBoundingBox();
|
||||
Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(1, -10, -10), new Vector3(21, 10, 10)), .001));
|
||||
|
|
|
|||
|
|
@ -29,21 +29,14 @@ either expressed or implied, of the FreeBSD Project.
|
|||
#define DEBUG_INTO_TGAS
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.MatterControl;
|
||||
using MatterHackers.MatterControl.DesignTools;
|
||||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
using MatterHackers.MatterControl.Tests.Automation;
|
||||
using MatterHackers.PolygonMesh.Csg;
|
||||
using MatterHackers.PolygonMesh.Processors;
|
||||
using MatterHackers.VectorMath;
|
||||
using Net3dBool;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MatterHackers.PolygonMesh.UnitTests
|
||||
|
|
@ -57,16 +50,25 @@ namespace MatterHackers.PolygonMesh.UnitTests
|
|||
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
|
||||
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
|
||||
|
||||
// Automation runner must do as much as program.cs to spin up platform
|
||||
string platformFeaturesProvider = "MatterHackers.MatterControl.WindowsPlatformsFeatures, MatterControl.Winforms";
|
||||
MatterControl.AppContext.Platform = AggContext.CreateInstanceFrom<INativePlatformFeatures>(platformFeaturesProvider);
|
||||
MatterControl.AppContext.Platform.InitPluginFinder();
|
||||
MatterControl.AppContext.Platform.ProcessCommandline();
|
||||
RunTest();
|
||||
}
|
||||
|
||||
private async void RunTest()
|
||||
{
|
||||
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
|
||||
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
|
||||
|
||||
var root = new Object3D();
|
||||
var cube = new CubeObject3D();
|
||||
root.Children.Add(cube);
|
||||
cube.Invalidate(new InvalidateArgs(cube, InvalidateType.Properties));
|
||||
Assert.AreEqual(1, root.Descendants().Count());
|
||||
|
||||
// now add a pinch
|
||||
var pinch1 = new PinchObject3D();
|
||||
pinch1.WrapItems(new List<IObject3D>() { cube });
|
||||
root.Children.Remove(cube);
|
||||
var pinch1 = new PinchObject3D_2();
|
||||
pinch1.Children.Add(new CubeObject3D());
|
||||
await pinch1.Rebuild();
|
||||
root.Children.Add(pinch1);
|
||||
Assert.AreEqual(3, root.Descendants().Count());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue