From 5491105be968b435153309ef505ecd597530c9b2 Mon Sep 17 00:00:00 2001 From: ruble Date: Fri, 27 Sep 2019 10:58:44 +0900 Subject: [PATCH] [MediaPlayer][Non-ACR] fix codes to handle exceptions properly Change-Id: I3a365637d68d7d485a5dd39fb6cc305e1022b0f0 --- .../Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs | 81 +++++++++++++++++++--- 1 file changed, 71 insertions(+), 10 deletions(-) diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs index a617735..411cd4a 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs @@ -1891,7 +1891,7 @@ namespace Tizen.Multimedia.Tests var player = GetIdlePlayer(); player.SetSource(Constants.VideoFileSource); - Assert.That(() => player.EnableExportingVideoFrame(), Throws.Nothing); + player.EnableExportingVideoFrame(); } catch(NotSupportedException) { @@ -1899,6 +1899,14 @@ namespace Tizen.Multimedia.Tests { Assert.Pass($"The feature({Features.RawVideo} is not supported."); } + else + { + Assert.Fail("Feature is supported but exception is invoked."); + } + } + catch (Exception) + { + Assert.Fail("It should not throw exception"); } } @@ -1915,8 +1923,11 @@ namespace Tizen.Multimedia.Tests { var player = await GetPreparedPlayer(Constants.VideoFileSource); - Assert.That(() => player.EnableExportingVideoFrame(), - Throws.InvalidOperationException); + player.EnableExportingVideoFrame(); + } + catch (InvalidOperationException) + { + Assert.Pass("the proper error occured."); } catch (NotSupportedException) { @@ -1924,6 +1935,14 @@ namespace Tizen.Multimedia.Tests { Assert.Pass($"The feature({Features.RawVideo} is not supported."); } + else + { + Assert.Fail("Feature is supported but exception is invoked."); + } + } + catch (Exception) + { + Assert.Fail("It should not throw exception."); } } @@ -1940,8 +1959,11 @@ namespace Tizen.Multimedia.Tests { GetIdlePlayer().Dispose(); - Assert.That(() => TestPlayer.EnableExportingVideoFrame(), - Throws.TypeOf()); + TestPlayer.EnableExportingVideoFrame(); + } + catch (ObjectDisposedException) + { + Assert.Pass("the proper error occured"); } catch (NotSupportedException) { @@ -1949,6 +1971,14 @@ namespace Tizen.Multimedia.Tests { Assert.Pass($"The feature({Features.RawVideo} is not supported."); } + else + { + Assert.Fail("Feature is supported but exception is invoked."); + } + } + catch (Exception) + { + Assert.Fail("It should not throw exception."); } } @@ -1964,11 +1994,11 @@ namespace Tizen.Multimedia.Tests try { var player = GetIdlePlayer(); - Assert.That(() => player.DisableExportingVideoFrame(), Throws.Nothing); + player.DisableExportingVideoFrame(); player.SetSource(Constants.VideoFileSource); await player.PrepareAsync(); - Assert.That(() => player.DisableExportingVideoFrame(), Throws.Nothing); + player.DisableExportingVideoFrame(); } catch (NotSupportedException) { @@ -1976,6 +2006,14 @@ namespace Tizen.Multimedia.Tests { Assert.Pass($"The feature({Features.RawVideo} is not supported."); } + else + { + Assert.Fail("Feature is supported but exception is invoked."); + } + } + catch (Exception) + { + Assert.Fail("It should not throw exception"); } } @@ -1992,8 +2030,11 @@ namespace Tizen.Multimedia.Tests { var player = await GetPlayingPlayer(Constants.VideoFileSource); - Assert.That(() => player.DisableExportingVideoFrame(), - Throws.InvalidOperationException); + player.DisableExportingVideoFrame(); + } + catch (InvalidOperationException) + { + Assert.Pass("the proper error occured."); } catch (NotSupportedException) { @@ -2001,6 +2042,14 @@ namespace Tizen.Multimedia.Tests { Assert.Pass($"The feature({Features.RawVideo} is not supported."); } + else + { + Assert.Fail("Feature is supported but exception is invoked."); + } + } + catch (Exception) + { + Assert.Fail("It should not throw exception."); } } @@ -2017,7 +2066,11 @@ namespace Tizen.Multimedia.Tests { GetIdlePlayer().Dispose(); - Assert.That(() => TestPlayer.DisableExportingVideoFrame(), Throws.TypeOf()); + TestPlayer.DisableExportingVideoFrame(); + } + catch (ObjectDisposedException) + { + Assert.Pass("the proper error occured."); } catch (NotSupportedException) { @@ -2025,6 +2078,14 @@ namespace Tizen.Multimedia.Tests { Assert.Pass($"The feature({Features.RawVideo} is not supported."); } + else + { + Assert.Fail("Feature is supported but exception is invoked."); + } + } + catch (Exception) + { + Assert.Fail("It should not throw exception."); } } #endregion -- 2.7.4