public async Task TestSheetFunctions() { SetupEvnironment(); var root = new Object3D(); // Create the scene (a cube and a sheet) var cube1 = new CubeObject3D(); root.Children.Add(cube1); var sheet = await SheetObject3D.Create(); root.Children.Add(sheet); // set the sheet A1 to 33 sheet.SheetData[0, 0].Expression = "=33"; // rebuild cube without a reference to sheet cube1.Invalidate(InvalidateType.Properties); Assert.AreEqual(20, cube1.Width.Value(cube1), "cube1 should be the default 20mm"); // set the cube width to the sheet value, but with a bad description (needs an equals to work) cube1.Width = "A1"; cube1.Invalidate(InvalidateType.Properties); Assert.AreEqual(0, cube1.Width.Value(cube1), "Should be 0 as the reference is bad"); // now fix the reference cube1.Width = "=A1"; cube1.Invalidate(InvalidateType.Properties); Assert.AreEqual(33, cube1.Width.Value(cube1), "Should now be the value ad A1"); // Change the sheet value sheet.SheetData[0, 0].Expression = "=43"; sheet.SheetData.Recalculate(); // and rebuild the references sheet.Invalidate(InvalidateType.SheetUpdated); Assert.AreEqual(43, cube1.Width.Value(cube1)); }
public void PinchChangesMesh() { 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); root.Children.Add(pinch1); Assert.AreEqual(3, root.Descendants().Count()); }