using System;
using NUnit.Framework;
using Xamarin.Forms;
-using Tizen.Xamarin.Forms.Extension.Renderer;
namespace XamarinApplication.Tizen
{
{
Console.WriteLine("TCT : Main()");
var app = new Program();
- TizenFormsExtension.Init();
global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
app.Run(args);
}
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Support.Library", "..\Tizen.Multimedia.Support.Library\Tizen.Multimedia.Support.Library.csproj", "{B42F7C98-0918-4141-8C93-4B6263931E6E}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Support.Library", "..\Tizen.Multimedia.Support.Library\Tizen.Multimedia.Support.Library.csproj", "{B42F7C98-0918-4141-8C93-4B6263931E6E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplate", "..\Template\ManualTemplate\ManualTemplate.csproj", "{269F89A7-E648-4811-8421-844E00ACF5F0}"
EndProject
{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
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.NUI|Any CPU.ActiveCfg = Debug|Any CPU
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.NUI|Any CPU.Build.0 = Debug|Any CPU
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Debug|x64.Build.0 = Debug|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Debug|x86.Build.0 = Debug|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Release|x64.ActiveCfg = Release|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Release|x64.Build.0 = Release|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Release|x86.ActiveCfg = Release|Any CPU
+ {B42F7C98-0918-4141-8C93-4B6263931E6E}.Release|x86.Build.0 = Release|Any CPU
{269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {269F89A7-E648-4811-8421-844E00ACF5F0}.NUI|Any CPU.ActiveCfg = Debug|Any CPU
- {269F89A7-E648-4811-8421-844E00ACF5F0}.NUI|Any CPU.Build.0 = Debug|Any CPU
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x64.Build.0 = Debug|Any CPU
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x86.Build.0 = Debug|Any CPU
{269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x64.ActiveCfg = Release|Any CPU
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x64.Build.0 = Release|Any CPU
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x86.ActiveCfg = Release|Any CPU
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x86.Build.0 = Release|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x64.Build.0 = Debug|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x86.Build.0 = Debug|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x64.ActiveCfg = Release|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x64.Build.0 = Release|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x86.ActiveCfg = Release|Any CPU
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
return;
}
- Camera.StateChanged += async (s, e) =>
+ TestCamera.StateChanged += async (s, e) =>
{
await Task.Delay(200);
if (e.Current == CameraState.Preview)
{
_msgBox.Text = "Preview is started successfully and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+
+ ConfirmAndHideView();
}
};
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
};
try
{
// Call StartPreview again to make invalid state intentionally.
- Camera.StartPreview();
+ TestCamera.StartPreview();
}
catch (InvalidOperationException)
{
_msgBox.Text = "InvalidOperationException is occured correctly. Please go back to previous page.";
- ManualTest.Confirm();
+
+ ConfirmAndHideView();
return;
}
Assert.Fail("InvalidOperationException is not occured and TC is failed. Please go back to previous page.");
};
- Camera.StartPreview();
+ TestCamera.StartPreview();
await ManualTest.WaitForConfirm();
}
return;
}
- Camera.CaptureCompleted += (s, e) =>
+ TestCamera.CaptureCompleted += (s, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_msgBox.Text = "Capture is completed successfully and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+
+ ConfirmAndHideView();
};
/*
_button1.Clicked += (sender, e) =>
{
- Camera.Settings.CaptureResolution = new Size(640, 480);
- Camera.StartPreview();
+ TestCamera.Settings.CaptureResolution = new Size(640, 480);
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartCapture();
+ TestCamera.StartCapture();
_button2.IsEnabled = false;
};
try
{
- Camera.Settings.CaptureResolution = new Size(640, 480);
- Camera.StartCapture();
+ TestCamera.Settings.CaptureResolution = new Size(640, 480);
+ TestCamera.StartCapture();
}
catch (InvalidOperationException)
{
_msgBox.Text = "InvalidOperationException is occured correctly and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+
+ ConfirmAndHideView();
return;
}
return;
}
- Camera.CaptureCompleted += (s, e) =>
+ TestCamera.CaptureCompleted += (s, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_msgBox.Text = "Capture is completed successfully and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+
+ ConfirmAndHideView();
};
/*
_button1.Clicked += (sender, e) =>
{
tokenSource = new CancellationTokenSource();
- Camera.Settings.CaptureResolution = new Size(640, 480);
- Camera.StartPreview();
+ TestCamera.Settings.CaptureResolution = new Size(640, 480);
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartCapture(3, 700, tokenSource.Token);
+ TestCamera.StartCapture(3, 700, tokenSource.Token);
_button2.IsEnabled = false;
};
try
{
tokenSource = new CancellationTokenSource();
- Camera.Settings.CaptureResolution = new Size(640, 480);
- Camera.StartCapture(5, 700, tokenSource.Token);
+ TestCamera.Settings.CaptureResolution = new Size(640, 480);
+ TestCamera.StartCapture(5, 700, tokenSource.Token);
}
catch (InvalidOperationException)
{
_msgBox.Text = "InvalidOperationException is occured correctly and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+
+ ConfirmAndHideView();
return;
}
return;
}
- Camera.ChangeDevice(CameraDevice.Front);
+ TestCamera.ChangeDevice(CameraDevice.Front);
- Camera.FaceDetected += (s, e) =>
+ TestCamera.FaceDetected += (s, e) =>
{
- _msgBox.Text = "Face detection is started successfully and TC is passed. Please go back to previous page.";
+ _msgBox.Text = "Face detection is started successfully and TC is passed. " +
+ "Please go back to previous page.";
- Camera.StopFaceDetection();
- ManualTest.Confirm();
+ ConfirmAndHideView();
};
/*
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFaceDetection();
+ TestCamera.StartFaceDetection();
_button2.IsEnabled = false;
};
return;
}
- Camera.ChangeDevice(CameraDevice.Front);
+ TestCamera.ChangeDevice(CameraDevice.Front);
/*
* TEST CODE
try
{
- Camera.StartFaceDetection();
+ TestCamera.StartFaceDetection();
}
catch (InvalidOperationException)
{
_msgBox.Text = "InvalidOperationException is occured correctly and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+
+ ConfirmAndHideView();
return;
}
return;
}
- Camera.FocusStateChanged += (s, e) =>
+ TestCamera.FocusStateChanged += (s, e) =>
{
if (Enum.IsDefined(typeof(CameraFocusState), e.State))
{
- _msgBox.Text = "Focus state is changed successfully and TC is passed. Please go back to previous page.";
+ _msgBox.Text = "Focus state is changed successfully and TC is passed. " +
+ "Please go back to previous page.";
+
+ TestCamera.StopFocusing();
- Camera.StopFocusing();
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
};
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFocusing(true);
+ TestCamera.StartFocusing(true);
_button2.IsEnabled = false;
};
try
{
- Camera.StartFocusing(true);
+ TestCamera.StartFocusing(true);
}
catch (InvalidOperationException)
{
_msgBox.Text = "InvalidOperationException is occured correctly and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+
+ ConfirmAndHideView();
return;
}
return;
}
- Camera.ChangeDevice(CameraDevice.Front);
+ TestCamera.ChangeDevice(CameraDevice.Front);
- Camera.FaceDetected += (s, e) =>
+ TestCamera.FaceDetected += (s, e) =>
{
_msgBox.Text = "Face is detected successfully and TC is passed. Please go back to previous page.";
- Camera.StopFaceDetection();
- ManualTest.Confirm();
+ ConfirmAndHideView();
};
/*
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFaceDetection();
+ TestCamera.StartFaceDetection();
_button2.IsEnabled = false;
};
return;
}
- Camera.FocusStateChanged += (s, e) =>
+ TestCamera.FocusStateChanged += (s, e) =>
{
if (Enum.IsDefined(typeof(CameraFocusState), e.State))
{
_msgBox.Text = "Focus state is changed successfully and TC is passed. Please go back to previous page.";
- Camera.StopFocusing();
- ManualTest.Confirm();
+ TestCamera.StopFocusing();
+
+ ConfirmAndHideView();
}
};
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFocusing(true);
+ TestCamera.StartFocusing(true);
_button2.IsEnabled = false;
};
return;
}
- Camera.FocusStateChanged += (s, e) =>
+ TestCamera.FocusStateChanged += (s, e) =>
{
if (Enum.IsDefined(typeof(CameraFocusState), e.State))
{
_msgBox.Text = "Focus state is changed successfully and TC is passed. Please go back to previous page.";
- Camera.StopFocusing();
- ManualTest.Confirm();
+ TestCamera.StopFocusing();
+
+ ConfirmAndHideView();
}
};
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFocusing(true);
+ TestCamera.StartFocusing(true);
_button2.IsEnabled = false;
};
[Description("Testing FaceDetectedEventArgs class")]
public class FaceDetectedEventArgsTests : CameraTestBase
{
+ [SetUp]
+ public void SetUp()
+ {
+ if (_isCameraSupported)
+ {
+ TestCamera.ChangeDevice(CameraDevice.Front);
+ }
+ }
+
[Test]
[Category("P1")]
[Description("MANUAL TEST : Test Faces property of FaceDetectedEventArgs")]
return;
}
- Camera.ChangeDevice(CameraDevice.Front);
-
- Camera.FaceDetected += (s, e) =>
+ TestCamera.FaceDetected += (s, e) =>
{
_msgBox.Text = "Face is detected successfully and TC is passed. Please go back to previous page.";
- Camera.StopFaceDetection();
- ManualTest.Confirm();
+ ConfirmAndHideView();
};
/*
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFaceDetection();
+ TestCamera.StartFaceDetection();
_button2.IsEnabled = false;
};
[Description("Testing FaceDetectionData class")]
public class FaceDetectionDataTests : CameraTestBase
{
+ [SetUp]
+ public void SetUp()
+ {
+ if (_isCameraSupported)
+ {
+ TestCamera.ChangeDevice(CameraDevice.Front);
+ }
+ }
+
[Test]
[Category("P1")]
[Description("MANUAL TEST : Test Id property of FaceDetectionData.")]
return;
}
- Camera.ChangeDevice(CameraDevice.Front);
-
- Camera.FaceDetected += (s, e) =>
+ TestCamera.FaceDetected += (s, e) =>
{
_msgBox.Text = "Face is detected successfully and TC is passed. Please go back to previous page.";
- Camera.StopFaceDetection();
IList<FaceDetectionData> faces = e.Faces.ToList();
if (faces.Count() > 0)
{
if (faces[0].Id >= 0)
{
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
}
};
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFaceDetection();
+ TestCamera.StartFaceDetection();
_button2.IsEnabled = false;
};
return;
}
- Camera.ChangeDevice(CameraDevice.Front);
-
- Camera.FaceDetected += (s, e) =>
+ TestCamera.FaceDetected += (s, e) =>
{
_msgBox.Text = "Face is detected successfully and TC is passed. Please go back to previous page.";
- Camera.StopFaceDetection();
IList<FaceDetectionData> faces = e.Faces.ToList();
if (faces.Count() > 0)
{
if (faces[0].Score >= 0)
{
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
}
};
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFaceDetection();
+ TestCamera.StartFaceDetection();
_button2.IsEnabled = false;
};
return;
}
- Camera.ChangeDevice(CameraDevice.Front);
-
- Camera.FaceDetected += (s, e) =>
+ TestCamera.FaceDetected += (s, e) =>
{
_msgBox.Text = "Face is detected successfully and TC is passed. Please go back to previous page.";
- Camera.StopFaceDetection();
IList<FaceDetectionData> faces = e.Faces.ToList();
if (faces.Count() > 0)
{
if (faces[0].X >= 0)
{
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
}
};
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFaceDetection();
+ TestCamera.StartFaceDetection();
_button2.IsEnabled = false;
};
return;
}
- Camera.ChangeDevice(CameraDevice.Front);
-
- Camera.FaceDetected += (s, e) =>
+ TestCamera.FaceDetected += (s, e) =>
{
_msgBox.Text = "Face is detected successfully and TC is passed. Please go back to previous page.";
- Camera.StopFaceDetection();
IList<FaceDetectionData> faces = e.Faces.ToList();
if (faces.Count() > 0)
{
if (faces[0].Y >= 0)
{
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
}
};
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFaceDetection();
+ TestCamera.StartFaceDetection();
_button2.IsEnabled = false;
};
return;
}
- Camera.ChangeDevice(CameraDevice.Front);
-
- Camera.FaceDetected += (s, e) =>
+ TestCamera.FaceDetected += (s, e) =>
{
_msgBox.Text = "Face is detected successfully and TC is passed. Please go back to previous page.";
- Camera.StopFaceDetection();
IList<FaceDetectionData> faces = e.Faces.ToList();
if (faces.Count() > 0)
{
if (faces[0].Width >= 0)
{
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
}
};
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFaceDetection();
+ TestCamera.StartFaceDetection();
_button2.IsEnabled = false;
};
return;
}
- Camera.ChangeDevice(CameraDevice.Front);
-
- Camera.FaceDetected += (s, e) =>
+ TestCamera.FaceDetected += (s, e) =>
{
_msgBox.Text = "Face is detected successfully and TC is passed. Please go back to previous page.";
- Camera.StopFaceDetection();
IList<FaceDetectionData> faces = e.Faces.ToList();
if (faces.Count() > 0)
{
if (faces[0].Height >= 0)
{
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
}
};
_button1.Clicked += (sender, e) =>
{
- Camera.StartPreview();
+ TestCamera.StartPreview();
_button1.IsEnabled = false;
_button2.IsEnabled = true;
_button2.Clicked += (sender, e) =>
{
- Camera.StartFaceDetection();
+ TestCamera.StartFaceDetection();
_button2.IsEnabled = false;
};
{
[TestFixture]
[Description("Testing Recorder class")]
- public class RecorderTests
+ public class RecorderTests : CameraTestBase
{
- private Camera _camera;
private Recorder _videoRecorder;
- private bool _isCameraSupported = true;
private string _filePath;
- private Button _button1;
- private Button _button2;
- private Button _button3;
- private Label _currentState, _msgBox;
[SetUp]
public void SetUp()
{
try
{
- _camera = new Camera(CameraDevice.Rear);
- var supportedVideoCodec = VideoRecorder.GetSupportedVideoCodecs().FirstOrDefault();
+ var supportedVideoCodec = VideoRecorder.GetSupportedVideoCodecs().First(
+ codec => codec != RecorderVideoCodec.H263);
var fileFormat = supportedVideoCodec.GetSupportedFileFormats().First();
- _videoRecorder = new VideoRecorder(_camera, supportedVideoCodec, fileFormat);
+
+ _videoRecorder = new VideoRecorder(TestCamera, supportedVideoCodec, fileFormat);
_filePath = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).
FirstOrDefault().RootDirectory + "/recordertest";
{
_videoRecorder?.Dispose();
- _camera?.Dispose();
-
if (File.Exists(_filePath))
{
File.Delete(_filePath);
}
}
- private async Task<bool> CheckCameraSupported(string msg)
- {
- if (_isCameraSupported == false)
- {
- await NotSupportedHelper.DisplayNotSupportedLabel(msg);
- return true;
- }
-
- return false;
- }
-
- private async Task CreateButton(string str1, string str2 = "", string str3 = "")
- {
- var tcs = new TaskCompletionSource<bool>();
-
- Device.BeginInvokeOnMainThread(() =>
- {
- Extension.MediaView mediaView = new Extension.MediaView
- {
- IsVisible = true,
- HorizontalOptions = LayoutOptions.FillAndExpand,
- VerticalOptions = LayoutOptions.FillAndExpand,
- MinimumWidthRequest = 100,
- MinimumHeightRequest = 200
- };
-
- _button1 = new Button()
- {
- Text = str1,
- HorizontalOptions = LayoutOptions.CenterAndExpand,
- VerticalOptions = LayoutOptions.CenterAndExpand,
- MinimumWidthRequest = 210,
- MinimumHeightRequest = 45
- };
- _button2 = new Button()
- {
- Text = str2,
- HorizontalOptions = LayoutOptions.CenterAndExpand,
- VerticalOptions = LayoutOptions.CenterAndExpand,
- MinimumWidthRequest = 210,
- MinimumHeightRequest = 45,
- IsEnabled = false
- };
- _button3 = new Button()
- {
- Text = str3,
- HorizontalOptions = LayoutOptions.CenterAndExpand,
- VerticalOptions = LayoutOptions.CenterAndExpand,
- MinimumWidthRequest = 210,
- MinimumHeightRequest = 45,
- IsEnabled = false
- };
- _currentState = new Label()
- {
- Text = "Current State : ",
- HorizontalOptions = LayoutOptions.CenterAndExpand,
- VerticalOptions = LayoutOptions.Start,
- HeightRequest = 50,
- TextColor = Color.White
- };
-
- _msgBox = new Label()
- {
- Text = "Start test.",
- HorizontalOptions = LayoutOptions.CenterAndExpand,
- VerticalOptions = LayoutOptions.Start,
- MinimumHeightRequest = 50,
- TextColor = Color.Black
- };
-
- mediaView.NativeViewCreated += (s, e) =>
- {
- _camera.Display = new Display((MediaView)mediaView.NativeView);
- };
-
- var layout = new StackLayout()
- {
- HorizontalOptions = LayoutOptions.FillAndExpand,
- VerticalOptions = LayoutOptions.CenterAndExpand,
- Orientation = StackOrientation.Horizontal,
- Children = {
- _button1,
- _button2,
- _button3,
- },
- };
-
- var mainLayout = new StackLayout()
- {
- Orientation = StackOrientation.Vertical,
- IsVisible = true,
- HorizontalOptions = LayoutOptions.FillAndExpand,
- VerticalOptions = LayoutOptions.FillAndExpand,
- Spacing = 10,
- Padding = new Thickness(10),
- Children =
- {
- _currentState,
- mediaView,
- _msgBox,
- layout
- }
- };
-
- TestPage.GetInstance().ExecuteTC(new ContentPage()
- {
- Content = mainLayout
- });
-
- tcs.SetResult(true);
- });
-
- await tcs.Task;
- }
-
[Test]
[Category("P1")]
[Description("MANUAL TEST : Test Start method of Recorder.")]
if (File.Exists(_filePath))
{
_msgBox.Text = "Recording is started successfully and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
else
{
if (File.Exists(_filePath))
{
_msgBox.Text = "Recording is paused successfully and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
else
{
if (File.Exists(_filePath))
{
_msgBox.Text = "Recording file is saved successfully and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
else
{
if (!File.Exists(_filePath))
{
_msgBox.Text = "Recording is canceled successfully and TC is passed. Please go back to previous page.";
- ManualTest.Confirm();
+ ConfirmAndHideView();
}
else
{
using System.Linq;
using System.Threading.Tasks;
using Xamarin.Forms;
-using Extension = Tizen.Xamarin.Forms.Extension;
namespace Tizen.Multimedia.Tests
{
public class CameraTestBase
{
- protected Camera Camera { get; private set; }
+ protected Camera TestCamera { get; private set; }
protected bool _isCameraSupported = true;
protected Button _button1;
protected Button _button2;
protected Button _button3;
protected Label _currentState, _msgBox;
protected Image _image = null;
+ protected VideoView _videoView;
protected const string LogTag = "Tizen.Multimedia.CameraTest";
[SetUp]
{
try
{
- Camera = new Camera(CameraDevice.Rear);
+ TestCamera = new Camera(CameraDevice.Rear);
}
catch (NotSupportedException) when (FeatureChecker.IsSupported(Features.Camera) == false)
{
[TearDown]
public void Destroy()
{
- if (Camera != null)
+ if (TestCamera != null)
{
- if (Camera.State == CameraState.Captured)
+ if (TestCamera.State == CameraState.Captured)
{
- Camera.StartPreview();
- Camera.StopPreview();
+ TestCamera.StartPreview();
+ TestCamera.StopPreview();
}
- else if (Camera.State == CameraState.Preview)
+ else if (TestCamera.State == CameraState.Preview)
{
- Camera.StopPreview();
+ TestCamera.StopPreview();
}
- Camera.Dispose();
+ TestCamera.Dispose();
}
}
protected async Task<bool> CheckContinuousCaptureSupported(string msg)
{
- if (Camera.Capabilities.IsContinuousCaptureSupported == false)
+ if (TestCamera.Capabilities.IsContinuousCaptureSupported == false)
{
await NotSupportedHelper.DisplayNotSupportedLabel(msg);
return true;
protected async Task<bool> CheckFDSupported(string msg)
{
- if (Camera.Capabilities.IsFaceDetectionSupported == false)
+ if (TestCamera.Capabilities.IsFaceDetectionSupported == false)
{
await NotSupportedHelper.DisplayNotSupportedLabel(msg);
return true;
{
CameraAutoFocusMode supportedAutoFocusMode = CameraAutoFocusMode.None;
- IList<CameraAutoFocusMode> autoFocusModes = Camera.Capabilities.SupportedAutoFocusModes.ToList();
+ IList<CameraAutoFocusMode> autoFocusModes = TestCamera.Capabilities.SupportedAutoFocusModes.ToList();
foreach (var autoFocusMode in autoFocusModes)
{
if (autoFocusMode != CameraAutoFocusMode.None)
return false;
}
+ protected void ConfirmAndHideView()
+ {
+ _videoView.IsVisible = false;
+ _currentState.Text = "";
+ ManualTest.Confirm();
+ }
+
protected async Task CreateButton(string str1, string str2 = "", string str3 = "")
{
var tcs = new TaskCompletionSource<bool>();
Device.BeginInvokeOnMainThread(() =>
{
- Extension.MediaView mediaView = new Extension.MediaView
+ _videoView = new VideoView
{
IsVisible = true,
HorizontalOptions = LayoutOptions.FillAndExpand,
MinimumHeightRequest = 200
};
+ _videoView.NativeViewCreated += (s, e) =>
+ {
+ TestCamera.Display = new Display((MediaView)(s as VideoView).NativeView);
+ };
+
_button1 = new Button()
{
Text = str1,
MinimumHeightRequest = 45,
IsEnabled = false
};
+ _currentState = new Label()
+ {
+ Text = "",
+ HorizontalOptions = LayoutOptions.CenterAndExpand,
+ VerticalOptions = LayoutOptions.Start,
+ HeightRequest = 50,
+ TextColor = Color.White
+ };
_msgBox = new Label()
{
TextColor = Color.Black
};
- mediaView.NativeViewCreated += (s, e) =>
- {
- Camera.Display = new Display((MediaView)mediaView.NativeView);
- };
-
var layout = new StackLayout()
{
HorizontalOptions = LayoutOptions.FillAndExpand,
Padding = new Thickness(10),
Children =
{
- mediaView,
+ _currentState,
+ _videoView,
_msgBox,
layout
}
--- /dev/null
+using System;
+using System.ComponentModel;
+using Xamarin.Forms;
+
+namespace Tizen.Multimedia.Tests
+{
+ public class VideoView : View, IMediaViewController
+ {
+ internal static readonly BindablePropertyKey NativeViewPropertyKey =
+ BindableProperty.CreateReadOnly("NativeView", typeof(object), typeof(VideoView), default(object));
+
+ /// <summary>
+ /// BindableProperty. Identifies the NativeView bindable property.
+ /// </summary>
+ public static readonly BindableProperty NativeViewProperty = NativeViewPropertyKey.BindableProperty;
+
+ /// <summary>
+ /// NativeView allows application developers to display the video output on screen.
+ /// </summary>
+ public object NativeView
+ {
+ get { return GetValue(NativeViewProperty); }
+ }
+
+ /// <summary>
+ /// Occurs when the NativeView is created.
+ /// </summary>
+ public event EventHandler NativeViewCreated;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetNativeView(object value)
+ {
+ SetValue(NativeViewPropertyKey, value);
+ }
+
+ void IMediaViewController.SendNativeViewCreated()
+ {
+ NativeViewCreated?.Invoke(this, EventArgs.Empty);
+ }
+ }
+
+ /// <summary>
+ /// This interface is for internal use by the platform renderers.
+ /// </summary>
+ public interface IMediaViewController : IViewController
+ {
+ /// <summary>
+ /// For internal use by the platform renderers.
+ /// </summary>
+ void SendNativeViewCreated();
+
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using Xamarin.Forms.Platform.Tizen;
+using Tizen.Multimedia.Tests;
+
+[assembly: ExportRenderer(typeof(VideoView), typeof(VideoViewRenderer))]
+namespace Tizen.Multimedia.Tests
+{
+ public class VideoViewRenderer : VisualElementRenderer<VideoView>
+ {
+ MediaView _control;
+
+ public VideoViewRenderer() { }
+
+ protected override void OnElementChanged(ElementChangedEventArgs<VideoView> e)
+ {
+ if (_control == null)
+ {
+ _control = new MediaView(Forms.NativeParent);
+ SetNativeView(_control);
+ }
+
+ if (e.OldElement != null)
+ {
+ _control.Resized -= NatvieViewResized;
+ }
+
+ if (e.NewElement != null)
+ {
+ _control.Resized += NatvieViewResized;
+
+ Element.SetNativeView(_control);
+
+ IMediaViewController mediaView = Element as IMediaViewController;
+
+ mediaView?.SendNativeViewCreated();
+ }
+
+ base.OnElementChanged(e);
+ }
+
+ void NatvieViewResized(object sender, EventArgs e)
+ {
+ ((IMediaViewController)Element).NativeSizeChanged();
+ }
+ }
+}
\ No newline at end of file