summaryrefslogtreecommitdiff
path: root/ElmSharp.Test
diff options
context:
space:
mode:
authorWonYoung Choi <wy80.choi@samsung.com>2016-10-20 22:43:58 +0900
committerWonYoung Choi <wy80.choi@samsung.com>2016-10-20 22:57:17 +0900
commitaa4930cd311460c6bb7f1939949c6da51bf375fe (patch)
tree2adccbddbdcc46bcc6e99cc496d9e7cdaf211409 /ElmSharp.Test
parent38dd66e9124c6a1e9b76f10de3734f775e1ce7f5 (diff)
downloadelm-sharp-aa4930cd311460c6bb7f1939949c6da51bf375fe.tar.gz
elm-sharp-aa4930cd311460c6bb7f1939949c6da51bf375fe.tar.bz2
elm-sharp-aa4930cd311460c6bb7f1939949c6da51bf375fe.zip
Fix ImageLoading to use new smart callbacks
New start callbacks for Image were introduced. Fix these smart callbacks ("load,ready", "load,error") are used instead of "preloaded" evas callback. Change-Id: Ia78fb25f29f926045f2ef4c5aa2d457ff9821ff8
Diffstat (limited to 'ElmSharp.Test')
-rw-r--r--ElmSharp.Test/ElmSharp.Test.csproj45
-rw-r--r--ElmSharp.Test/TC/ImageTest1.cs216
-rwxr-xr-xElmSharp.Test/res/TED/app_icn_ted.pngbin0 -> 1636 bytes
-rwxr-xr-xElmSharp.Test/res/TED/large/a.jpgbin0 -> 157336 bytes
-rwxr-xr-xElmSharp.Test/res/TED/large/b.jpgbin0 -> 144472 bytes
-rwxr-xr-xElmSharp.Test/res/TED/large/c.jpgbin0 -> 151950 bytes
-rwxr-xr-xElmSharp.Test/res/TED/large/d.jpgbin0 -> 114345 bytes
-rwxr-xr-xElmSharp.Test/res/TED/large/e.jpgbin0 -> 112488 bytes
-rwxr-xr-xElmSharp.Test/res/TED/large/f.jpgbin0 -> 191628 bytes
-rwxr-xr-xElmSharp.Test/res/TED/large/g.jpgbin0 -> 158625 bytes
-rwxr-xr-xElmSharp.Test/res/TED/thumbnail/a.jpgbin0 -> 163029 bytes
-rwxr-xr-xElmSharp.Test/res/TED/thumbnail/b.jpgbin0 -> 136017 bytes
-rwxr-xr-xElmSharp.Test/res/TED/thumbnail/c.jpgbin0 -> 122669 bytes
-rwxr-xr-xElmSharp.Test/res/TED/thumbnail/d.jpgbin0 -> 189362 bytes
-rwxr-xr-xElmSharp.Test/res/TED/thumbnail/e.jpgbin0 -> 131158 bytes
-rwxr-xr-xElmSharp.Test/res/TED/thumbnail/f.jpgbin0 -> 110933 bytes
-rwxr-xr-xElmSharp.Test/res/TED/thumbnail/g.jpgbin0 -> 118634 bytes
17 files changed, 253 insertions, 8 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj
index 02c92a5..ce757f4 100644
--- a/ElmSharp.Test/ElmSharp.Test.csproj
+++ b/ElmSharp.Test/ElmSharp.Test.csproj
@@ -99,6 +99,51 @@
<Content Include="res\picture.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Content Include="res\TED\app_icn_ted.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\large\a.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\large\b.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\large\c.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\large\d.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\large\e.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\large\f.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\large\g.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\thumbnail\a.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\thumbnail\b.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\thumbnail\c.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\thumbnail\d.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\thumbnail\e.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\thumbnail\f.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="res\TED\thumbnail\g.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
<Content Include="shared\res\ElmSharp.Test.png" />
<Content Include="tizen-manifest.xml" />
</ItemGroup>
diff --git a/ElmSharp.Test/TC/ImageTest1.cs b/ElmSharp.Test/TC/ImageTest1.cs
index de8f72b..72877e4 100644
--- a/ElmSharp.Test/TC/ImageTest1.cs
+++ b/ElmSharp.Test/TC/ImageTest1.cs
@@ -10,22 +10,222 @@ namespace ElmSharp.Test
public override string TestName => "ImageTest1";
public override string TestDescription => "To test basic operation of Image";
+ Image image;
+ Label lbInfo;
+
public override void Run(Window window)
{
- Image image = new Image(window)
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Box box = new Box(window);
+ conformant.SetContent(box);
+ box.Show();
+
+ Box buttonBox1 = new Box(window)
{
- IsFixedAspect = false
+ IsHorizontal = true,
+ AlignmentX = -1,
+ AlignmentY = 0,
};
- image.Load(Path.Combine(TestRunner.ResourceDir, "picture.png"));
- image.Clicked += (e, o) =>
+ buttonBox1.Show();
+
+ Box buttonBox2 = new Box(window)
{
- Console.WriteLine("Image has been clicked. (IsFixedAspect = {0}", image.IsFixedAspect);
- image.IsFixedAspect = image.IsFixedAspect == true?false:true;
+ IsHorizontal = true,
+ AlignmentX = -1,
+ AlignmentY = 0,
+ };
+ buttonBox2.Show();
+
+ Button btnFile1 = new Button(window)
+ {
+ Text = "File1",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+ btnFile1.Show();
+
+ Button btnFile2 = new Button(window)
+ {
+ Text = "File2",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+ btnFile2.Show();
+
+ Button btnUri1 = new Button(window)
+ {
+ Text = "Uri",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+ btnUri1.Show();
+
+ Button btnStream1 = new Button(window)
+ {
+ Text = "Strm",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
};
+ btnStream1.Show();
+
+ buttonBox1.PackEnd(btnFile1);
+ buttonBox1.PackEnd(btnFile2);
+ buttonBox1.PackEnd(btnUri1);
+ buttonBox1.PackEnd(btnStream1);
+
+
+ Button btnFileAsync1 = new Button(window)
+ {
+ Text = "FileA1",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+ btnFileAsync1.Show();
+
+ Button btnFileAsync2 = new Button(window)
+ {
+ Text = "FileA2",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+ btnFileAsync2.Show();
+
+ Button btnUriAsync1 = new Button(window)
+ {
+ Text = "UriA",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+ btnUriAsync1.Show();
+
+ Button btnStreamAsync1 = new Button(window)
+ {
+ Text = "StrmA",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+ btnStreamAsync1.Show();
+
+ buttonBox2.PackEnd(btnFileAsync1);
+ buttonBox2.PackEnd(btnFileAsync2);
+ buttonBox2.PackEnd(btnUriAsync1);
+ buttonBox2.PackEnd(btnStreamAsync1);
+
+ lbInfo = new Label(window)
+ {
+ Color = Color.White,
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1
+ };
+ lbInfo.Show();
+
+ image = new Image(window)
+ {
+ IsFixedAspect = true,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
image.Show();
- image.Resize(500, 500);
- image.Move(100,100);
+ image.Load(Path.Combine(TestRunner.ResourceDir, "picture.png"));
+ image.Clicked += (s, e) =>
+ {
+ Console.WriteLine("Image has been clicked. (IsFixedAspect = {0}", image.IsFixedAspect);
+ image.IsFixedAspect = image.IsFixedAspect == true ? false : true;
+ };
+
+ btnFile1.Clicked += (s, e) => LoadFile("TED/large/a.jpg");
+ btnFile2.Clicked += (s, e) => LoadFile("TED/large/b.jpg");
+ btnUri1.Clicked += (s, e) => LoadUri("http://pe.tedcdn.com/images/ted/2e306b9655267cee35e45688ace775590b820510_615x461.jpg");
+ btnStream1.Clicked += (s, e) => LoadStream(new FileStream(Path.Combine(TestRunner.ResourceDir, "TED/large/c.jpg"), FileMode.Open));
+
+ btnFileAsync1.Clicked += (s, e) => LoadFileAsync("TED/large/d.jpg");
+ btnFileAsync2.Clicked += (s, e) => LoadFileAsync("TED/large/e.jpg");
+ btnUriAsync1.Clicked += (s, e) => LoadUriAsync("http://pe.tedcdn.com/images/ted/2e306b9655267cee35e45688ace775590b820510_615x461.jpg");
+ btnStreamAsync1.Clicked += (s, e) => LoadStreamAsync(new FileStream(Path.Combine(TestRunner.ResourceDir, "TED/large/f.jpg"), FileMode.Open));
+ box.PackEnd(buttonBox1);
+ box.PackEnd(buttonBox2);
+ box.PackEnd(lbInfo);
+ box.PackEnd(image);
+ }
+
+ void LoadFile(string file)
+ {
+ bool ret = image.Load(Path.Combine(TestRunner.ResourceDir, file));
+ if (ret)
+ UpdateLabelText(lbInfo, image.File);
+ else
+ UpdateLabelText(lbInfo, "Loading Failed.");
+ }
+
+ void LoadUri(string uri)
+ {
+ bool ret = image.Load(uri);
+ if (ret)
+ UpdateLabelText(lbInfo, image.File);
+ else
+ UpdateLabelText(lbInfo, "Loading Failed.");
+ }
+
+ void LoadStream(Stream stream)
+ {
+ bool ret = image.Load(stream);
+ if (ret)
+ UpdateLabelText(lbInfo, image.File);
+ else
+ UpdateLabelText(lbInfo, "Loading Failed.");
+ }
+
+ async void LoadFileAsync(string file)
+ {
+ var ret = await image.LoadAsync(Path.Combine(TestRunner.ResourceDir, file));
+ if (ret)
+ UpdateLabelText(lbInfo, image.File);
+ else
+ UpdateLabelText(lbInfo, "Loading Failed.");
+ }
+
+ async void LoadUriAsync(string uri)
+ {
+ var ret = await image.LoadAsync(uri);
+ if (ret)
+ UpdateLabelText(lbInfo, image.File);
+ else
+ UpdateLabelText(lbInfo, "Loading Failed.");
+ }
+
+ async void LoadStreamAsync(Stream stream)
+ {
+ var ret = await image.LoadAsync(stream);
+ if (ret)
+ UpdateLabelText(lbInfo, image.File);
+ else
+ UpdateLabelText(lbInfo, "Loading Failed.");
+ }
+
+ void UpdateLabelText(Label lable, string text)
+ {
+ lable.Text = "<span color=#ffffff font_size=20>" + text + "</span>";
}
}
}
diff --git a/ElmSharp.Test/res/TED/app_icn_ted.png b/ElmSharp.Test/res/TED/app_icn_ted.png
new file mode 100755
index 0000000..ab726c8
--- /dev/null
+++ b/ElmSharp.Test/res/TED/app_icn_ted.png
Binary files differ
diff --git a/ElmSharp.Test/res/TED/large/a.jpg b/ElmSharp.Test/res/TED/large/a.jpg
new file mode 100755
index 0000000..ff18439
--- /dev/null
+++ b/ElmSharp.Test/res/TED/large/a.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/large/b.jpg b/ElmSharp.Test/res/TED/large/b.jpg
new file mode 100755
index 0000000..e34e60b
--- /dev/null
+++ b/ElmSharp.Test/res/TED/large/b.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/large/c.jpg b/ElmSharp.Test/res/TED/large/c.jpg
new file mode 100755
index 0000000..ae2a56c
--- /dev/null
+++ b/ElmSharp.Test/res/TED/large/c.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/large/d.jpg b/ElmSharp.Test/res/TED/large/d.jpg
new file mode 100755
index 0000000..bb7d72a
--- /dev/null
+++ b/ElmSharp.Test/res/TED/large/d.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/large/e.jpg b/ElmSharp.Test/res/TED/large/e.jpg
new file mode 100755
index 0000000..d35a60d
--- /dev/null
+++ b/ElmSharp.Test/res/TED/large/e.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/large/f.jpg b/ElmSharp.Test/res/TED/large/f.jpg
new file mode 100755
index 0000000..238d722
--- /dev/null
+++ b/ElmSharp.Test/res/TED/large/f.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/large/g.jpg b/ElmSharp.Test/res/TED/large/g.jpg
new file mode 100755
index 0000000..873c9f3
--- /dev/null
+++ b/ElmSharp.Test/res/TED/large/g.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/thumbnail/a.jpg b/ElmSharp.Test/res/TED/thumbnail/a.jpg
new file mode 100755
index 0000000..4d16594
--- /dev/null
+++ b/ElmSharp.Test/res/TED/thumbnail/a.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/thumbnail/b.jpg b/ElmSharp.Test/res/TED/thumbnail/b.jpg
new file mode 100755
index 0000000..f3dc3dd
--- /dev/null
+++ b/ElmSharp.Test/res/TED/thumbnail/b.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/thumbnail/c.jpg b/ElmSharp.Test/res/TED/thumbnail/c.jpg
new file mode 100755
index 0000000..a0a4c1a
--- /dev/null
+++ b/ElmSharp.Test/res/TED/thumbnail/c.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/thumbnail/d.jpg b/ElmSharp.Test/res/TED/thumbnail/d.jpg
new file mode 100755
index 0000000..4dfda7c
--- /dev/null
+++ b/ElmSharp.Test/res/TED/thumbnail/d.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/thumbnail/e.jpg b/ElmSharp.Test/res/TED/thumbnail/e.jpg
new file mode 100755
index 0000000..0d4ded3
--- /dev/null
+++ b/ElmSharp.Test/res/TED/thumbnail/e.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/thumbnail/f.jpg b/ElmSharp.Test/res/TED/thumbnail/f.jpg
new file mode 100755
index 0000000..a3fc744
--- /dev/null
+++ b/ElmSharp.Test/res/TED/thumbnail/f.jpg
Binary files differ
diff --git a/ElmSharp.Test/res/TED/thumbnail/g.jpg b/ElmSharp.Test/res/TED/thumbnail/g.jpg
new file mode 100755
index 0000000..33c46c1
--- /dev/null
+++ b/ElmSharp.Test/res/TED/thumbnail/g.jpg
Binary files differ