aboutsummaryrefslogtreecommitdiffstatsci
path: root/Tests
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-08-04 13:12:30 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-08-04 14:29:18 +0200
commit3a01c455e09af25109239ab7ca32e66ea1ebc99b (patch)
tree27a7c6923c7285d1a8432ae393c8a5fb8981a28d /Tests
parentb24819ffb8f629fb0ed70064f90357a42653ae5d (diff)
* Tests.csproj:
* BasicTests.cs: * TreeView.crow: * welcome.crow: * test4.crow: * testWindow2.goml: * testTreeView.crow: * testDirViewer.crow: update tests * Interface.cs: * OpenTKGameWindow.cs: perf measures * IMLStream.cs: datas prop * TemplatedControl.cs: ItemTemplate * ListBox.cs: thread sync nouveau fichier : Tests/test.style
Diffstat (limited to 'Tests')
-rw-r--r--Tests/BasicTests.cs10
-rwxr-xr-xTests/Interfaces/Divers/testWindow2.goml55
-rw-r--r--Tests/Interfaces/Divers/welcome.crow7
-rwxr-xr-xTests/Interfaces/Unsorted/test4.crow169
-rwxr-xr-xTests/Interfaces/Unsorted/testDirViewer.crow6
-rwxr-xr-xTests/Interfaces/Unsorted/testTreeView.crow37
-rw-r--r--Tests/OpenTKGameWindow.cs5
-rw-r--r--Tests/Tests.csproj4
-rw-r--r--Tests/test.style13
9 files changed, 101 insertions, 205 deletions
diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs
index 0733f189..0c515aa6 100644
--- a/Tests/BasicTests.cs
+++ b/Tests/BasicTests.cs
@@ -3,6 +3,7 @@ using Crow;
using System.Collections.Generic;
using System.Linq;
using System.IO;
+using System.Reflection;
namespace Tests
@@ -19,7 +20,10 @@ namespace Tests
#region Test values for Binding
public int intValue = 25;
-
+ DirectoryInfo curDir = new DirectoryInfo (Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
+ public FileSystemInfo[] CurDirectory {
+ get { return curDir.GetFileSystemInfos (); }
+ }
public int IntValue {
get {
return intValue;
@@ -105,6 +109,10 @@ namespace Tests
GraphicObject w = CrowInterface.LoadInterface ("Interfaces/Divers/testWindow.goml");
w.DataSource = this;
return;
+ } else if (e.Key == OpenTK.Input.Key.F5) {
+ GraphicObject w = CrowInterface.LoadInterface ("Interfaces/Divers/testWindow2.goml");
+ w.DataSource = this;
+ return;
} else if (e.Key == OpenTK.Input.Key.F2)
idx--;
else if (e.Key == OpenTK.Input.Key.F3)
diff --git a/Tests/Interfaces/Divers/testWindow2.goml b/Tests/Interfaces/Divers/testWindow2.goml
index 6fb61db0..7f0caf31 100755
--- a/Tests/Interfaces/Divers/testWindow2.goml
+++ b/Tests/Interfaces/Divers/testWindow2.goml
@@ -1,26 +1,33 @@
<?xml version="1.0"?>
-<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0.5,0.5,0.5,0.8"
- Focusable="True" CornerRadius="20" MinimumSize="100,100" MaximumSize="500,500">
- <Template>
- <Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
- <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
- <Border BorderWidth="1" Foreground="White" Width="{../../../WidthPolicy}" Height="Fit"
- Background="0.1,0.5;1,0,0.5">
- <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../WidthPolicy}" Height="Fit" >
- <GraphicObject Width="5"/>
- <Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
- <Label Foreground="White" Width="{../../../../../WidthPolicy}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
- <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
- MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
- <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
- MouseClick="../../../../../../butQuitPress"/>
- </Border>
- <GraphicObject Width="5"/>
- </HorizontalStack>
- </Border>
- <Container Name="Content" Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}" Background="0.5,0.5,0.5,0.5"/>
- </VerticalStack>
- </Border>
- </Template>
- <GraphicObject Height="50" Width="50" Background="Green"/>
+<Window Focusable="true" Title="Measures" Width="30%" Height="Fit" MinimumSize="100,100">
+ <VerticalStack Width="90%" Height="Fit" Spacing="1" Margin="10">
+ <HorizontalStack Height="Fit">
+ <Label Text="Fps:" Style="FpsLabel"/>
+ <Label Text="{fps}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Min:" Style="FpsLabel"/>
+ <Label Text="{fpsMin}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Max:" Style="FpsLabel"/>
+ <Label Text="{fpsMax}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Update:" Style="FpsLabel"/>
+ <Label Text="{update}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Layouting:" Style="FpsLabel"/>
+ <Label Text="{layouting}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Clipping:" Style="FpsLabel"/>
+ <Label Text="{clipping}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Drawing:" Style="FpsLabel"/>
+ <Label Text="{drawing}" Style="FpsDisp"/>
+ </HorizontalStack>
+ </VerticalStack>
</Window>
diff --git a/Tests/Interfaces/Divers/welcome.crow b/Tests/Interfaces/Divers/welcome.crow
index 8a98b380..65fc3577 100644
--- a/Tests/Interfaces/Divers/welcome.crow
+++ b/Tests/Interfaces/Divers/welcome.crow
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
-<VerticalStack>
- <Label Text="Press &lt;F3&gt; to cycle into the examples"/>
- <Label Text="Those are basic tests used to validate changes"/>
+<VerticalStack Fit="true" VerticalAlignment="Top" Background="0.7,0.7,0.7,0.5"
+ Margin="10" CornerRadius="10">
+ <Label Font="20" Text="Press &lt;F3&gt; to cycle into the examples"/>
+ <Label Font="20" Text="Those are basic tests used to validate changes"/>
</VerticalStack> \ No newline at end of file
diff --git a/Tests/Interfaces/Unsorted/test4.crow b/Tests/Interfaces/Unsorted/test4.crow
deleted file mode 100755
index 06476f31..00000000
--- a/Tests/Interfaces/Unsorted/test4.crow
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0"?>
-<Group Name="MainGrp"
- Width="800" Height="500"
- Background="0.5,0.5,0.5,0.5" Foreground="White"
- Margin="10" >
- <Border Margin="10" CornerRadius="10"
- Name="mainBorder"
- BorderWidth="2" Foreground="Transparent"
- Focusable="True"
- MouseEnter="{Foreground = White}"
- MouseLeave="{Foreground = Transparent}">
- <HorizontalStack WidgetSpacing="1">
- <VerticalStack Width="Fit">
- <HorizontalStack WidgetSpacing="1" Fit="true">
- <VerticalStack Fit="true">
- <Label Text="{MousePosition}"/>
- <HorizontalStack Name="hsFocus" Fit="true">
- <Label Text="Focused:"/>
- <Label Name="labFocus"/>
- </HorizontalStack>
- <HorizontalStack Fit="true">
- <Label Text="Active:" Name="hsActive"/>
- <Label Name="labActive"/>
- </HorizontalStack>
- <HorizontalStack Fit="true">
- <Label Text="Hover:" Name="hsHover"/>
- <Label Name="labHover"/>
- </HorizontalStack>
- </VerticalStack>
- <VerticalStack Fit="true">
- <CheckBox Name="chk1"/>
- <CheckBox Name="chk2" IsChecked="true"/>
-
- </VerticalStack>
- <VerticalStack Fit="true">
- <RadioButton IsChecked="true"/>
- <RadioButton/>
- <Button MouseClick="onButClick"/>
- </VerticalStack>
- </HorizontalStack>
- <TextBox Name="textbox1" TextAlignment="Left" Font="droid,14"
- Width="200" Height="Fit" Margin="2" Background="White"
- Forground="Black"
- Foreground="DimGray" BorderWidth="1"
- Text="editable text"/>
- <Popper Width="100">
- <Border Fit="True" Background="ArmyGreen">
- <Image Margin="10" Fit="true" Path="#Crow.Images.Icons.tetra.png"/>
- </Border>
- </Popper>
-
- </VerticalStack>
- <VerticalStack Fit="true" Margin="0" WidgetSpacing="1">
- <Button Margin="1" Width="150" Height="100">
- <Image Path="#Tests.image.tetra.png"/>
- </Button>
- <Popper Width="100">
- <Border Fit="True" Background="ArmyGreen">
- <Image Margin="10" Fit="true" Path="#Crow.Images.Icons.tetra.png"/>
- </Border>
- </Popper>
- <Expandable Name="expander" Width="150" Height="Fit">
- <VerticalStack Name="vsExpanded" Width="100">
- <CheckBox Name="chk1"/>
- <CheckBox Name="chk2" IsChecked="true"/>
- <CheckBox Name="chk3"/>
- <CheckBox Name="chk4"/>
- </VerticalStack>
- </Expandable>
- <Expandable Name="expander2" Width="150" Height="Fit">
- <VerticalStack Name="vsExpanded" Width="100">
- <CheckBox Name="chk1"/>
- <CheckBox Name="chk2" IsChecked="true"/>
- </VerticalStack>
- </Expandable>
- <Expandable Name="expander3" Width="150" Height="Fit">
- <VerticalStack Name="vsExpanded" Width="100">
- <CheckBox Name="chk1" IsChecked="true"/>
- <CheckBox Name="chk2"/>
- </VerticalStack>
- </Expandable>
- <HorizontalStack>
- <Label Text="Update" FontColor="White"/>
- <Label Name="labUpdate" Text="{update}" FontSize="16" Width="60" TextAlignment="Center" Background="DarkGreen"/>
- </HorizontalStack>
- <HorizontalStack>
- <Label Text="Fps:" Width = "30"/>
- <Label Name="labFps" Text="{fps}" Font="droid bold, 14"
- TextAlignment="Center" Background="AoEnglish"/>
- </HorizontalStack>
- <HorizontalStack>
- <Label Text="Min:" Width = "30"/>
- <Label Name="labFpsMin" Text="{fpsMin}" Font="droid bold, 14"
- TextAlignment="Center" Background="AoEnglish"/>
- </HorizontalStack>
- <HorizontalStack>
- <Label Text="Max:" Width = "30"/>
- <Label Name="labFpsMax" Text="{fpsMax}" Font="droid bold, 14"
- TextAlignment="Center" Background="AoEnglish"/>
- </HorizontalStack>
- </VerticalStack>
- <HorizontalStack Width="Fit">
- <Scroller Name="scroller1" Background="DimGray" Width="Fit"
- Margin="5" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
- <VerticalStack Name="colors" VerticalAlignment="Top" Margin="1" Fit="true">
-<!-- <ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"
- BorderWidth="2" Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>
- <ProgressBar Width="100" Height="20" Value="{fps}" BorderWidth="2"
- Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/> -->
- </VerticalStack>
- </Scroller>
- <ScrollBar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}"
- Orientation="Vertical" Width="10" Height="Stretched"/>
- </HorizontalStack>
- </HorizontalStack>
-<!-- <HorizontalStack Name="hs0"
- WidgetSpacing="1"
- VerticalAlignment="Top">
- <Slider Orientation="Vertical" Height="300" Width="10" Background="Transparent" />
- <VerticalStack Name="vs1" Spacing="5">
- <Slider Height="10" Width="300" BorderWidth="1" Background="Transparent" />
- <HorizontalStack WidgetSpacing="10">
-
-
- <Spinner Width="50" Value="5"></Spinner>
- </HorizontalStack>
- <HorizontalStack Name="hsPbar" Margin="5">
- <ProgressBar Name="pbBar"
- Width="200" Height="20"
- Minimum="0"
- Maximum="200"
- Value="{fps}"
- Foreground="BlueCrayola" Background="DarkGray"
- BorderWidth="2" Foreground="White"/>
- </HorizontalStack>
-
- <Button Margin="5" BorderWidth="Stretched" Width="Fit" Height="Fit" HorizontalAlignment="Center">
- <Label FontSize="18" Text="This is a test" Margin="5" Foreground="Black" />
- </Button>
-
- <GroupBox Title="Group Box" Width="300" Height="100"
- Foreground="White" BorderWidth="2" Margin="3">
- <Label Name="labValue" FontSize="14" Text="{../../slider.Value}" TextAlignment="Center"/>
- </GroupBox>
- <Slider Height="10" Width="300" BorderWidth="1" Background="Transparent" />
- <GraduatedSlider Name="slider" Height="30" Width="300" Foreground="BlueBell"/>
- </VerticalStack>
-
- <HorizontalStack Height="350" Width="Fit">
- <Scroller Name="scroller1" Background="DimGray" Height="Stretched" Width="Fit"
- Margin="5" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
- <VerticalStack Name="colors" VerticalAlignment="Top" Margin="1">
- <ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"
- BorderWidth="2" Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>
- <ProgressBar Width="100" Height="20" Value="{fps}" BorderWidth="2"
- Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>
- </VerticalStack>
- </Scroller>
- <Scrollbar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}"
- Orientation="Vertical" Width="16" />
- </HorizontalStack>
- </HorizontalStack>
--->
-<!-- <Slider
- Height="20" Width="100"
- Background="Transparent"
- VerticalAlignment="Bottom" />-->
- </Border>
-</Group> \ No newline at end of file
diff --git a/Tests/Interfaces/Unsorted/testDirViewer.crow b/Tests/Interfaces/Unsorted/testDirViewer.crow
index af170947..bc25428e 100755
--- a/Tests/Interfaces/Unsorted/testDirViewer.crow
+++ b/Tests/Interfaces/Unsorted/testDirViewer.crow
@@ -1,17 +1,17 @@
<?xml version="1.0"?>
<VerticalStack Height="Fit" Width="Fit" Name="hstack" Margin="0" Spacing="0">
- <Border Height="Fit" Width="200" BorderWidth="2" CornerRadius="10">
+ <Border Height="100%" Width="50%" BorderWidth="2" CornerRadius="10">
<Label Name="labName" Text="{Name}" Width="Stretched" Height="Fit"/>
</Border>
<ListBox Data="{GetFileSystemInfos}" Width="Fit" Height="400"
Background="0.5,0.5,0.5,0.5"
- SelectedItemChanged="OnSelectedItemChanged"
+ SelectedItemChanged="OnSelectedItemChanged"
ItemTemplate="Interfaces/tmpDirItem.goml" >
<Template>
<Border BorderWidth="1" MinimumSize="20,20" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
<HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
- <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
+ <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
<VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" Name="List" Margin="0" VerticalAlignment="Top"/>
</Scroller>
diff --git a/Tests/Interfaces/Unsorted/testTreeView.crow b/Tests/Interfaces/Unsorted/testTreeView.crow
index 9504c958..c998af39 100755
--- a/Tests/Interfaces/Unsorted/testTreeView.crow
+++ b/Tests/Interfaces/Unsorted/testTreeView.crow
@@ -1,2 +1,37 @@
<?xml version="1.0"?>
-<TreeView Height="400" Width="200" Data="{List2}" ItemTemplate="#Crow.Templates.TreeItem.crow"/> \ No newline at end of file
+<TreeView Height="90%" Width="90%" Data="{CurDirectory}">
+ <ItemTemplate DataType="System.IO.FileInfo">
+ <Label Background="Mantis" Text="{}" Width="Stretched"/>
+<!-- <Expandable Caption="{}">
+ <Template>
+ <Border BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
+ MouseClick="../onMouseClick">
+ <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+ <HorizontalStack Spacing="1" Height="Fit" Width="{../../../WidthPolicy}">
+ <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>
+ <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>
+ </HorizontalStack>
+ <Container Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
+ </VerticalStack>
+ </Border>
+ </Template>
+ </Expandable>-->
+ </ItemTemplate>
+ <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
+ <Expandable Caption="{Name}" >
+ <Template>
+ <VerticalStack Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <HorizontalStack Spacing="1" Height="-1" Width="{../../WidthPolicy}">
+ <Image Margin="2" Width="12" Height="12"
+ Visible="{../../../HasContent}"
+ Path="{../../../Image}"
+ SvgSub="{../../../IsExpanded}"/>
+ <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>
+ </HorizontalStack>
+ <Container Name="Content" Visible="false"
+ Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
+ </VerticalStack>
+ </Template>
+ </Expandable>
+ </ItemTemplate>
+</TreeView> \ No newline at end of file
diff --git a/Tests/OpenTKGameWindow.cs b/Tests/OpenTKGameWindow.cs
index 2b3bdb24..9b4d0a06 100644
--- a/Tests/OpenTKGameWindow.cs
+++ b/Tests/OpenTKGameWindow.cs
@@ -61,11 +61,13 @@ namespace Crow
ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps));
#if MEASURE_TIME
ValueChanged.Raise (this, new ValueChangeEventArgs ("update",
- this.CrowInterface.clippingTime.ElapsedTicks.ToString () + " ticks"));
+ this.CrowInterface.updateTime.ElapsedTicks.ToString () + " ticks"));
ValueChanged.Raise (this, new ValueChangeEventArgs ("layouting",
this.CrowInterface.layoutTime.ElapsedTicks.ToString () + " ticks"));
ValueChanged.Raise (this, new ValueChangeEventArgs ("drawing",
this.CrowInterface.drawingTime.ElapsedTicks.ToString () + " ticks"));
+ ValueChanged.Raise (this, new ValueChangeEventArgs ("clipping",
+ this.CrowInterface.clippingTime.ElapsedTicks.ToString () + " ticks"));
#endif
}
}
@@ -82,6 +84,7 @@ namespace Crow
public string update = "";
public string drawing = "";
public string layouting = "";
+ public string clipping = "";
#endregion
#region ctor
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index d365c060..56e6a1ec 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -308,9 +308,6 @@
<None Include="Interfaces\Unsorted\testColorList.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Unsorted\test4.crow">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
<None Include="Interfaces\Unsorted\test6.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@@ -372,6 +369,7 @@
<EmbeddedResource Include="ui\LabelButton.style" />
<EmbeddedResource Include="ui\Popper.template" />
<EmbeddedResource Include="ui\MenuItem.style" />
+ <EmbeddedResource Include="test.style" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Crow.csproj">
diff --git a/Tests/test.style b/Tests/test.style
new file mode 100644
index 00000000..a05c930d
--- /dev/null
+++ b/Tests/test.style
@@ -0,0 +1,13 @@
+FpsLabel {
+ Width = 50%;
+ Font = droid, 10;
+ Margin = 1;
+ TextAlignment = Center;
+ Background = Jet;
+}
+FpsDisp {
+ Font = droid , 12;
+ Width = 50%;
+ TextAlignment = Center;
+ Background = Teal;
+}