Add test scenario for checking Toolbar operation 65/135265/3
authorrina6350.you <rina6350.you@samsung.com>
Wed, 21 Jun 2017 11:01:06 +0000 (20:01 +0900)
committerrina6350.you <rina6350.you@samsung.com>
Thu, 22 Jun 2017 11:14:38 +0000 (20:14 +0900)
change-Id: Ibb0a1fc23b36bf5646dc70f26be702fa261837fa

ElmSharp.Test/TC/ToolbarTest2.cs

index 8e19d1d..07780fb 100755 (executable)
@@ -30,7 +30,7 @@ namespace ElmSharp.Test
         {
             Conformant conformant = new Conformant(window);
             conformant.Show();
-            Box outterBox = new Box(window)
+            Box outerBox = new Box(window)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
@@ -39,20 +39,18 @@ namespace ElmSharp.Test
                 IsHorizontal = false,
                 BackgroundColor = Color.Aqua,
             };
-            outterBox.Show();
+            outerBox.Show();
 
             Toolbar toolbar = new Toolbar(window)
             {
                 AlignmentX = -1,
                 WeightX = 1,
             };
-
             toolbar.Show();
-            outterBox.PackEnd(toolbar);
+            outerBox.PackEnd(toolbar);
 
-            int idx = 1;
-            ToolbarItem item = toolbar.Append(string.Format("{0} home", idx), "home");
-            idx++;
+            List<ToolbarItem> items = new List<ToolbarItem>();
+            items.Add(toolbar.Append(string.Format("{0} home", items.Count), "home"));
 
             Button bt = new Button(window)
             {
@@ -61,13 +59,29 @@ namespace ElmSharp.Test
             };
             bt.Clicked += (s, e) =>
             {
-                ToolbarItem item2 = toolbar.Append(string.Format("{0} home", idx), "home");
-                idx++;
+                items.Add(toolbar.Append(string.Format("{0} home", items.Count), "home"));
+            };
+
+            Button removebt = new Button(window)
+            {
+                Text = "Remove first ToolbarItem",
+                MinimumWidth = 400
+            };
+            removebt.Clicked += (s, e) =>
+            {
+                foreach (var cur in items)
+                {
+                    items.Remove(cur);
+                    cur.Delete();
+                    return;
+                }
             };
 
             bt.Show();
-            outterBox.PackEnd(bt);
-            conformant.SetContent(outterBox);
+            removebt.Show();
+            outerBox.PackEnd(bt);
+            outerBox.PackEnd(removebt);
+            conformant.SetContent(outerBox);
         }
     }
 }