From: Jeonghyun Yun Date: Wed, 10 Apr 2019 03:55:18 +0000 (+0900) Subject: [ElmSharp][Non-ACR] Added Panel Scrolled event TC X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea108ddfded4d06b1b98ae27cc212084f2f3183c;p=test%2Ftct%2Fcsharp%2Fapi.git [ElmSharp][Non-ACR] Added Panel Scrolled event TC Change-Id: I13c179acb0c7c9fa20b1549b76c5b86af6682e81 --- diff --git a/tct-suite-vs/Tizen.ElmSharp.Manual.Tests/testcase/TSPanel.cs b/tct-suite-vs/Tizen.ElmSharp.Manual.Tests/testcase/TSPanel.cs new file mode 100644 index 0000000..ac853cf --- /dev/null +++ b/tct-suite-vs/Tizen.ElmSharp.Manual.Tests/testcase/TSPanel.cs @@ -0,0 +1,130 @@ +/* + * 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; +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using ElmSharp; +using ElmSharpApplication.Tizen; + +namespace ElmSharp.Tests +{ + [TestFixture] + [Description("Testing ElmSharp.Panel class")] + public class PanelTests + { + private TestPage _testPage = TestPage.GetInstance(); + private Box _box; + private Panel _panel; + private Rectangle _rect; + private Window _window = MainWindow.GetInstance(); + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + if (_rect != null) + { + _rect.Unrealize(); + _rect = null; + } + if (_panel != null) + { + _panel.Unrealize(); + _panel = null; + } + if (_box != null) + { + _box.Unrealize(); + _box = null; + } + } + + private void CreatePanel() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "CreatePanel"); + _box = new Box(_window); + _box.Show(); + + _panel = new Panel(_window) + { + Direction = PanelDirection.Left, + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + }; + + _panel.SetScrollable(true); + _panel.SetScrollableArea(0.8); + + _rect = new Rectangle(_window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Color = Color.Red, + }; + _rect.Show(); + _panel.SetContent(_rect); + _panel.Show(); + _panel.IsOpen = true; + _box.PackEnd(_panel); + } + + private void Confirm(object sender, EventArgs e) + { + ManualTest.Confirm(); + } + + [Test] + [Category("P1")] + [Description("Test: Handle event Scrolled.")] + [Property("SPEC", "ElmSharp.Panel.Scrolled E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Jeonghyun Yun, jh0506.yun@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "Scroll red box to left")] + [Step(3, "Testcase result will be shown automatically")] + [Postcondition(1, "NA")] + public async Task Scrolled_CB() + { + CreatePanel(); + + _testPage.ExecuteTCByPage(_box); + + _panel.Scrolled += Confirm; + + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + + var niviframe = _testPage.getNavigationPage(); + if (niviframe != null) + niviframe.Pop(); + _panel.Scrolled -= Confirm; + } + } +}