From 841dade20bfae70e19ac60aa2227b929c8d4db46 Mon Sep 17 00:00:00 2001 From: Wonki Kim Date: Fri, 24 Apr 2020 22:05:21 +0900 Subject: [PATCH] example: enhance a test script and mismatching protocol this patch add a bit more tests Change-Id: Ib3c82e2e3789302583e60db805b620b9e7116efa --- .../src/Commands/GetLocationCommand.cc | 5 +++++ protocol/aurum.proto | 4 ++-- protocol/examples/python/testFeatures.py | 17 +++++++++++------ protocol/examples/python/testInternal.py | 3 ++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/org.tizen.aurum-bootstrap/src/Commands/GetLocationCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/GetLocationCommand.cc index a8a5aff..b92ff80 100644 --- a/org.tizen.aurum-bootstrap/src/Commands/GetLocationCommand.cc +++ b/org.tizen.aurum-bootstrap/src/Commands/GetLocationCommand.cc @@ -11,5 +11,10 @@ GetLocationCommand::GetLocationCommand(const ::aurum::ReqGetLocation* request, { LOG_SCOPE_F(INFO, "CliGetLocation --------------- "); // ObjectMapper *mObjMap = ObjectMapper::getInstance(); + + mResponse->set_alt(-1); + mResponse->set_lat(-1); + mResponse->set_status(::aurum::RspStatus::ERROR); + return grpc::Status::OK; } \ No newline at end of file diff --git a/protocol/aurum.proto b/protocol/aurum.proto index 254690b..e678b38 100644 --- a/protocol/aurum.proto +++ b/protocol/aurum.proto @@ -325,8 +325,8 @@ message ReqGetLocation{ } message RspGetLocation{ RspStatus status = 1; - string alt = 2; - string lat = 3; + double alt = 2; + double lat = 3; } message ReqKey{ diff --git a/protocol/examples/python/testFeatures.py b/protocol/examples/python/testFeatures.py index 6a383b3..3b27fc9 100644 --- a/protocol/examples/python/testFeatures.py +++ b/protocol/examples/python/testFeatures.py @@ -148,6 +148,9 @@ def clickTest(stub): return True def longClickTest(stub): + response = stub.sendKey(ReqKey(type='HOME', actionType='STROKE')) + stub.click(ReqClick(coordination=Point(x=160, y=160), type='COORD')) + # TODO : find out something changed return False def flickTest(stub): @@ -244,13 +247,15 @@ def scrollToTest(stub): def getDeviceTimeTest(stub): response1 = stub.getDeviceTime(ReqGetDeviceTime(type='WALLCLOCK')) response2 = stub.getDeviceTime(ReqGetDeviceTime(type='WALLCLOCK')) - print(response1, response2) - return response2.timeStampUTC > response1.timeStampUTC; + return response2.timestampUTC > response1.timestampUTC; def getLocationTest(stub): - print('getLocation command not implemented') - return False + response = stub.getLocation(ReqGetLocation()) + + if response.alt < 0: return False + if response.lat < 0: return False + return True def defaultSetup(stub): if stub.getAppInfo(ReqGetAppInfo(packageName='com.samsung.ui-widget-sample')).isRunning: @@ -300,11 +305,11 @@ def run(): runTestWithoutSetupAndTearDown(stub, closeAppTest) runTestWithoutSetupAndTearDown(stub, removeAppTest) - - runTest(stub, scrollToTest, alwaySucceed=True) runTest(stub, longClickTest, alwaySucceed=True) runTest(stub, getLocationTest, alwaySucceed=True) + runTest(stub, scrollToTest, alwaySucceed=True) + if __name__ == '__main__': logging.basicConfig() run() diff --git a/protocol/examples/python/testInternal.py b/protocol/examples/python/testInternal.py index 23f2faa..c81c839 100644 --- a/protocol/examples/python/testInternal.py +++ b/protocol/examples/python/testInternal.py @@ -8,9 +8,10 @@ def run(): with grpc.insecure_channel('127.0.0.1:50051') as channel: stub = aurum_pb2_grpc.BootstrapStub(channel) + print(stub.getLocation(ReqGetLocation()).status) print(stub.sync(ReqEmpty())) print(stub.getDeviceTime(ReqGetDeviceTime(type='WALLCLOCK'))) -# stub.killServer(aurum_pb2.ReqEmpty()) + # stub.killServer(aurum_pb2.ReqEmpty()) if __name__ == '__main__': logging.basicConfig() -- 2.7.4