]> O.S.I.I.S - jp/crow.git/commitdiff
wrapper debug and test
authorjpbruyere <jp.bruyere@hotmail.com>
Sat, 13 Aug 2016 13:45:46 +0000 (15:45 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Sat, 13 Aug 2016 13:45:46 +0000 (15:45 +0200)
Default.style
Tests/BasicTests.cs
Tests/Interfaces/Wrapper/1.crow [new file with mode: 0755]
Tests/Interfaces/Wrapper/2.crow [new file with mode: 0755]
Tests/Tests.csproj
src/GraphicObjects/Wrapper.cs

index 247219d7e9ecbd0042cbe4d994b15f63c0dccb62..8a63a27674d00b661dcd5e35ca48a2541163a8a6 100644 (file)
@@ -3,6 +3,9 @@ MessageBox, Popper, Slider, Spinner, TextBox {
        Focusable = true;
        Height = Fit;
 }
+Wrapper {
+       Orientation = Vertical;
+}
 Button {
        Width = Fit;
 }
index 658cddd82fe29facdf9571affdce5e6dd1a5d2d8..970480f26abd726e53830d1e53906b7f6461d684 100644 (file)
@@ -100,6 +100,7 @@ namespace Tests
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Stack", "*.crow")).ToArray ();
+                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Wrapper", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Expandable", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray ();
diff --git a/Tests/Interfaces/Wrapper/1.crow b/Tests/Interfaces/Wrapper/1.crow
new file mode 100755 (executable)
index 0000000..feddc6e
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<Window Width="50%" Height="50%">
+       <Wrapper Orientation="Vertical" Height="Fit" Width="Fit" Margin="5" Background="Teal" Spacing="1" >
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50%" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50%" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+       </Wrapper>
+</Window>
\ No newline at end of file
diff --git a/Tests/Interfaces/Wrapper/2.crow b/Tests/Interfaces/Wrapper/2.crow
new file mode 100755 (executable)
index 0000000..4fa1cd9
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<Window Width="50%" Height="50%">      
+       <Wrapper Orientation="Horizontal" Height="Fit" Width="Fit" Margin="5" Background="Teal" Spacing="1" >
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50%" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50%" Background="Mantis"/>
+               <GraphicObject Width="50" Height="50" Background="Mantis"/>
+       </Wrapper>
+</Window>
\ No newline at end of file
index 5cf3d6aa789cead6157e18eb93191d488f55b554..2ab0d54c5d2a82d9540b86f8c2ec161961ab31d2 100644 (file)
     <None Include="Interfaces\Divers\imlEditor.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\Wrapper\1.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\Wrapper\2.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />
     <Folder Include="Interfaces\Expandable\" />
     <Folder Include="Interfaces\Splitter\" />
     <Folder Include="Interfaces\Unsorted\" />
+    <Folder Include="Interfaces\Wrapper\" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="image\tetra.png">
index 9b9f0563b60ef4352c9072eb8be2f815b0f79ddc..68e8cab6891894336f88cdd3d3b5713926bde95f 100644 (file)
@@ -37,7 +37,7 @@ namespace Crow
                        int dx = 0;
                        int dy = 0;
 
-                       if (Orientation == Orientation.Horizontal) {
+                       if (Orientation == Orientation.Vertical) {
                                int tallestChild = 0;
                                foreach (GraphicObject c in Children) {
                                        if (!c.Visible)
@@ -85,13 +85,13 @@ namespace Crow
                        //Debug.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString());
                        switch (arg.LayoutType) {
                        case LayoutingType.Width:
-                               if (Orientation == Orientation.Vertical && go.Width.Units == Unit.Percent) {
+                               if (Orientation == Orientation.Horizontal && go.Width.Units == Unit.Percent) {
                                        go.Width = Measure.Fit;
                                        return;
                                }
                                break;
                        case LayoutingType.Height:
-                               if (Orientation == Orientation.Horizontal && go.Height.Units == Unit.Percent) {
+                               if (Orientation == Orientation.Vertical && go.Height.Units == Unit.Percent) {
                                        go.Height = Measure.Fit;
                                        return;
                                }
@@ -109,7 +109,7 @@ namespace Crow
                        int tmp = 0;
                        //Wrapper can't fit in the direction of the wrapper
                        if (lt == LayoutingType.Width) {
-                               if (Orientation == Orientation.Horizontal) {
+                               if (Orientation == Orientation.Vertical) {
                                        Width = Measure.Stretched;
                                        return -1;
                                } else if (RegisteredLayoutings.HasFlag (LayoutingType.Height))
@@ -138,7 +138,7 @@ namespace Crow
                                                return tmp + largestChild + 2 * Margin;
                                        }
                                }
-                       } else if (Orientation == Orientation.Vertical) {
+                       } else if (Orientation == Orientation.Horizontal) {
                                Height = Measure.Stretched;
                                return -1;
                        } else if (RegisteredLayoutings.HasFlag (LayoutingType.Width))