From 1c02371c33cf804c5c1c2a2eabb0cd16e35198c3 Mon Sep 17 00:00:00 2001 From: Hyunjin Date: Tue, 25 Jul 2017 16:11:02 +0900 Subject: [PATCH] Add label/Table Test case for Circular Widgets Add Label Test 1,2,3,4,5 Add Table Test Change-Id: Idcf4b729e2ad96f1a5baff8183e33d28bcbf1b07 --- test/ElmSharp.Test/ElmSharp.Test.csproj | 7 ++ test/ElmSharp.Test/TC/Wearable/LabelTest1.cs | 45 +++++++++ test/ElmSharp.Test/TC/Wearable/LabelTest2.cs | 81 ++++++++++++++++ test/ElmSharp.Test/TC/Wearable/LabelTest3.cs | 74 +++++++++++++++ test/ElmSharp.Test/TC/Wearable/LabelTest4.cs | 50 ++++++++++ test/ElmSharp.Test/TC/Wearable/LabelTest5.cs | 105 +++++++++++++++++++++ test/ElmSharp.Test/TC/Wearable/LabelValignTest1.cs | 103 ++++++++++++++++++++ test/ElmSharp.Test/TC/Wearable/TableTest1.cs | 72 ++++++++++++++ 8 files changed, 537 insertions(+) mode change 100755 => 100644 test/ElmSharp.Test/ElmSharp.Test.csproj create mode 100644 test/ElmSharp.Test/TC/Wearable/LabelTest1.cs create mode 100644 test/ElmSharp.Test/TC/Wearable/LabelTest2.cs create mode 100644 test/ElmSharp.Test/TC/Wearable/LabelTest3.cs create mode 100644 test/ElmSharp.Test/TC/Wearable/LabelTest4.cs create mode 100644 test/ElmSharp.Test/TC/Wearable/LabelTest5.cs create mode 100644 test/ElmSharp.Test/TC/Wearable/LabelValignTest1.cs create mode 100644 test/ElmSharp.Test/TC/Wearable/TableTest1.cs diff --git a/test/ElmSharp.Test/ElmSharp.Test.csproj b/test/ElmSharp.Test/ElmSharp.Test.csproj old mode 100755 new mode 100644 index d8b242d..6d61c76 --- a/test/ElmSharp.Test/ElmSharp.Test.csproj +++ b/test/ElmSharp.Test/ElmSharp.Test.csproj @@ -179,6 +179,13 @@ + + + + + + + diff --git a/test/ElmSharp.Test/TC/Wearable/LabelTest1.cs b/test/ElmSharp.Test/TC/Wearable/LabelTest1.cs new file mode 100644 index 0000000..808e52f --- /dev/null +++ b/test/ElmSharp.Test/TC/Wearable/LabelTest1.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace ElmSharp.Test.Wearable +{ + class LabelTest1 : WearableTestCase + { + public override string TestName => "LabelTest1"; + public override string TestDescription => "To test basic operation of Label"; + + public override void Run(Window window) + { + Background bg = new Background(window); + bg.Color = Color.White; + bg.Move(0, 0); + bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + bg.Show(); + + Label label1 = new Label(window); + label1.Color = Color.Black; + label1.Text = "Label Test!!!"; + + label1.Show(); + int width = 200; + int height = 30; + label1.Resize(width, height); + label1.Move(window.ScreenSize.Width/2 - width/2, window.ScreenSize.Height/2 - height/2); + } + + } +} diff --git a/test/ElmSharp.Test/TC/Wearable/LabelTest2.cs b/test/ElmSharp.Test/TC/Wearable/LabelTest2.cs new file mode 100644 index 0000000..7f707a5 --- /dev/null +++ b/test/ElmSharp.Test/TC/Wearable/LabelTest2.cs @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace ElmSharp.Test.Wearable +{ + class LabelTest2 : WearableTestCase + { + public override string TestName => "LabelTest2"; + public override string TestDescription => "To test basic operation of Label"; + + public override void Run(Window window) + { + Background bg = new Background(window); + bg.Color = Color.White; + bg.Move(0, 0); + bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + bg.Show(); + + Label label1 = new Label(window); + label1.Text = "[default valign=top] gyj [bottom gyp], [top gyp], [middle gyp]"; + label1.TextStyle = "DEFAULT = 'color=#000000FF backing_color=#ff0000 backing=on font_size=25 align=left valign=top wrap=word'"; + label1.Resize(650, 0); + var size = label1.EdjeObject["elm.text"].TextBlockFormattedSize; + label1.Show(); + label1.Resize(size.Width, size.Height); + label1.Move(0, 0); + + Label label2 = new Label(window); + label2.Move(0, size.Height + 10); + label2.Text = "[default valign=middle] gyj [bottom gyp], [top gyp], [middle gyp]"; + label2.TextStyle = "DEFAULT = 'color=#000000FF backing_color=#ff0000 backing=on font_size=25 align=left valign=middle wrap=word'"; + label2.Resize(650, 0); + size = label2.EdjeObject["elm.text"].TextBlockFormattedSize; + label2.Show(); + label2.Resize(size.Width, size.Height); + + Label label3 = new Label(window); + label3.Move(0, label2.Geometry.Y + size.Height + 10); + label3.Text = "[default valign=bottom] gyj [bottom gyp], [top gyp], [middle gyp]"; + label3.TextStyle = "DEFAULT = 'color=#000000FF backing_color=#ff0000 backing=on font_size=25 align=left valign=bottom wrap=word'"; + label3.Resize(650, 0); + size = label3.EdjeObject["elm.text"].TextBlockFormattedSize; + label3.Show(); + label3.Resize(size.Width, size.Height); + + Label label4 = new Label(window); + label4.Move(0, label3.Geometry.Y + size.Height + 10); + label4.Text = "[No TextStyle]" + + "[bottom gyp], " + + "[top gyp], " + + "[middle gyp]"; + label4.Resize(650, 0); + size = label4.EdjeObject["elm.text"].TextBlockFormattedSize; + label4.Show(); + label4.Resize(size.Width, size.Height); + + Label label5 = new Label(window); + label5.Move(0, label4.Geometry.Y + size.Height + 10); + label5.Text = "[top gyp]"; + label5.Resize(650, 0); + size = label5.EdjeObject["elm.text"].TextBlockFormattedSize; + label5.Show(); + label5.Resize(size.Width, size.Height); + } + + } +} diff --git a/test/ElmSharp.Test/TC/Wearable/LabelTest3.cs b/test/ElmSharp.Test/TC/Wearable/LabelTest3.cs new file mode 100644 index 0000000..666b996 --- /dev/null +++ b/test/ElmSharp.Test/TC/Wearable/LabelTest3.cs @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace ElmSharp.Test.Wearable +{ + public class LabelTest3 : WearableTestCase + { + public override string TestName => "LabelTest3"; + public override string TestDescription => "To test basic operation of Label"; + + public override void Run(Window window) + { + Background bg = new Background(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Color = Color.White + }; + bg.Show(); + window.AddResizeObject(bg); + + Conformant conformant = new Conformant(window); + conformant.Show(); + Scroller scroller = new Scroller(window); + scroller.Show(); + conformant.SetContent(scroller); + Box box = new Box(window); + box.SetLayoutCallback(() => { }); + box.Show(); + scroller.SetContent(box); + + Size size; + + Label label1 = new Label(window); + box.PackEnd(label1); + Label label2 = new Label(window); + box.PackEnd(label2); + + + label1.Text = "Jo Ann Buckner"; + label1.TextStyle = "DEFAULT='color=#000000FF font_size=24 align=left valign=bottom wrap=word'"; + label1.Show(); + label1.Resize(100000, 0); + size = label1.EdjeObject["elm.text"].TextBlockFormattedSize; + label1.Geometry = new Rect(55, 213, size.Width, size.Height); + + label2.Text = "Customer Success Engineer"; + label2.TextStyle = "DEFAULT='color=#000000FF font_size=16 align=left valign=bottom wrap=word'"; + label2.Show(); + + label2.Resize(100000, 0); + size = label2.EdjeObject["elm.text"].TextBlockFormattedSize; + label2.Geometry = new Rect(55, 300, size.Width, size.Height); + + + } + } +} diff --git a/test/ElmSharp.Test/TC/Wearable/LabelTest4.cs b/test/ElmSharp.Test/TC/Wearable/LabelTest4.cs new file mode 100644 index 0000000..503b981 --- /dev/null +++ b/test/ElmSharp.Test/TC/Wearable/LabelTest4.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace ElmSharp.Test.Wearable +{ + public class LabelTest4 : WearableTestCase + { + public override string TestName => "LabelTest4"; + public override string TestDescription => "To test slide Animation of Label"; + + public override void Run(Window window) + { + Background bg = new Background(window); + bg.Color = Color.White; + bg.Move(0, 0); + bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + bg.Show(); + + Label label1 = new Label(window) + { + Style = "slide_long", + SlideDuration = 3, + SlideMode = LabelSlideMode.Always, + Color = Color.Black, + Text = "Lab test12345678" + }; + + label1.Show(); + int width = 200; + int height = 30; + label1.Resize(width, height); + label1.Move(window.ScreenSize.Width/2 - width/2, window.ScreenSize.Height/2 - height/2); + label1.PlaySlide(); + } + } +} diff --git a/test/ElmSharp.Test/TC/Wearable/LabelTest5.cs b/test/ElmSharp.Test/TC/Wearable/LabelTest5.cs new file mode 100644 index 0000000..432a5ff --- /dev/null +++ b/test/ElmSharp.Test/TC/Wearable/LabelTest5.cs @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace ElmSharp.Test.Wearable +{ + public class LabelTest5 : WearableTestCase + { + public override string TestName => "LabelTest5"; + public override string TestDescription => "To test Slide Animation Speed of Label"; + + public override void Run(Window window) + { + Rect square = window.GetInnerSquare(); + + Background bg = new Background(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Color = Color.White + }; + bg.Geometry = square; + bg.Show(); + + Rect pieces = square; + pieces.Height /= 4; + + Label label1 = new Label(window) + { + Text = "Test Slide Animaiton", + Color = Color.Black, + Style = "slide_long", + SlideSpeed = 100, + SlideMode = LabelSlideMode.Always, + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1 + }; + + Button btnCurrentSpeed = new Button(window) + { + Text = "Current Speed : 100", + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + }; + + Button btnSpeedUp = new Button(window) + { + Text = "Speed + 10", + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + }; + btnSpeedUp.Clicked += (s, e) => + { + label1.SlideSpeed += 10; + btnCurrentSpeed.Text = string.Format("Current Speed : {0}", label1.SlideSpeed); + label1.PlaySlide(); + }; + Button btnSpeedDown = new Button(window) + { + Text = "Speed - 10", + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + }; + btnSpeedDown.Clicked += (s, e) => + { + label1.SlideSpeed -= 10; + btnCurrentSpeed.Text = string.Format("Current Speed : {0}", label1.SlideSpeed); + label1.PlaySlide(); + }; + + label1.Geometry = new Rect(pieces.X, pieces.Y, pieces.Width, pieces.Height); + label1.Show(); + label1.PlaySlide(); + + btnCurrentSpeed.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height, pieces.Width, pieces.Height); + btnCurrentSpeed.Show(); + + btnSpeedUp.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height*2, pieces.Width, pieces.Height); + btnSpeedUp.Show(); + + btnSpeedDown.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height*3, pieces.Width, pieces.Height); + btnSpeedDown.Show(); + } + } +} diff --git a/test/ElmSharp.Test/TC/Wearable/LabelValignTest1.cs b/test/ElmSharp.Test/TC/Wearable/LabelValignTest1.cs new file mode 100644 index 0000000..622d4c3 --- /dev/null +++ b/test/ElmSharp.Test/TC/Wearable/LabelValignTest1.cs @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace ElmSharp.Test.Wearable +{ + public class LabelValignTest1 : WearableTestCase + { + public override string TestName => "LabelValignTest1"; + public override string TestDescription => "To test Vertical align of Label"; + + public override void Run(Window window) + { + Rect square = window.GetInnerSquare(); + + Background bg = new Background(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Color = Color.White + }; + bg.Geometry = square; + bg.Show(); + + Rect pieces = square; + pieces.Height /= 4; + + Label label1 = new Label(window) + { + Text = "Align Test", + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1 + }; + label1.TextStyle = "DEFAULT = 'color=#000000FF font_size=30 align=center wrap=word'"; + label1.Geometry = new Rect(pieces.X, pieces.Y, pieces.Width, pieces.Height); + label1.Show(); + + Button top = new Button(window) + { + Text = "Top", + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + }; + + Button middle = new Button(window) + { + Text = "Middle", + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + }; + Button bottom = new Button(window) + { + Text = "bottom", + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + }; + + top.Clicked += (s, e) => + { + label1.SetVerticalTextAlignment("elm.text", 0); + }; + + middle.Clicked += (s, e) => + { + label1.SetVerticalTextAlignment("elm.text", 0.5); + }; + + bottom.Clicked += (s, e) => + { + label1.SetVerticalTextAlignment("elm.text", 1.0); + }; + + top.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height, pieces.Width, pieces.Height); + top.Show(); + + middle.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height*2, pieces.Width, pieces.Height); + middle.Show(); + + bottom.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height*3, pieces.Width, pieces.Height); + bottom.Show(); + } + } +} diff --git a/test/ElmSharp.Test/TC/Wearable/TableTest1.cs b/test/ElmSharp.Test/TC/Wearable/TableTest1.cs new file mode 100644 index 0000000..ce31133 --- /dev/null +++ b/test/ElmSharp.Test/TC/Wearable/TableTest1.cs @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Test.Wearable +{ + public class TableTest1 : WearableTestCase + { + public override string TestName => "TableTest1"; + public override string TestDescription => "To test basic operation of Table"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + Table table = new Table(window) { + PaddingX = 10, + PaddingY = 10 + }; + // table.BackgroundColor = Color.Orange; + conformant.SetContent(table); + table.Show(); + + Button button1 = new Button(window) { + Text = "Button (set Color.Oranage)", + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1 + }; + button1.Clicked += (e,o) => + { + table.BackgroundColor = Color.Orange; + Console.WriteLine("{0} Clicked! - Button's BG Color : {1}, Table's BG Color : {2}", ((Button)e).Text, ((Button)e).BackgroundColor, table.BackgroundColor); + }; + + Button button2 = new Button(window) { + Text = "Button 2 (set Color.Defalut)", + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + BackgroundColor = new Color(50, 100, 200, 75) + }; + button2.Clicked += (e, o) => + { + table.BackgroundColor = Color.Default; + Console.WriteLine("{0} Clicked! - Button's BG Color : {1}, Table's BG Color : {2}", ((Button)e).Text, ((Button)e).BackgroundColor, table.BackgroundColor); + }; + + table.Pack(button1,0,0,3,3); + table.Pack(button2,3,1,1,1); + + button1.Show(); + button2.Show(); + } + } +} -- 2.7.4