aboutsummaryrefslogtreecommitdiffstatsci
path: root/Tests
diff options
context:
space:
mode:
authorj-p <jp.bruyere@live.be>2016-08-11 04:20:36 +0200
committerGitHub <noreply@github.com>2016-08-11 04:20:36 +0200
commit81eb8c7a75ffbe8b6740b2a84a9ebff75da9b393 (patch)
tree3225277358a2bba61c4496923ba39353c942098b /Tests
parent4d4a9116ea5c68b27f0b7c43db9682ab57738ae7 (diff)
parent7560c0bb4a769210e289e2633ddf13d2617f8e6e (diff)
Merge pull request #18 from jpbruyere/BindingImprovement
Instantiator
Diffstat (limited to 'Tests')
-rw-r--r--Tests/BasicTests.cs27
-rw-r--r--Tests/Interfaces/Divers/imlEditor.crow1
-rwxr-xr-xTests/Interfaces/basicTests/0.crow6
-rwxr-xr-xTests/Interfaces/basicTests/8.crow34
4 files changed, 57 insertions, 11 deletions
diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs
index 2a82bd23..658cddd8 100644
--- a/Tests/BasicTests.cs
+++ b/Tests/BasicTests.cs
@@ -4,6 +4,8 @@ using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Reflection;
+using System.Text;
+using System.Diagnostics;
namespace Tests
@@ -92,10 +94,10 @@ namespace Tests
this.KeyDown += KeyboardKeyDown1;
- testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
- testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
- //testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/basicTests", "*.crow")).ToArray ();
+ //testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
+ testFiles = Directory.GetFiles (@"Interfaces/basicTests", "*.crow");
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
+ 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/Splitter", "*.crow")).ToArray ();
@@ -151,14 +153,27 @@ namespace Tests
if (fi == null)
return;
if (fi.Extension == ".crow" || fi.Extension == ".goml") {
- IMLStream imls = new IMLStream (fi.FullName);
+ Instantiator i = new Instantiator(fi.FullName);
lock (CrowInterface.UpdateMutex) {
(CrowInterface.FindByName ("crowContainer") as Container).SetChild
- (imls.Instance);
- CurSources = imls.Source;
+ (i.CreateInstance());
+ CurSources = i.GetImlSourcesCode();
}
}
}
+ void onImlSourceChanged(Object sender, TextChangeEventArgs e){
+ Instantiator i;
+ try {
+ i = Instantiator.CreateFromImlFragment (e.Text);
+ } catch (Exception ex) {
+ Debug.WriteLine (ex);
+ return;
+ }
+ lock (CrowInterface.UpdateMutex) {
+ (CrowInterface.FindByName ("crowContainer") as Container).SetChild
+ (i.CreateInstance());
+ }
+ }
void onButClick(object send, MouseButtonEventArgs e)
{
Console.WriteLine ("button clicked:" + send.ToString());
diff --git a/Tests/Interfaces/Divers/imlEditor.crow b/Tests/Interfaces/Divers/imlEditor.crow
index 527745c1..bbad04ef 100644
--- a/Tests/Interfaces/Divers/imlEditor.crow
+++ b/Tests/Interfaces/Divers/imlEditor.crow
@@ -15,6 +15,7 @@
<TextBox Background="White" Height="Fit"
VerticalAlignment="Top"
TextAlignment="TopLeft" Font="mono, 10"
+ TextChanged="onImlSourceChanged"
Text="{CurSources}" Multiline="true"/>
</Scroller>
<ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
diff --git a/Tests/Interfaces/basicTests/0.crow b/Tests/Interfaces/basicTests/0.crow
index b5c153ef..9d3948af 100755
--- a/Tests/Interfaces/basicTests/0.crow
+++ b/Tests/Interfaces/basicTests/0.crow
@@ -1,6 +1,2 @@
<?xml version="1.0"?>
-<Label Margin="50" Width="50%" Height="50%" TextAlignment="BottomRight" Background="Mantis"/>
-<!--<Container Background="Green" Margin="10" Width="Fit" Height="Fit">
- <GraphicObject Margin="10" Width="{../WidthPolicy}" Height="{../HeightPolicy}" Background="Red"
- MinimumSize="50,50"/>
-</Container>--> \ No newline at end of file
+<CheckBox/> \ No newline at end of file
diff --git a/Tests/Interfaces/basicTests/8.crow b/Tests/Interfaces/basicTests/8.crow
new file mode 100755
index 00000000..a20e1ac5
--- /dev/null
+++ b/Tests/Interfaces/basicTests/8.crow
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<Slider Background="Blue" Width="100" Height="20"/>
+<!--<ScrollBar Orientation="Vertical" Maximum="100" Value="10"
+ Width="14" Height="300"/>-->
+<!--<ListBox Data="{TestList}" Width="50%" ItemTemplate="#Tests.Interfaces.colorItem.crow">
+ <Template>
+ <Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
+ <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
+ Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
+ ValueChanged="../../../_scroller_ValueChanged">
+ <VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="10,10"
+ Name="List" Margin="0"
+ VerticalAlignment="Top"
+ HorizontalAlignment="Left"
+ LayoutChanged="../../../../_list_LayoutChanged"/>
+ </Scroller>
+ <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
+ Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
+ Width="14" Height="{../../../HeightPolicy}" />
+ </HorizontalStack>
+ </Border>
+ </Template>
+</ListBox>-->
+<!--<ItemTemplate>
+<HorizontalStack
+ HorizontalAlignment="Left"
+ Height="Fit" Margin="1" Focusable="true"
+ MouseEnter="{Background=hgradient|0:DarkRed|1:Mantis}"
+ MouseLeave="{Background=Transparent}">
+ <GraphicObject Height="12" Width="20" Background="{}" Margin="0" CornerRadius="3"/>
+ <Label Text="{Name}" Margin="0" Width="Stretched"/>
+</HorizontalStack>
+</ItemTemplate>-->