From c7990f23fa6cb36c8887e83d5331e84ce0f52d13 Mon Sep 17 00:00:00 2001 From: Hu Yueh-Wei Date: Tue, 3 Dec 2024 12:05:05 +0800 Subject: [PATCH] chore: remove more _ten namespace directly accessing (#362) --- .../smoke/audio_frame_test/create_from_json.cc | 7 +++---- tests/ten_runtime/smoke/msg_test/msg_3.cc | 9 +++++---- .../smoke/video_frame_test/create_from_json.cc | 5 ++--- tests/ten_runtime/smoke/video_frame_test/from_json.cc | 5 ++--- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/ten_runtime/smoke/audio_frame_test/create_from_json.cc b/tests/ten_runtime/smoke/audio_frame_test/create_from_json.cc index fd1bb06b6..47972c06c 100644 --- a/tests/ten_runtime/smoke/audio_frame_test/create_from_json.cc +++ b/tests/ten_runtime/smoke/audio_frame_test/create_from_json.cc @@ -56,10 +56,9 @@ class test_extension_2 : public ten::extension_t { ten::ten_env_t &ten_env, std::unique_ptr audio_frame) override { auto cmd = ten::cmd_t::create("audio_frame_ack"); - if (audio_frame->get_property_int64("_ten.bytes_per_sample") == 3 && - audio_frame->get_property_int64("_ten.number_of_channel") == 555 && - audio_frame->get_property_int64("_ten.data_fmt") == - TEN_AUDIO_FRAME_DATA_FMT_INTERLEAVE) { + if (audio_frame->get_bytes_per_sample() == 3 && + audio_frame->get_number_of_channels() == 555 && + audio_frame->get_data_fmt() == TEN_AUDIO_FRAME_DATA_FMT_INTERLEAVE) { ten_env.send_cmd(std::move(cmd)); } } diff --git a/tests/ten_runtime/smoke/msg_test/msg_3.cc b/tests/ten_runtime/smoke/msg_test/msg_3.cc index 9ea27310b..f0cc1ac47 100644 --- a/tests/ten_runtime/smoke/msg_test/msg_3.cc +++ b/tests/ten_runtime/smoke/msg_test/msg_3.cc @@ -8,6 +8,7 @@ #include #include "gtest/gtest.h" +#include "include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timer.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" @@ -27,11 +28,11 @@ class test_extension : public ten::extension_t { hello_world_cmd = std::move(cmd); // Start a timer. - std::unique_ptr timer_cmd = ten::cmd_timer_t::create(); + std::unique_ptr timer_cmd = ten::cmd_timer_t::create(); timer_cmd->set_dest("localhost", nullptr, nullptr, nullptr); - timer_cmd->set_property("_ten.timer_id", 55); - timer_cmd->set_property("_ten.timeout_in_us", 100); - timer_cmd->set_property("_ten.times", TIMER_TIMES); + timer_cmd->set_timer_id(55); + timer_cmd->set_timeout_in_us(100); + timer_cmd->set_times(TIMER_TIMES); bool success = ten_env.send_cmd(std::move(timer_cmd)); EXPECT_EQ(success, true); diff --git a/tests/ten_runtime/smoke/video_frame_test/create_from_json.cc b/tests/ten_runtime/smoke/video_frame_test/create_from_json.cc index 50e062732..1e07cde43 100644 --- a/tests/ten_runtime/smoke/video_frame_test/create_from_json.cc +++ b/tests/ten_runtime/smoke/video_frame_test/create_from_json.cc @@ -53,9 +53,8 @@ class test_extension_2 : public ten::extension_t { ten::ten_env_t &ten_env, std::unique_ptr video_frame) override { auto cmd = ten::cmd_t::create("video_frame_ack"); - if (video_frame->get_property_int64("_ten.width") == 345 && - video_frame->get_property_int64("_ten.pixel_fmt") == - TEN_PIXEL_FMT_RGB24) { + if (video_frame->get_width() == 345 && + video_frame->get_pixel_fmt() == TEN_PIXEL_FMT_RGB24) { ten_env.send_cmd(std::move(cmd)); } } diff --git a/tests/ten_runtime/smoke/video_frame_test/from_json.cc b/tests/ten_runtime/smoke/video_frame_test/from_json.cc index 16c15bc8f..49b3b41b9 100644 --- a/tests/ten_runtime/smoke/video_frame_test/from_json.cc +++ b/tests/ten_runtime/smoke/video_frame_test/from_json.cc @@ -51,9 +51,8 @@ class test_extension_2 : public ten::extension_t { ten::ten_env_t &ten_env, std::unique_ptr video_frame) override { auto cmd = ten::cmd_t::create("video_frame_ack"); - if (video_frame->get_property_int64("_ten.width") == 345 && - video_frame->get_property_int64("_ten.pixel_fmt") == - TEN_PIXEL_FMT_RGB24) { + if (video_frame->get_width() == 345 && + video_frame->get_pixel_fmt() == TEN_PIXEL_FMT_RGB24) { ten_env.send_cmd(std::move(cmd)); } }