From: Haesu Gwon Date: Tue, 28 Jul 2020 09:29:59 +0000 (+0900) Subject: [Multimedia.UI][Non-ACR] Create new Multimedia.UI.Tests for TCs using UI component X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=427cc7249fd6aa1b597940e5a8452ecdba977518;p=test%2Ftct%2Fcsharp%2Fapi.git [Multimedia.UI][Non-ACR] Create new Multimedia.UI.Tests for TCs using UI component The Multimedia TCs related UI component should be seperated from Non-UI TCs for tizeniot service type tc app. Change-Id: I1b642651ae5fb5481052b9a9bd01e54509f3a772 --- diff --git a/tct-suite-vs/Tizen.Camera.Tests/testcase/TSCamera.cs b/tct-suite-vs/Tizen.Camera.Tests/testcase/TSCamera.cs index 56fd8814e..325e2b364 100644 --- a/tct-suite-vs/Tizen.Camera.Tests/testcase/TSCamera.cs +++ b/tct-suite-vs/Tizen.Camera.Tests/testcase/TSCamera.cs @@ -406,33 +406,6 @@ namespace Tizen.Multimedia.Tests Assert.IsTrue(TestCamera.DisplayReuseHint, "display reuse hint is not same as set value."); } - [Test] - [Category("P1")] - [Description("Test Display property of the camera.")] - [Property("SPEC", "Tizen.Multimedia.Camera.Display A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] - public void Display_PROPERTY_READ_ONLY() - { - /* TESTCODE - * Test Surface Display Type. - * Overlay type is tested always in TestBase.SetUpBase() - */ - try - { - TestCamera.Display = new Display(new MediaView(CreateWindow())); - } - catch (NotSupportedException) - { - Assert.Pass("EVAS surface display type is not supported."); - } - catch - { - Assert.Fail("Set display for surface type is failed."); - } - } - [Test] [Category("P1")] [Description("Test Setting property of the camera.")] diff --git a/tct-suite-vs/Tizen.Camera.Tests/testcase/support/TestBase.cs b/tct-suite-vs/Tizen.Camera.Tests/testcase/support/TestBase.cs old mode 100755 new mode 100644 index 714ad272a..a970916d6 --- a/tct-suite-vs/Tizen.Camera.Tests/testcase/support/TestBase.cs +++ b/tct-suite-vs/Tizen.Camera.Tests/testcase/support/TestBase.cs @@ -1,4 +1,3 @@ -using ElmSharp; using NUnit.Framework; using System; using System.Linq; @@ -20,20 +19,6 @@ public class TestBase { Assert.Pass("Camera feature is not supported."); } - - /// Default test window type is overlay. - try - { - TestCamera.Display = new Display(CreateWindow()); - } - catch (NotSupportedException) - { - Assert.Pass("Overlay display type is not supported."); - } - catch - { - Assert.Fail("Set display for overlay type is failed."); - } } [TearDown] @@ -59,16 +44,4 @@ public class TestBase { return FeatureChecker.IsSupported(Features.SecondaryCamera); } - - internal static Window CreateWindow() - { - var w = new Window(""); - w.Resize(100, 100); - w.Realize(null); - return w; - } - - public static Display CameraOverlayDisplay = new Display(CreateWindow()); - - public static Display CameraSurfaceDisplay = new Display(new MediaView(CreateWindow())); } diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAdaptiveVariants.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAdaptiveVariants.cs old mode 100755 new mode 100644 index a05ddd122..0f759712b --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAdaptiveVariants.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAdaptiveVariants.cs @@ -113,30 +113,6 @@ namespace Tizen.Multimedia.Tests Throws.TypeOf()); } - [Test] - [Category("P1")] - [Description("Test AdaptiveVariants supported property. Supported list should be greater than 0")] - [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.AvailableAdaptiveVariants A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] - public async Task AvailableAdaptiveVariants_PROPERTY_READ_ONLY() - { - try - { - var player = await GetPreparedPlayer(_adaptiveStreamingSource, DefaultDisplay); - IList result = player.AdaptiveVariants.AvailableAdaptiveVariants.ToList(); - Assert.IsNotNull(result, "The list of adaptive variants should not be null."); - Assert.IsNotEmpty(result, "The list of adaptive variants should not be empty."); - Assert.Greater(result.Count, 0, "The list of adaptive variants should be greater than 0"); - } - catch (Exception) - { - NetworkConncetion.Check(); - throw; - } - } - [Test] [Category("P2")] [Description("Any attempt to access the AvailableAdaptiveVariants if the player has been disposed of")] diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSMediaStreamConfiguration.Assigned.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSMediaStreamConfiguration.Assigned.cs old mode 100755 new mode 100644 index 6b49001eb..215ab2621 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSMediaStreamConfiguration.Assigned.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSMediaStreamConfiguration.Assigned.cs @@ -75,59 +75,5 @@ namespace Tizen.Multimedia.Tests { Assert.That(() => _configuration.BufferMinThreshold = 101U, Throws.TypeOf()); } - - [Test] - [Category("P1")] - [Description("BufferStatusChanged test")] - [Property("SPEC", "Tizen.Multimedia.MediaStreamConfiguration.BufferStatusChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public async Task BufferStatusChanged_CHECK() - { - await GetPreparedPlayer(_streamSource, DefaultDisplay); - - using (var eventAwaiter = EventAwaiter.Create()) - { - _configuration.BufferMinThreshold = 10U; - _configuration.BufferStatusChanged += eventAwaiter; - new VideoDecoderParser(Constants.PushFilePath).Feed((packet) => - { - _streamSource.Push(packet); - packet.Dispose(); - }); - - var args = await eventAwaiter.GetResultAsync(); - - Assert.That(args.Status, Is.EqualTo(MediaStreamBufferStatus.Underrun)); - } - } - - [Test] - [Category("P1")] - [Description("SeekingOccurred test")] - [Property("SPEC", "Tizen.Multimedia.MediaStreamConfiguration.SeekingOccurred E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public async Task SeekingOccurred_CHECK() - { - var player = await GetPreparedPlayer(_streamSource, DefaultDisplay); - - using (var eventAwaiter = EventAwaiter.Create()) - { - _configuration.SeekingOccurred += eventAwaiter; - - new VideoDecoderParser(Constants.PushFilePath).Feed((packet) => - { - _streamSource.Push(packet); - packet.Dispose(); - }); - - await player.SetPlayPositionAsync(40000, true); - - Assert.That(await eventAwaiter.IsRaisedAsync()); - } - } } } diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSMediaStreamSource.WithPlayer.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSMediaStreamSource.WithPlayer.cs old mode 100755 new mode 100644 index 9aed7b3c7..5d008ffd7 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSMediaStreamSource.WithPlayer.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSMediaStreamSource.WithPlayer.cs @@ -80,23 +80,6 @@ namespace Tizen.Multimedia.Tests } } - [Test] - [Category("P2")] - [Description("Push throws if a audio packet is passed to a video source")] - [Property("SPEC", "Tizen.Multimedia.MediaStreamSource.Push M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MEX")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public async Task Push_THROWS_IF_PACKET_NOT_ACCEPTABLE_VIDEO() - { - var player = await GetPreparedPlayer(_videoSource, DefaultDisplay); - - using (var audioPacket = MediaPacket.Create(AacAudioFormat)) - { - Assert.That(() => _videoSource.Push(audioPacket), Throws.ArgumentException); - } - } - [Test] [Category("P2")] [Description("Push throws if the player is in the idle state")] diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs old mode 100755 new mode 100644 index 6768ada32..c949c281d --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs @@ -557,43 +557,6 @@ namespace Tizen.Multimedia.Tests } #endregion - #region AudioOnly - - [Test] - [Category("P1")] - [Description("Default IsAudioOnly value is false")] - [Property("SPEC", "Tizen.Multimedia.Player.IsAudioOnly A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PDV")] - [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] - public async Task IsAudioOnly_DEFAULT() - { - var player = await GetPreparedPlayer( - new MediaUriSource(Constants.VideoFilePath), DefaultDisplay); - - Assert.That(player.IsAudioOnly, Is.False); - - } - - [Test] - [Category("P1")] - [Description("check whether IsAudioOnly is readable and writable")] - [Property("SPEC", "Tizen.Multimedia.Player.IsAudioOnly A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] - public async Task IsAudioOnly_SET_GET() - { - var player = await GetPreparedPlayer( - new MediaUriSource(Constants.VideoFilePath), DefaultDisplay); - - const bool newValue = true; - - player.IsAudioOnly = newValue; - Assert.That(player.IsAudioOnly, Is.EqualTo(newValue)); - } - - #endregion #region AudioLatencyMode @@ -1519,35 +1482,6 @@ namespace Tizen.Multimedia.Tests Assert.That(() => player.Display = null, Throws.InvalidOperationException); } - [Test] - [Category("P2")] - [Description("Display can't be assigned to multiple players")] - [Property("SPEC", "Tizen.Multimedia.Player.Display A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PEX")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public void Display_THROWS_IF_SET_TO_MULTIPLE() - { - using (Player p = new Player()) - { - TestPlayer.Display = DefaultDisplay; - - Assert.That(() => p.Display = DefaultDisplay, Throws.ArgumentException); - } - } - - [Test] - [Category("P1")] - [Description("Display set test")] - [Property("SPEC", "Tizen.Multimedia.Player.Display A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PCST")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public void Display_SET_CHECK() - { - Assert.That(() => TestPlayer.Display = DefaultDisplay, Throws.Nothing); - } - [Test] [Category("P1")] [Description("Is always not null")] @@ -2138,66 +2072,6 @@ namespace Tizen.Multimedia.Tests } #endregion - #region VideoStreamChanged - - [Test] - [Category("P1")] - [Description("VideoStreamChanged test")] - [Property("SPEC", "Tizen.Multimedia.Player.VideoStreamChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public async Task VideoStreamChanged_CHECK() - { - using (var eventAwaiter = EventAwaiter.Create()) - { - var player = await GetPreparedPlayer( - new MediaUriSource(Constants.StreamChangedTestFilePath), DefaultDisplay); - - player.VideoStreamChanged += eventAwaiter; - - player.Start(); - - await player.SetPlayPositionAsync(4500, true); - - Assert.That(await eventAwaiter.IsRaisedAsync(), "Event wasn't raised."); - } - } - - #endregion - - #region PlaybackInterrupted - - [Test] - [Category("P1")] - [Description("PlaybackInterrupted test")] - [Property("SPEC", "Tizen.Multimedia.Player.PlaybackInterrupted E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public async Task PlaybackInterrupted_CHECK() - { - var source = Constants.VideoFileSource; - - using (var eventWaiter = EventAwaiter.Create()) - { - var player = await GetPreparedPlayer( - new MediaUriSource(Constants.StreamChangedTestFilePath), DefaultDisplay); - - player.PlaybackInterrupted += eventWaiter; - - using (Player secondPlayer = new Player()) - { - secondPlayer.SetSource(source); - secondPlayer.Display = new Display(CreateWindow()); - await secondPlayer.PrepareAsync(); - } - Assert.That(await eventWaiter.IsRaisedAsync()); - } - } - - #endregion - #region ErrorOccurred [Test] @@ -2255,26 +2129,6 @@ namespace Tizen.Multimedia.Tests #endregion #region VideoRoi - [Test] - [Category("P1")] - [Description("SetVideoRoi default test")] - [Property("SPEC", "Tizen.Multimedia.Player.SetVideoRoi M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MCST")] - [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] - public void SetVideoRoi_DEFAULT() - { - Player player = new Player(); - player.SetSource(Constants.VideoFileSource); - player.Display = new Display(CreateWindow()); - - ScaleRectangle sr = new ScaleRectangle(0.19, 0.98765, 1.0, 0.21548); - - Assert.That(() => player.SetVideoRoi(sr), Throws.Nothing); - Assert.That(player.GetVideoRoi(), Is.EqualTo(sr), "Invalid value."); - player.Dispose(); - } - [Test] [Category("P2")] [Description("Any attempt to call the SetVideoRoi if the player has been disposed of")] @@ -2290,27 +2144,6 @@ namespace Tizen.Multimedia.Tests Throws.TypeOf()); } - [Test] - [Category("P2")] - [Description("SetVideoRoi throws exceptions if out of range")] - [Property("SPEC", "Tizen.Multimedia.Player.SetVideoRoi M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MEX")] - [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] - public void SetVideoRoi_OUT_OF_RANGE() - { - Player player = new Player(); - player.SetSource(Constants.VideoFileSource); - player.Display = new Display(CreateWindow()); - - Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0, 0, 0, 0)), Throws.TypeOf()); - Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.1, 0.1, 0.18, 4)), Throws.TypeOf()); - Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.99, -0.1, 1, 1)), Throws.TypeOf()); - Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.1, 0.1, 1.1, 1)), Throws.TypeOf()); - Assert.That(() => player.SetVideoRoi(new ScaleRectangle(-3, 0.1, 1, 1)), Throws.TypeOf()); - player.Dispose(); - } - [Test] [Category("P2")] [Description("SetVideoRoi throws if display has wrong type")] diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSSphericalVideo.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSSphericalVideo.cs old mode 100755 new mode 100644 index 6c89edd3f..8ce514f81 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSSphericalVideo.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSSphericalVideo.cs @@ -1,4 +1,4 @@ -using NUnit.Framework; +using NUnit.Framework; using System; using System.IO; using System.Threading.Tasks; @@ -28,71 +28,6 @@ namespace Tizen.Multimedia.Tests public const int VerticalDegrees = 67; } - protected async Task GetSphericalVideo() - { - return (await GetPlayingPlayer(Constants.SphericalVideoSource, DefaultDisplay)).SphericalVideo; - } - - [Test] - [Category("P1")] - [Description("Player always not null")] - [Property("SPEC", "Tizen.Multimedia.SphericalVideo.Player A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PDV")] - [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] - public async Task Player_CHECK() - { - Assert.That((await GetSphericalVideo()).Player, Is.Not.Null); - } - - [Test] - [Category("P1")] - [Description("Check whether IsEnabled is readable and writable")] - [Property("SPEC", "Tizen.Multimedia.SphericalVideo.IsEnabled A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] - public async Task IsEnabled_SET_GET() - { - var player = await GetPreparedPlayer( - new MediaUriSource(Constants.SphericalVideoPath), DefaultDisplay); - - const bool newValue = true; - - player.SphericalVideo.IsEnabled = newValue; - Assert.That(player.SphericalVideo.IsEnabled, Is.EqualTo(newValue), "Invalid value"); - } - - [Test] - [Category("P1")] - [Description("IsSphericalContent throws if the video is spherical content")] - [Property("SPEC", "Tizen.Multimedia.SphericalVideo.IsSphericalContent M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] - public async Task IsSphericalContent_TRUE() - { - var player = await GetPreparedPlayer( - new MediaUriSource(Constants.SphericalVideoPath), DefaultDisplay); - - Assert.That(player.SphericalVideo.IsSphericalContent(), Is.True, "Invalid value"); - } - - [Test] - [Category("P1")] - [Description("IsSphericalContent throws if the video is not spherical content")] - [Property("SPEC", "Tizen.Multimedia.SphericalVideo.IsSphericalContent M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] - public async Task IsSphericalContent_FALSE() - { - var player = await GetPreparedPlayer( - new MediaUriSource(Constants.VideoFilePath), DefaultDisplay); - - Assert.That(player.SphericalVideo.IsSphericalContent(), Is.False, "Invalid value"); - } - [Test] [Category("P1")] [Description("Check default value of DirectionOfView")] diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSStreamInfo.Video.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSStreamInfo.Video.cs deleted file mode 100755 index 9abb24b99..000000000 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSStreamInfo.Video.cs +++ /dev/null @@ -1,91 +0,0 @@ -using NUnit.Framework; -using System; -using System.Threading.Tasks; - -namespace Tizen.Multimedia.Tests -{ - [TestFixture] - [Description("Tizen.Multimedia.StreamInfo tests")] - public class StreamInfoVideoTests : TestBase - { - private class ExpectedValues - { - public const string CodecName = "MPEG-4 Video (Simple Profile) (MPEG4)"; - public const int BitRate = 961168; - public const int Fps = 30; - public const int Width = 320; - public const int Height = 240; - } - - protected async Task GetVideoStreamInfo() - { - return (await GetPlayingPlayer(Constants.VideoFileSource, DefaultDisplay)).StreamInfo; - } - - [Test] - [Category("P1")] - [Description("VideoCodec codec name test")] - [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetVideoCodec M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public async Task GetVideoCodec_CHECK_RETURN() - { - var streamInfo = await GetVideoStreamInfo(); - - Assert.That( - ExpectedValues.CodecName.IndexOf(streamInfo.GetVideoCodec(), StringComparison.OrdinalIgnoreCase) >= 0, - $"Codec does not match : {streamInfo.GetVideoCodec()}"); - } - - [Test] - [Category("P1")] - [Description("VideoStreamProperties returns video stream info")] - [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetVideoProperties M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public async Task GetVideoProperties_CHECK_RETURN() - { - var videoStreamProp = (await GetVideoStreamInfo()).GetVideoProperties(); - - Assert.That(videoStreamProp.BitRate, Is.EqualTo(ExpectedValues.BitRate), - "Incorrect bit rate."); - - Assert.That(videoStreamProp.Fps, Is.EqualTo(ExpectedValues.Fps), - "Incorrect fps."); - - Assert.That(videoStreamProp.Size.Width, Is.EqualTo(ExpectedValues.Width), - "Incorrect width."); - - Assert.That(videoStreamProp.Size.Height, Is.EqualTo(ExpectedValues.Height), - "Incorrect height."); - } - - [Test] - [Category("P1")] - [Description("GetMetadata check")] - [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetMetadata M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public async Task GetMetadata_CHECK() - { - var streamInfo = await GetVideoStreamInfo(); - - Assert.That(streamInfo.GetMetadata(StreamMetadataKey.Title), Is.Not.Null); - } - - [Test] - [Category("P1")] - [Description("Player always not null")] - [Property("SPEC", "Tizen.Multimedia.StreamInfo.Player A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PDV")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public async Task Player_CHECK() - { - Assert.That((await GetVideoStreamInfo()).Player, Is.Not.Null); - } - } -} diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/support/TestBase.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/support/TestBase.cs old mode 100755 new mode 100644 index ffaf17071..03b2f9f5e --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/support/TestBase.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/support/TestBase.cs @@ -1,4 +1,4 @@ -using ElmSharp; +using ElmSharp; using NUnit.Framework; using NUnit.Framework.TUnit; using System; @@ -87,14 +87,4 @@ public class TestBase return TestPlayer; } - - internal static Window CreateWindow() - { - var w = new Window(""); - w.Resize(100, 100); - w.Realize(null); - return w; - } - - public static Display DefaultDisplay = new Display(CreateWindow()); } diff --git a/tct-suite-vs/Tizen.Multimedia.Tests/testcase/Common/TSDisplay.cs b/tct-suite-vs/Tizen.Multimedia.Tests/testcase/Common/TSDisplay.cs deleted file mode 100644 index 0877a22c6..000000000 --- a/tct-suite-vs/Tizen.Multimedia.Tests/testcase/Common/TSDisplay.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2016 by Samsung Electronics, Inc., -// -// This software is the confidential and proprietary information -// of Samsung Electronics, Inc. ("Confidential Information"). You -// shall not disclose such Confidential Information and shall use -// it only in accordance with the terms of the license agreement -// you entered into with Samsung. - -using NUnit.Framework; -using System; - -namespace Tizen.Multimedia.Tests -{ - [TestFixture] - [Description("Tests Tizen.Multimedia.Display class")] - public class DisplayTests - { - private const string RawVideoFeature = "http://tizen.org/feature/multimedia.raw_video"; - - [Test] - [Category("P1")] - [Description("Construction with MediaView")] - [Property("SPEC", "Tizen.Multimedia.Display.Display C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("COVPARAM", "MediaView")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public void Display_WITH_MEDIA_VIEW() - { - try - { - new Display(new MediaView(new ElmSharp.Window("Test window"))); - } - catch (NotSupportedException e) - { - if (FeatureChecker.IsSupported(RawVideoFeature)) - { - Assert.Fail($"Invalid NotSupportedException; {e.Message}"); - } - } - } - - [Test] - [Category("P1")] - [Description("Construction with Window")] - [Property("SPEC", "Tizen.Multimedia.Display.Display C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("COVPARAM", "Window")] - [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public void Display_WITH_WINDOW() - { - Assert.That(() => new Display(new ElmSharp.Window("Test window")), Throws.Nothing); - } - } -} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/Program.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/Program.cs new file mode 100644 index 000000000..129489a65 --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/Program.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018 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 NUnitLite.TUnit; +using AutoTemplate; + +namespace XamarinForTizen.Tizen +{ + + class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication + { + private static App _app; + protected override void OnCreate() + { + base.OnCreate(); + + Console.WriteLine("TCT : OnCreate()"); + _app = new App(); + LoadApplication(_app); + + TRunner t = new TRunner(); + t.LoadTestsuite(); + t.Execute(); + } + + public static App getApp() + { + return _app; + } + static void Main(string[] args) + { + Console.WriteLine("TCT : Main()"); + var app = new Program(); + global::Xamarin.Forms.Forms.Init(app); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/Tizen.Multimedia.UI.Tests.csproj b/tct-suite-vs/Tizen.Multimedia.UI.Tests/Tizen.Multimedia.UI.Tests.csproj new file mode 100755 index 000000000..0a96067bd --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/Tizen.Multimedia.UI.Tests.csproj @@ -0,0 +1,41 @@ + + + + + Exe + tizen80 + Tizen + + + + + true + + + + portable + + + None + + + + + + + + + + + Runtime + + + + + + + + + + + diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/Tizen.Multimedia.UI.Tests.sln b/tct-suite-vs/Tizen.Multimedia.UI.Tests/Tizen.Multimedia.UI.Tests.sln new file mode 100755 index 000000000..d7b1efe7f --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/Tizen.Multimedia.UI.Tests.sln @@ -0,0 +1,92 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.15 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.UI.Tests", "Tizen.Multimedia.UI.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Support.Library", "..\Tizen.Multimedia.Support.Library\Tizen.Multimedia.Support.Library.csproj", "{612D4512-0652-41F2-A192-426C76BE99F1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Debug|x64.ActiveCfg = Debug|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Debug|x64.Build.0 = Debug|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Debug|x86.ActiveCfg = Debug|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Debug|x86.Build.0 = Debug|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Release|Any CPU.Build.0 = Release|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Release|x64.ActiveCfg = Release|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Release|x64.Build.0 = Release|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Release|x86.ActiveCfg = Release|Any CPU + {612D4512-0652-41F2-A192-426C76BE99F1}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test.h264 b/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test.h264 new file mode 100755 index 000000000..83016b9c1 Binary files /dev/null and b/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test.h264 differ diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test.mp3 b/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test.mp3 new file mode 100755 index 000000000..5fb75b15f Binary files /dev/null and b/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test.mp3 differ diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test_360.mp4 b/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test_360.mp4 new file mode 100755 index 000000000..294fe3270 Binary files /dev/null and b/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test_360.mp4 differ diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test_drc_640x480_320x240.ts b/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test_drc_640x480_320x240.ts new file mode 100755 index 000000000..633dd3293 Binary files /dev/null and b/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test_drc_640x480_320x240.ts differ diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test_meta.mp4 b/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test_meta.mp4 new file mode 100755 index 000000000..d6e105084 Binary files /dev/null and b/tct-suite-vs/Tizen.Multimedia.UI.Tests/res/test_meta.mp4 differ diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/shared/res/Tizen.Multimedia.UI.Tests.png b/tct-suite-vs/Tizen.Multimedia.UI.Tests/shared/res/Tizen.Multimedia.UI.Tests.png new file mode 100755 index 000000000..9765b1bda Binary files /dev/null and b/tct-suite-vs/Tizen.Multimedia.UI.Tests/shared/res/Tizen.Multimedia.UI.Tests.png differ diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/Camera/TSCamera.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/Camera/TSCamera.cs new file mode 100644 index 000000000..88eb763fa --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/Camera/TSCamera.cs @@ -0,0 +1,45 @@ +// Copyright 2020 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using NUnit.Framework; +using System; + +namespace Tizen.Multimedia.UI.Tests +{ + [TestFixture] + [Description("Tests Tizen.Multimedia.Camera class")] + public class CameraTests : CameraTestBase + { + [Test] + [Category("P1")] + [Description("Test Display property of the camera.")] + [Property("SPEC", "Tizen.Multimedia.Camera.Display A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void Display_PROPERTY_READ_ONLY() + { + /* TESTCODE + * Test Surface Display Type. + * Overlay type is tested always in TestBase.SetUpBase() + */ + try + { + TestCamera.Display = new Display(new MediaView(CreateWindow())); + } + catch (NotSupportedException) + { + Assert.Pass("EVAS surface display type is not supported."); + } + catch + { + Assert.Fail("Set display for surface type is failed."); + } + } + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSAdaptiveVariants.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSAdaptiveVariants.cs new file mode 100644 index 000000000..f8b1b559d --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSAdaptiveVariants.cs @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2020 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 NUnit.Framework; +using System.Threading.Tasks; +using System.Linq; +using System.Collections; +using System; + +namespace Tizen.Multimedia.UI.Tests +{ + [TestFixture] + [Description("Tizen.Multimedia.AdaptiveVariants Tests")] + public class AdaptiveVariantsTests : MediaPlayerTestBase + { + private MediaUriSource _adaptiveStreamingSource = null; + + [OneTimeSetUp] + public void Init() + { + if (MediaPlayerPreconditionUtils.ADAPTIVE_STREAMING_URI == null) + MediaPlayerPreconditionUtils.SetPrecondition(); + + _adaptiveStreamingSource = new MediaUriSource(MediaPlayerPreconditionUtils.ADAPTIVE_STREAMING_URI); + } + + [Test] + [Category("P1")] + [Description("Test AdaptiveVariants supported property. Supported list should be greater than 0")] + [Property("SPEC", "Tizen.Multimedia.AdaptiveVariants.AvailableAdaptiveVariants A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task AvailableAdaptiveVariants_PROPERTY_READ_ONLY() + { + try + { + var player = await GetPreparedPlayer(_adaptiveStreamingSource, DefaultDisplay); + IList result = player.AdaptiveVariants.AvailableAdaptiveVariants.ToList(); + Assert.IsNotNull(result, "The list of adaptive variants should not be null."); + Assert.IsNotEmpty(result, "The list of adaptive variants should not be empty."); + Assert.Greater(result.Count, 0, "The list of adaptive variants should be greater than 0"); + } + catch (Exception) + { + NetworkConncetion.Check(); + throw; + } + } + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSMediaPlayer.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSMediaPlayer.cs new file mode 100644 index 000000000..901cf6f11 --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSMediaPlayer.cs @@ -0,0 +1,195 @@ +/* +* Copyright (c) 2020 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 NUnit.Framework; +using System; +using System.Threading.Tasks; + +namespace Tizen.Multimedia.UI.Tests +{ +#pragma warning disable CS4014 + + [TestFixture] + [Description("Tizen.Multimedia.UI tests")] + public class PlayerTests : MediaPlayerTestBase + { + #region AudioOnly + [Test] + [Category("P1")] + [Description("Default IsAudioOnly value is false")] + [Property("SPEC", "Tizen.Multimedia.Player.IsAudioOnly A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task IsAudioOnly_DEFAULT() + { + var player = await GetPreparedPlayer( + new MediaUriSource(Constants.VideoFilePath), DefaultDisplay); + + Assert.That(player.IsAudioOnly, Is.False); + + } + + [Test] + [Category("P1")] + [Description("check whether IsAudioOnly is readable and writable")] + [Property("SPEC", "Tizen.Multimedia.Player.IsAudioOnly A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task IsAudioOnly_SET_GET() + { + var player = await GetPreparedPlayer( + new MediaUriSource(Constants.VideoFilePath), DefaultDisplay); + + const bool newValue = true; + + player.IsAudioOnly = newValue; + Assert.That(player.IsAudioOnly, Is.EqualTo(newValue)); + } + #endregion + + #region Display + [Test] + [Category("P2")] + [Description("Display can't be assigned to multiple players")] + [Property("SPEC", "Tizen.Multimedia.Player.Display A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public void Display_THROWS_IF_SET_TO_MULTIPLE() + { + using (Player p = new Player()) + { + TestPlayer.Display = DefaultDisplay; + + Assert.That(() => p.Display = DefaultDisplay, Throws.ArgumentException); + } + } + + [Test] + [Category("P1")] + [Description("Display set test")] + [Property("SPEC", "Tizen.Multimedia.Player.Display A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PCST")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public void Display_SET_CHECK() + { + Assert.That(() => TestPlayer.Display = DefaultDisplay, Throws.Nothing); + } + #endregion + + #region VideoStreamChanged + [Test] + [Category("P1")] + [Description("VideoStreamChanged test")] + [Property("SPEC", "Tizen.Multimedia.Player.VideoStreamChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public async Task VideoStreamChanged_CHECK() + { + using (var eventAwaiter = EventAwaiter.Create()) + { + var player = await GetPreparedPlayer( + new MediaUriSource(Constants.StreamChangedTestFilePath), DefaultDisplay); + + player.VideoStreamChanged += eventAwaiter; + + player.Start(); + + await player.SetPlayPositionAsync(4500, true); + + Assert.That(await eventAwaiter.IsRaisedAsync(), "Event wasn't raised."); + } + } + #endregion + + #region PlaybackInterrupted + [Test] + [Category("P1")] + [Description("PlaybackInterrupted test")] + [Property("SPEC", "Tizen.Multimedia.Player.PlaybackInterrupted E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public async Task PlaybackInterrupted_CHECK() + { + var source = Constants.VideoFileSource; + + using (var eventWaiter = EventAwaiter.Create()) + { + var player = await GetPreparedPlayer( + new MediaUriSource(Constants.StreamChangedTestFilePath), DefaultDisplay); + + player.PlaybackInterrupted += eventWaiter; + + using (Player secondPlayer = new Player()) + { + secondPlayer.SetSource(source); + secondPlayer.Display = new Display(CreateWindow()); + await secondPlayer.PrepareAsync(); + } + Assert.That(await eventWaiter.IsRaisedAsync()); + } + } + #endregion + + #region VideoRoi + [Test] + [Category("P1")] + [Description("SetVideoRoi default test")] + [Property("SPEC", "Tizen.Multimedia.Player.SetVideoRoi M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void SetVideoRoi_DEFAULT() + { + Player player = new Player(); + player.SetSource(Constants.VideoFileSource); + player.Display = new Display(CreateWindow()); + + ScaleRectangle sr = new ScaleRectangle(0.19, 0.98765, 1.0, 0.21548); + + Assert.That(() => player.SetVideoRoi(sr), Throws.Nothing); + Assert.That(player.GetVideoRoi(), Is.EqualTo(sr), "Invalid value."); + player.Dispose(); + } + + [Test] + [Category("P2")] + [Description("SetVideoRoi throws exceptions if out of range")] + [Property("SPEC", "Tizen.Multimedia.Player.SetVideoRoi M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void SetVideoRoi_OUT_OF_RANGE() + { + Player player = new Player(); + player.SetSource(Constants.VideoFileSource); + player.Display = new Display(CreateWindow()); + + Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0, 0, 0, 0)), Throws.TypeOf()); + Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.1, 0.1, 0.18, 4)), Throws.TypeOf()); + Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.99, -0.1, 1, 1)), Throws.TypeOf()); + Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.1, 0.1, 1.1, 1)), Throws.TypeOf()); + Assert.That(() => player.SetVideoRoi(new ScaleRectangle(-3, 0.1, 1, 1)), Throws.TypeOf()); + player.Dispose(); + } + #endregion + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSMediaStreamConfiguration.Assigned.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSMediaStreamConfiguration.Assigned.cs new file mode 100644 index 000000000..7ec66cdd4 --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSMediaStreamConfiguration.Assigned.cs @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2020 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 NUnit.Framework; +using System.Threading.Tasks; + +namespace Tizen.Multimedia.UI.Tests +{ + [TestFixture] + [Description("Tizen.Multimedia.MediaSteramConfiguration tests")] + public class MediaStreamConfigurationAssignedTests : MediaPlayerTestBase + { + private MediaStreamSource _streamSource; + private MediaStreamConfiguration _configuration; + + [SetUp] + public void SetUp() + { + _streamSource = new MediaStreamSource(VideoDecoderParser.Format); + _configuration = _streamSource.VideoConfiguration; + + GetIdlePlayer().SetSource(_streamSource); + } + + [Test] + [Category("P1")] + [Description("BufferStatusChanged test")] + [Property("SPEC", "Tizen.Multimedia.MediaStreamConfiguration.BufferStatusChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public async Task BufferStatusChanged_CHECK() + { + await GetPreparedPlayer(_streamSource, DefaultDisplay); + + using (var eventAwaiter = EventAwaiter.Create()) + { + _configuration.BufferMinThreshold = 10U; + _configuration.BufferStatusChanged += eventAwaiter; + new VideoDecoderParser(Constants.PushFilePath).Feed((packet) => + { + _streamSource.Push(packet); + packet.Dispose(); + }); + + var args = await eventAwaiter.GetResultAsync(); + + Assert.That(args.Status, Is.EqualTo(MediaStreamBufferStatus.Underrun)); + } + } + + [Test] + [Category("P1")] + [Description("SeekingOccurred test")] + [Property("SPEC", "Tizen.Multimedia.MediaStreamConfiguration.SeekingOccurred E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public async Task SeekingOccurred_CHECK() + { + var player = await GetPreparedPlayer(_streamSource, DefaultDisplay); + + using (var eventAwaiter = EventAwaiter.Create()) + { + _configuration.SeekingOccurred += eventAwaiter; + + new VideoDecoderParser(Constants.PushFilePath).Feed((packet) => + { + _streamSource.Push(packet); + packet.Dispose(); + }); + + await player.SetPlayPositionAsync(40000, true); + + Assert.That(await eventAwaiter.IsRaisedAsync()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSMediaStreamSource.WithPlayer.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSMediaStreamSource.WithPlayer.cs new file mode 100644 index 000000000..ef393b785 --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSMediaStreamSource.WithPlayer.cs @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2020 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 NUnit.Framework; +using System.Threading.Tasks; + +namespace Tizen.Multimedia.UI.Tests +{ + [TestFixture] + [Description("Tizen.Multimedia.MediaStreamSource Tests")] + public class MediaStreamSourceWithPlayerTests : MediaPlayerTestBase + { + private static readonly AudioMediaFormat AacAudioFormat = new AudioMediaFormat( + MediaFormatAudioMimeType.Aac, 2, 48000, 16, 128000); + + private MediaStreamSource _audioSource = new MediaStreamSource(AacAudioFormat); + private MediaStreamSource _videoSource = new MediaStreamSource(VideoDecoderParser.Format); + + [Test] + [Category("P2")] + [Description("Push throws if a audio packet is passed to a video source")] + [Property("SPEC", "Tizen.Multimedia.MediaStreamSource.Push M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public async Task Push_THROWS_IF_PACKET_NOT_ACCEPTABLE_VIDEO() + { + var player = await GetPreparedPlayer(_videoSource, DefaultDisplay); + + using (var audioPacket = MediaPacket.Create(AacAudioFormat)) + { + Assert.That(() => _videoSource.Push(audioPacket), Throws.ArgumentException); + } + } + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSSphericalVideo.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSSphericalVideo.cs new file mode 100644 index 000000000..664e4679b --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSSphericalVideo.cs @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2020 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 NUnit.Framework; +using System.Threading.Tasks; + +namespace Tizen.Multimedia.UI.Tests +{ + [TestFixture] + [Description("Tizen.Multimedia.SphericalVideo Tests")] + public class SphericalVideoTests : MediaPlayerTestBase + { + [SetUp] + public void SetUp() + { + if (FeatureChecker.IsSupported(Features.OpenGl) == false + || FeatureChecker.IsSupported(Features.SphericalVideo) == false) + { + Assert.Pass($"The feature is not supported."); + } + } + + private class DefaultValues + { + public const float Yaw = 0.0f; + public const float Pitch = 0.0f; + public const float level = 1.0f; + public const int HorizontalDegrees = 120; + public const int VerticalDegrees = 67; + } + + protected async Task GetSphericalVideo() + { + return (await GetPlayingPlayer(Constants.SphericalVideoSource, DefaultDisplay)).SphericalVideo; + } + + [Test] + [Category("P1")] + [Description("Player always not null")] + [Property("SPEC", "Tizen.Multimedia.SphericalVideo.Player A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task Player_CHECK() + { + Assert.That((await GetSphericalVideo()).Player, Is.Not.Null); + } + + [Test] + [Category("P1")] + [Description("Check whether IsEnabled is readable and writable")] + [Property("SPEC", "Tizen.Multimedia.SphericalVideo.IsEnabled A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task IsEnabled_SET_GET() + { + var player = await GetPreparedPlayer( + new MediaUriSource(Constants.SphericalVideoPath), DefaultDisplay); + + const bool newValue = true; + + player.SphericalVideo.IsEnabled = newValue; + Assert.That(player.SphericalVideo.IsEnabled, Is.EqualTo(newValue), "Invalid value"); + } + + [Test] + [Category("P1")] + [Description("IsSphericalContent throws if the video is spherical content")] + [Property("SPEC", "Tizen.Multimedia.SphericalVideo.IsSphericalContent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task IsSphericalContent_TRUE() + { + var player = await GetPreparedPlayer( + new MediaUriSource(Constants.SphericalVideoPath), DefaultDisplay); + + Assert.That(player.SphericalVideo.IsSphericalContent(), Is.True, "Invalid value"); + } + + [Test] + [Category("P1")] + [Description("IsSphericalContent throws if the video is not spherical content")] + [Property("SPEC", "Tizen.Multimedia.SphericalVideo.IsSphericalContent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task IsSphericalContent_FALSE() + { + var player = await GetPreparedPlayer( + new MediaUriSource(Constants.VideoFilePath), DefaultDisplay); + + Assert.That(player.SphericalVideo.IsSphericalContent(), Is.False, "Invalid value"); + } + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSStreamInfo.Video.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSStreamInfo.Video.cs new file mode 100644 index 000000000..fe284e770 --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/MediaPlayer/TSStreamInfo.Video.cs @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2020 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 NUnit.Framework; +using System; +using System.Threading.Tasks; + +namespace Tizen.Multimedia.UI.Tests +{ + [TestFixture] + [Description("Tizen.Multimedia.StreamInfo tests")] + public class StreamInfoVideoTests : MediaPlayerTestBase + { + private class ExpectedValues + { + public const string CodecName = "MPEG-4 Video (Simple Profile) (MPEG4)"; + public const int BitRate = 961168; + public const int Fps = 30; + public const int Width = 320; + public const int Height = 240; + } + + protected async Task GetVideoStreamInfo() + { + return (await GetPlayingPlayer(Constants.VideoFileSource, DefaultDisplay)).StreamInfo; + } + + [Test] + [Category("P1")] + [Description("VideoCodec codec name test")] + [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetVideoCodec M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public async Task GetVideoCodec_CHECK_RETURN() + { + var streamInfo = await GetVideoStreamInfo(); + + Assert.That( + ExpectedValues.CodecName.IndexOf(streamInfo.GetVideoCodec(), StringComparison.OrdinalIgnoreCase) >= 0, + $"Codec does not match : {streamInfo.GetVideoCodec()}"); + } + + [Test] + [Category("P1")] + [Description("VideoStreamProperties returns video stream info")] + [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetVideoProperties M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public async Task GetVideoProperties_CHECK_RETURN() + { + var videoStreamProp = (await GetVideoStreamInfo()).GetVideoProperties(); + + Assert.That(videoStreamProp.BitRate, Is.EqualTo(ExpectedValues.BitRate), + "Incorrect bit rate."); + + Assert.That(videoStreamProp.Fps, Is.EqualTo(ExpectedValues.Fps), + "Incorrect fps."); + + Assert.That(videoStreamProp.Size.Width, Is.EqualTo(ExpectedValues.Width), + "Incorrect width."); + + Assert.That(videoStreamProp.Size.Height, Is.EqualTo(ExpectedValues.Height), + "Incorrect height."); + } + + [Test] + [Category("P1")] + [Description("GetMetadata check")] + [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetMetadata M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public async Task GetMetadata_CHECK() + { + var streamInfo = await GetVideoStreamInfo(); + + Assert.That(streamInfo.GetMetadata(StreamMetadataKey.Title), Is.Not.Null); + } + + [Test] + [Category("P1")] + [Description("Player always not null")] + [Property("SPEC", "Tizen.Multimedia.StreamInfo.Player A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public async Task Player_CHECK() + { + Assert.That((await GetVideoStreamInfo()).Player, Is.Not.Null); + } + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/Multimedia/TSDisplay.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/Multimedia/TSDisplay.cs new file mode 100644 index 000000000..09b36dad0 --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/Multimedia/TSDisplay.cs @@ -0,0 +1,54 @@ +// Copyright 2020 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using NUnit.Framework; +using System; + +namespace Tizen.Multimedia.UI.Tests +{ + [TestFixture] + [Description("Tests Tizen.Multimedia.Display class")] + public class DisplayTests + { + [Test] + [Category("P1")] + [Description("Construction with MediaView")] + [Property("SPEC", "Tizen.Multimedia.Display.Display C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "MediaView")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public void Display_WITH_MEDIA_VIEW() + { + try + { + new Display(new MediaView(new ElmSharp.Window("Test window"))); + } + catch (NotSupportedException e) + { + if (FeatureChecker.IsSupported(Features.RawVideo)) + { + Assert.Fail($"Invalid NotSupportedException; {e.Message}"); + } + } + } + + [Test] + [Category("P1")] + [Description("Construction with Window")] + [Property("SPEC", "Tizen.Multimedia.Display.Display C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "Window")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public void Display_WITH_WINDOW() + { + Assert.That(() => new Display(new ElmSharp.Window("Test window")), Throws.Nothing); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/CameraTestBase.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/CameraTestBase.cs new file mode 100644 index 000000000..1a3d60702 --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/CameraTestBase.cs @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2020 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 ElmSharp; +using NUnit.Framework; +using System; +using System.Linq; + +namespace Tizen.Multimedia.UI.Tests +{ + public class CameraTestBase + { + public static Camera TestCamera { get; private set; } + + [SetUp] + public void SetUpBase() + { + try + { + TestCamera = new Camera(CameraDevice.Rear); + TestCamera.Settings.PreviewPixelFormat = TestCamera.Capabilities.SupportedPreviewPixelFormats.FirstOrDefault(); + } + catch (NotSupportedException) when (FeatureChecker.IsSupported(Features.PrimaryCamera) == false) + { + Assert.Pass("Camera feature is not supported."); + } + + /// Default test window type is overlay. + try + { + TestCamera.Display = new Display(CreateWindow()); + } + catch (NotSupportedException) + { + Assert.Pass("Overlay display type is not supported."); + } + catch + { + Assert.Fail("Set display for overlay type is failed."); + } + } + + [TearDown] + public void TearDownBase() + { + if (TestCamera != null) + { + if (TestCamera.State == CameraState.Captured) + { + TestCamera.StartPreview(); + TestCamera.StopPreview(); + } + else if (TestCamera.State == CameraState.Preview) + { + TestCamera.StopPreview(); + } + + TestCamera?.Dispose(); + } + } + + internal static bool IsSupportedSecondaryCamera() + { + return FeatureChecker.IsSupported(Features.SecondaryCamera); + } + + internal static Window CreateWindow() + { + var w = new Window(""); + w.Resize(100, 100); + w.Realize(null); + return w; + } + + public static Display CameraOverlayDisplay = new Display(CreateWindow()); + + public static Display CameraSurfaceDisplay = new Display(new MediaView(CreateWindow())); + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/Constants.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/Constants.cs new file mode 100644 index 000000000..8cd019bb3 --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/Constants.cs @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2020 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 Tizen.Multimedia.UI.Tests +{ + internal static class Constants + { + internal const int AudioLength = 33384; + + internal const string AudioFilePath = "/opt/usr/home/owner/share/res/test.mp3"; + internal const string PushFilePath = "/opt/usr/home/owner/share/res/test.h264"; // no pts + internal const string VideoFilePath = "/opt/usr/home/owner/share/res/test_meta.mp4"; + internal const string SphericalVideoPath = "/opt/usr/home/owner/share/res/test_360.mp4"; + + internal const string StreamChangedTestFilePath = "/opt/usr/home/owner/share/res/test_drc_640x480_320x240.ts"; + + internal static readonly MediaUriSource AudioFileSource = new MediaUriSource(AudioFilePath); + internal static readonly MediaUriSource VideoFileSource = new MediaUriSource(VideoFilePath); + internal static readonly MediaUriSource SphericalVideoSource = new MediaUriSource(SphericalVideoPath); + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/Features.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/Features.cs new file mode 100644 index 000000000..66a7588ce --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/Features.cs @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2020 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 Tizen.Multimedia.UI.Tests +{ + internal static class Features + { + internal const string PrimaryCamera = "http://tizen.org/feature/camera"; + internal const string SecondaryCamera = "http://tizen.org/feature/camera.front"; + internal const string RawVideo = "http://tizen.org/feature/multimedia.raw_video"; + + internal const string AudioEffect = "http://tizen.org/feature/multimedia.custom_audio_effect"; + internal const string StreamInfo = "http://tizen.org/feature/multimedia.player.stream_info"; + internal const string OpenGl = "http://tizen.org/feature/opengles.version.2_0"; + internal const string SphericalVideo = "http://tizen.org/feature/multimedia.player.spherical_video"; + internal const string AudioOffload = "http://tizen.org/feature/multimedia.player.audio_offload"; + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/MediaPlayerNetworkConnection.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/MediaPlayerNetworkConnection.cs new file mode 100644 index 000000000..e2f82e0b7 --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/MediaPlayerNetworkConnection.cs @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2020 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 NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.System; +using System; +using Tizen.Network.Connection; +using Tizen.Network.WiFi; + +namespace Tizen.Multimedia.UI.Tests +{ + internal static class NetworkConncetion + { + private static bool IsSupportable + { + get + { + Information.TryGetValue("http://tizen.org/feature/network.wifi", out bool isWiFiSupported); + Information.TryGetValue("http://tizen.org/feature/network.telephony", out bool isTelephonySupported); + Information.TryGetValue("http://tizen.org/feature/network.ethernet", out bool isEthernetSupported); + + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, + $"Wifi:{isWiFiSupported}, Telephony:{isTelephonySupported}, Ethernet:{isEthernetSupported}"); + + return isWiFiSupported | isTelephonySupported | isEthernetSupported; + } + } + + public static void Check() + { + if (!IsSupportable) + { + Assert.Fail("Networks are not supported."); + } + + if (ConnectionState.Connected == ConnectionManager.WiFiState) + { + WiFiAP WifiAp = WiFiManager.GetConnectedAP(); + if (WifiAp != null) + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "WifiAp : " + WifiAp.NetworkInformation.Essid.ToString()); + WifiAp.Dispose(); + } + + try + { + var data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalReceivedData); + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "TotalReceivedData : " + data); + if (data == 0) + Assert.Fail("TotalReceivedData should not be 0."); + } + catch (Exception ex) + { + Assert.Fail("Failed to get connection statistics. : " + ex.ToString()); + } + } + else + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Wifi is not connected. Maybe another network is being used."); + } + } + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/MediaPlayerPreconditionUtil.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/MediaPlayerPreconditionUtil.cs new file mode 100644 index 000000000..2a0969baf --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/MediaPlayerPreconditionUtil.cs @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2020 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 NUnit.Framework.TUnit; +using System; +using System.IO; + +namespace Tizen.Multimedia.UI.Tests +{ + public class MediaPlayerPreconditionUtils + { + public static string STREAMING_URI = null; + public static string ADAPTIVE_STREAMING_URI = null; + + public static void SetPrecondition() + { + string result = ReadFile("/opt/usr/home/owner/share/tct/preconfigure.json"); + int index = 0; + string[] resultArray = StringParser(result); + + if (resultArray == null) + { + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "StringParser failed " + result); + return; + } + + foreach (string item in resultArray) + { + switch (item) + { + case "STREAMING_URI": + // Remove backslash + resultArray[index + 1] = resultArray[index + 1].Replace("\\", ""); + STREAMING_URI = resultArray[index + 1]; + break; + case "ADAPTIVE_STREAMING_URL": + resultArray[index + 1] = resultArray[index + 1].Replace("\\", ""); + ADAPTIVE_STREAMING_URI = resultArray[index + 1]; + break; + default: + break; + } + index++; + } + } + + private static string ReadFile(string path) + { + string result = null; + string url = path; + StreamReader reader = null; + + try + { + reader = File.OpenText(path); + result = reader.ReadToEnd(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "File read error : " + e.Message); + } + finally + { + if (reader != null) + { + reader.Dispose(); + } + } + return result; + } + private static string[] StringParser(string TCID) + { + TCID = TCID.Replace(": \"", ":\""); + TCID = TCID.Replace(" ", ""); + TCID = TCID.Replace("\n", ""); + TCID = TCID.Replace("\n", ""); + + string[] delimiter = { "[{\"", "\":\"", "\",\"", "\":", ",\"", "\"}]", "}" }; + string[] stringPieces = null; + + try + { + stringPieces = TCID.Split(delimiter, StringSplitOptions.None); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "ResultParser : " + e.Message); + } + + return stringPieces; + } + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/MediaPlayerTestBase.cs b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/MediaPlayerTestBase.cs new file mode 100644 index 000000000..e84b2b39c --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/testcase/support/MediaPlayerTestBase.cs @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2020 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 ElmSharp; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Threading.Tasks; + +namespace Tizen.Multimedia.UI.Tests +{ + public class MediaPlayerTestBase + { + public Player TestPlayer { get; private set; } + + [SetUp] + public void SetUpBase() + { + TestPlayer = new Player(); + } + + [TearDown] + public void TearDownBase() + { + TestPlayer.Dispose(); + } + + protected Player GetIdlePlayer() + { + TestPlayer.Unprepare(); + + return TestPlayer; + } + + internal async Task PreparePlayerAsync() + { + PlayerError? error = null; + + EventHandler errorHandler = (s, e) => error = e.Error; + + TestPlayer.ErrorOccurred += errorHandler; + + try + { + await TestPlayer.PrepareAsync(); + } + catch + { + if (error != null) + { + string msg = $"Failed to prepare the player. Error : { error }."; + + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, msg); + throw new Exception(msg); + } + throw; + } + finally + { + TestPlayer.ErrorOccurred -= errorHandler; + } + } + + protected async Task GetPreparedPlayer(MediaSource source = null, Display display = null) + { + // reset source + TestPlayer.SetSource(null); + + TestPlayer.SetSource(source ?? Constants.AudioFileSource); + TestPlayer.Display = display; + + await PreparePlayerAsync(); + + return TestPlayer; + } + + protected async Task GetPlayingPlayer(MediaSource source = null, Display display = null) + { + await GetPreparedPlayer(source, display); + + TestPlayer.Start(); + + return TestPlayer; + } + + protected async Task GetPausedPlayer(MediaSource source = null, Display display = null) + { + await GetPlayingPlayer(source, display); + + TestPlayer.Pause(); + + return TestPlayer; + } + + internal static Window CreateWindow() + { + var w = new Window(""); + w.Resize(100, 100); + w.Realize(null); + return w; + } + + public static Display DefaultDisplay = new Display(CreateWindow()); + } +} diff --git a/tct-suite-vs/Tizen.Multimedia.UI.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.Multimedia.UI.Tests/tizen-manifest.xml new file mode 100644 index 000000000..ad9ed96b9 --- /dev/null +++ b/tct-suite-vs/Tizen.Multimedia.UI.Tests/tizen-manifest.xml @@ -0,0 +1,18 @@ + + + + + Tizen.Multimedia.UI.Tests.png + + + + http://tizen.org/privilege/internet + http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/network.get + + diff --git a/tool/script/tct-testconfig/tct-testconfig.ini b/tool/script/tct-testconfig/tct-testconfig.ini index 3a23271e1..13dfa5934 100755 --- a/tool/script/tct-testconfig/tct-testconfig.ini +++ b/tool/script/tct-testconfig/tct-testconfig.ini @@ -54,3 +54,8 @@ MESSAGES_MOBILE_NUMBER=You should write only number. Do NOT write - or () [Tizen.MediaPlayer.Tests] STREAMING_URI = set the uri in here. ex>http://www.samsung.com/xx/xx/aa.mp4 ADAPTIVE_STREAMING_URL = set the url in here + +# Multimedia.UI test key settings +[Tizen.Multimedia.UI.Tests] +STREAMING_URI = set the uri in here. ex>http://www.samsung.com/xx/xx/aa.mp4 +ADAPTIVE_STREAMING_URL = set the url in here diff --git a/tool/script/tct-testconfig/tests.xml b/tool/script/tct-testconfig/tests.xml index 896304638..b1fe4a2ce 100755 --- a/tool/script/tct-testconfig/tests.xml +++ b/tool/script/tct-testconfig/tests.xml @@ -114,7 +114,7 @@ The tct-bt-helper is included in the tct-bluetooth-tizen-tests package. Install - + A network connection capable of accessing the Internet MUST be established. @@ -379,7 +379,24 @@ The tct-bt-helper is included in the tct-bluetooth-tizen-tests package. Install - + + + + + + + + Set the streaming uri such as http://www.samsung.com/xx/xx/aa.mp4. + + + Set the adaptive streaming url. + + + + + + +