Move tts-player.h from devel-api to public-api
authorRichard Huang <r.huang@samsung.com>
Wed, 10 Jun 2015 16:29:08 +0000 (17:29 +0100)
committerYoonsang Lee <ysang114.lee@samsung.com>
Tue, 23 Jun 2015 02:30:58 +0000 (11:30 +0900)
Change-Id: Id6896886de17078ceaebb84e33e9559bfd90027a

adaptors/devel-api/file.list
adaptors/public-api/adaptor-framework/tts-player.cpp [moved from adaptors/devel-api/adaptor-framework/tts-player.cpp with 89% similarity]
adaptors/public-api/adaptor-framework/tts-player.h [moved from adaptors/devel-api/adaptor-framework/tts-player.h with 82% similarity]
adaptors/public-api/dali.h
adaptors/public-api/file.list
automated-tests/src/dali-adaptor/CMakeLists.txt
automated-tests/src/dali-adaptor/utc-Dali-TtsPlayer.cpp [new file with mode: 0644]

index 3164ccf..adba206 100644 (file)
@@ -17,7 +17,6 @@ devel_api_src_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/style-monitor.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/tilt-sensor.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/lifecycle-controller.cpp \
-  $(adaptor_devel_api_dir)/adaptor-framework/tts-player.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/virtual-keyboard.cpp
 
 
@@ -43,6 +42,5 @@ devel_api_adaptor_framework_header_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/sound-player.h \
   $(adaptor_devel_api_dir)/adaptor-framework/style-monitor.h \
   $(adaptor_devel_api_dir)/adaptor-framework/tilt-sensor.h \
-  $(adaptor_devel_api_dir)/adaptor-framework/tts-player.h \
   $(adaptor_devel_api_dir)/adaptor-framework/virtual-keyboard.h \
   $(adaptor_devel_api_dir)/adaptor-framework/physical-keyboard.h
@@ -45,6 +45,17 @@ TtsPlayer::~TtsPlayer()
 {
 }
 
+TtsPlayer::TtsPlayer(const TtsPlayer& handle)
+: BaseHandle(handle)
+{
+}
+
+TtsPlayer& TtsPlayer::operator=(const TtsPlayer& rhs)
+{
+  BaseHandle::operator=(rhs);
+  return *this;
+}
+
 void TtsPlayer::Play(const std::string& text)
 {
   return GetImplementation(*this).Play(text);
@@ -60,11 +60,10 @@ public: // API
   TtsPlayer();
 
   /**
-   * @brief Gets the singleton of the TtsPlayer for each mode.
+   * @brief Gets the singleton of the TtsPlayer for the given mode.
    *
-   * Internally, each tts player handles (singleton instance) are managed for each mode.
    * @param mode the mode of tts-player
-   * @return A handle of the Ttsplayer for given mode.
+   * @return A handle of the Ttsplayer for the given mode.
    */
   static TtsPlayer Get(Dali::TtsPlayer::Mode mode = Dali::TtsPlayer::DEFAULT);
 
@@ -76,6 +75,21 @@ public: // API
   ~TtsPlayer();
 
   /**
+   * @brief This copy constructor is required for (smart) pointer semantics.
+   *
+   * @param [in] handle A reference to the copied handle
+   */
+  TtsPlayer(const TtsPlayer& handle);
+
+  /**
+   * @brief This assignment operator is required for (smart) pointer semantics.
+   *
+   * @param [in] rhs  A reference to the copied handle
+   * @return A reference to this
+   */
+  TtsPlayer& operator=(const TtsPlayer& rhs);
+
+  /**
    * @brief Start playing the audio data synthesized from the specified text.
    *
    * @pre The TtsPlayer needs to be initialized.
index 8085207..8ed599f 100644 (file)
@@ -25,6 +25,7 @@
 #include <dali/public-api/adaptor-framework/input-method.h>
 #include <dali/public-api/adaptor-framework/key.h>
 #include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/adaptor-framework/tts-player.h>
 #include <dali/public-api/adaptor-framework/pixmap-image.h>
 #include <dali/public-api/dali-adaptor-version.h>
 
index 30121df..90e1144 100644 (file)
@@ -3,6 +3,7 @@ public_api_src_files = \
   $(adaptor_public_api_dir)/adaptor-framework/key.cpp \
   $(adaptor_public_api_dir)/adaptor-framework/window.cpp \
   $(adaptor_public_api_dir)/adaptor-framework/timer.cpp \
+  $(adaptor_public_api_dir)/adaptor-framework/tts-player.cpp \
   $(adaptor_public_api_dir)/adaptor-framework/pixmap-image.cpp \
   $(adaptor_public_api_dir)/dali-adaptor-version.cpp
 
@@ -18,6 +19,7 @@ public_api_adaptor_framework_header_files = \
   $(adaptor_public_api_dir)/adaptor-framework/key.h \
   $(adaptor_public_api_dir)/adaptor-framework/style-change.h \
   $(adaptor_public_api_dir)/adaptor-framework/timer.h \
+  $(adaptor_public_api_dir)/adaptor-framework/tts-player.h \
   $(adaptor_public_api_dir)/adaptor-framework/pixmap-image.h \
   $(adaptor_public_api_dir)/adaptor-framework/window.h
 
index 7384cc0..fe4968d 100644 (file)
@@ -10,6 +10,7 @@ SET(TC_SOURCES
     utc-Dali-SingletonService.cpp
     utc-Dali-Window.cpp
     utc-Dali-Timer.cpp
+    utc-Dali-TtsPlayer.cpp
     utc-Dali-Application.cpp
 )
 
diff --git a/automated-tests/src/dali-adaptor/utc-Dali-TtsPlayer.cpp b/automated-tests/src/dali-adaptor/utc-Dali-TtsPlayer.cpp
new file mode 100644 (file)
index 0000000..60f531d
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ *
+ */
+
+#include <dali/dali.h>
+#include <dali-test-suite-utils.h>
+
+using namespace Dali;
+
+void utc_dali_ttsplayer_startup(void)
+{
+  test_return_value = TET_UNDEF;
+}
+
+void utc_dali_ttsplayer_cleanup(void)
+{
+  test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+} // unnamed namespace
+
+int UtcDaliTtsPlayerConstructorP(void)
+{
+  Dali::TtsPlayer player;
+  DALI_TEST_CHECK( !player );
+  END_TEST;
+}
+
+int UtcDaliTtsPlayerCopyConstructorP(void)
+{
+  Dali::TtsPlayer player;
+  Dali::TtsPlayer copy( player );
+  DALI_TEST_CHECK( copy == player );
+
+  END_TEST;
+}
+
+int UtcDaliTtsPlayerAssignmentOperatorP(void)
+{
+  Dali::TtsPlayer player;
+  Dali::TtsPlayer copy;
+  DALI_TEST_CHECK( ! copy );
+  copy = player;
+  DALI_TEST_CHECK( copy == player );
+
+  END_TEST;
+}
+
+int UtcDaliTtsPlayerDestructorP(void)
+{
+  Dali::TtsPlayer* player = new Dali::TtsPlayer();
+  delete player;
+
+  DALI_TEST_CHECK( true );
+  END_TEST;
+}
+
+int UtcDaliTtsPlayerConstructorFromInternalPointerN(void)
+{
+  Internal::Adaptor::TtsPlayer* internalPlayer = NULL;
+  Dali::TtsPlayer player(internalPlayer);
+  DALI_TEST_CHECK( !player ); // Should not reach here!
+
+  END_TEST;
+}
+
+int UtcDaliTtsPlayerGetP(void)
+{
+  Dali::TtsPlayer player = Dali::TtsPlayer::Get();
+  DALI_TEST_CHECK( !player );
+  END_TEST;
+}
+
+int UtcDaliTtsPlayerPlayN(void)
+{
+  Dali::TtsPlayer player = Dali::TtsPlayer::Get();
+
+  try
+  {
+    player.Play("text");
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliTtsPlayerStopN(void)
+{
+  Dali::TtsPlayer player = Dali::TtsPlayer::Get();
+
+  try
+  {
+    player.Stop();
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliTtsPlayerPauseN(void)
+{
+  Dali::TtsPlayer player = Dali::TtsPlayer::Get();
+
+  try
+  {
+    player.Pause();
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliTtsPlayerResumeN(void)
+{
+  Dali::TtsPlayer player = Dali::TtsPlayer::Get();
+
+  try
+  {
+    player.Resume();
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+