[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public async Task EventReceived_EVENT()
{
- _editor = new TextEditor()
+ TextEditor editor = new TextEditor()
{
Size2D = new Size2D(500, 300),
Position2D = new Position2D(10, 550),
BackgroundColor = Color.Magenta,
Focusable = true,
};
- Window.Instance.GetDefaultLayer().Add(_editor);
- var inputMethodContext = _editor.GetInputMethodContext();
+ NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(editor);
+ var inputMethodContext = editor.GetInputMethodContext();
if (inputMethodContext)
{
_temp = 0;
inputMethodContext.EventReceived += OnEventReceived;
inputMethodContext.Deactivate();
inputMethodContext.HideInputPanel();
- await Task.Delay(20);
+ await Task.Delay(500);
inputMethodContext.Activate();
inputMethodContext.ShowInputPanel();
- await Task.Delay(20);
+ await Task.Delay(500);\r
+
+ tlog.Debug(TAG, "EventReceived_EVENT Add 500ms delay");
+
Assert.AreEqual(10, _temp, "Should be 10");
inputMethodContext.EventReceived -= OnEventReceived;
}
-
- Window.Instance.GetDefaultLayer().Remove(_editor);
+ editor.Unparent();
+ editor.Dispose();
+ editor = null;
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public async Task StatusChanged_EVENT()
{
- _editor = new TextEditor()
+ TextEditor editor = new TextEditor()
{
Size2D = new Size2D(500, 300),
Position2D = new Position2D(10, 550),
BackgroundColor = Color.Magenta,
Focusable = true,
- };
- Window.Instance.GetDefaultLayer().Add(_editor);
- var inputMethodContext = _editor.GetInputMethodContext();
+ };\r
+ NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(editor);
+ var inputMethodContext = editor.GetInputMethodContext();
if (inputMethodContext)
{
_temp = 0;
inputMethodContext.StatusChanged += OnInputMethodContextEvent;
-
inputMethodContext.Deactivate();
inputMethodContext.HideInputPanel();
- await Task.Delay(200);
+ await Task.Delay(500);
inputMethodContext.Activate();
inputMethodContext.ShowInputPanel();
- await Task.Delay(200);
-
- tlog.Debug(TAG, "StatusChanged_EVENT Add 200ms delay");
-
+ await Task.Delay(500);
+ tlog.Debug(TAG, "StatusChanged_EVENT Add 500ms delay");
Assert.AreEqual(10, _temp, "Should be 10");
inputMethodContext.StatusChanged -= OnInputMethodContextEvent;
}
-
- Window.Instance.GetDefaultLayer().Remove(_editor);
+ editor.Unparent();
+ editor.Dispose();
+ editor = null;
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public async Task Resized_EVENT()
{
- _editor = new TextEditor()
+ TextEditor editor = new TextEditor()
{
Size2D = new Size2D(500, 300),
Position2D = new Position2D(10, 550),
BackgroundColor = Color.Magenta,
Focusable = true,
- };
- Window.Instance.GetDefaultLayer().Add(_editor);
- var inputMethodContext = _editor.GetInputMethodContext();
+ };\r
+ NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(editor);
+ var inputMethodContext = editor.GetInputMethodContext();
if (inputMethodContext)
{
_temp = 0;
inputMethodContext.Resized += OnInputMethodContextEvent;
inputMethodContext.Activate();
inputMethodContext.ShowInputPanel();
- await Task.Delay(200);
+ await Task.Delay(500);
inputMethodContext.Deactivate();
inputMethodContext.HideInputPanel();
- await Task.Delay(200);
-
+ await Task.Delay(500);\r
+ tlog.Debug(TAG, "Resized_EVENT Add 500ms delay");
Assert.AreEqual(10, _temp, "Should be 10");
inputMethodContext.Resized -= OnInputMethodContextEvent;
- }
-
- Window.Instance.GetDefaultLayer().Remove(_editor);
+ }\r
+ editor.Unparent();
+ editor.Dispose();
+ editor = null;
}
[Test]
{
private string TAG = "NUI";
private string image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
+ private bool _flagStateChanged = false;
[SetUp]
public void Init()
}
}
- bool flag = false;
if (stat == TTSPlayer.TTSState.Unavailable)
{
- Tizen.Log.Fatal(TAG, "TTS Player is NOT available in this target! Need to Check!");
- flag = true;
+ Tizen.Log.Fatal(TAG, "TTS Player is NOT available in this target! Need to Check! This case is rarely happened");
+ Assert.Pass("TTS Player is not available. It is not under control of NUI.(out of scope in NUI) This is NUI test, so just to be passed.");
}
+ _flagStateChanged = false;
- player.StateChanged += (obj, e) =>
- {
- flag = true;
- };
+ player.StateChanged += Player_StateChanged;
player.Play("test");
player.Pause();
await Task.Delay(20);
- Assert.IsTrue(flag, "StateChanged is not be called");
+ Assert.IsTrue(_flagStateChanged, "StateChanged is not be called");
+
+ player.StateChanged -= Player_StateChanged;
+ player.Dispose();
+ player = null;
+ }
+
+ private void Player_StateChanged(object sender, TTSPlayer.StateChangedEventArgs e)
+ {
+ _flagStateChanged = true;
}
+
}
}
\ No newline at end of file