Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2439 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
13 changed files with 135 additions and 64 deletions
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.WpfDesign; |
||||
using ICSharpCode.WpfDesign.Designer; |
||||
using ICSharpCode.WpfDesign.Designer.Extensions; |
||||
|
||||
namespace ICSharpCode.WpfDesign.Tests.Designer |
||||
{ |
||||
[TestFixture] |
||||
public class PlacementTests : ModelTestHelper |
||||
{ |
||||
void Move(Vector v, params DesignItem[] items) |
||||
{ |
||||
PlacementOperation operation = PlacementOperation.Start(items, PlacementType.Move); |
||||
foreach (PlacementInformation info in operation.PlacedItems) { |
||||
info.Bounds = new Rect(info.OriginalBounds.Left + v.X, |
||||
info.OriginalBounds.Top + v.Y, |
||||
info.OriginalBounds.Width, |
||||
info.OriginalBounds.Height); |
||||
operation.CurrentContainerBehavior.SetPosition(info); |
||||
} |
||||
operation.Commit(); |
||||
} |
||||
|
||||
[Test] |
||||
public void MoveFixedWidthButton() |
||||
{ |
||||
DesignItem button = CreateCanvasContext("<Button Width='100' Height='200'/>"); |
||||
Move(new Vector(50, 25), button); |
||||
AssertCanvasDesignerOutput(@"<Button Width=""100"" Height=""200"" Canvas.Left=""50"" Canvas.Top=""25"" />", button.Context); |
||||
} |
||||
|
||||
[Test] |
||||
public void MoveAutoWidthButton() |
||||
{ |
||||
DesignItem button = CreateCanvasContext("<Button/>"); |
||||
Move(new Vector(50, 25), button); |
||||
AssertCanvasDesignerOutput(@"<Button Canvas.Left=""50"" Canvas.Top=""25"" />", button.Context); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue