Modified batch runner to handle pause/resume gesture 11/211411/2
authorAdrian Wojciechowski <a.wojciecho3@partner.samsung.com>
Fri, 2 Aug 2019 12:38:59 +0000 (14:38 +0200)
committerLukasz Oleksak <l.oleksak@samsung.com>
Fri, 2 Aug 2019 13:31:08 +0000 (13:31 +0000)
Change-Id: I4dfeec40d3210e5d41d50e60f5b8987c41ce8251

src/batch/BatchRunner.cpp

index 214f4952fbf4ee4c7047f2ccf786484ac4c2bb4d..120d5df530a531e9b87c6bb193695c4912e75ccc 100644 (file)
@@ -1001,10 +1001,9 @@ void BatchExecutor::insertMethods()
                }, { { "name" } } };
 
        auto generateTapFunction = [&](size_t tapCount) {
-               Optional<EvaluationValue> defValue;
-               if (tapCount > 1)
-                       defValue = EvaluationValue{};
+
                return EvaluationValueFunction{ [ &, tapCount](EvaluationValue target, EvaluationValue fingers) -> EvaluationValue {
+
                                auto root = getVisibleRoot();
                                if (!root) throw EvaluationFailure{} << "no visible root (context changed didn't happen)";
                                ASSERT(root->getObject());
@@ -1023,8 +1022,8 @@ void BatchExecutor::insertMethods()
                                        coord = getUIElementPosition(dest).getCenterPoint();
                                } else
                                {
-                                       if (tapCount == 1)
-                                               throw EvaluationFailure{} << "no target value passed (you need target to do single tap)";
+                                       if (tapCount == 1 && fingers == 1)
+                                               throw EvaluationFailure{} << "no target value passed (you need target to do one finger single tap)";
                                }
 
                                auto sleep_until = std::chrono::high_resolution_clock::now() + std::chrono::milliseconds{ 400 };
@@ -1039,7 +1038,7 @@ void BatchExecutor::insertMethods()
                                std::this_thread::sleep_until(sleep_until);
 
                                return EvaluationValue{};
-                       }, { { "target", defValue }, { "fingers", 1 } } };
+                       }, { { "target", EvaluationValue{} }, { "fingers", 1 } } };
        };
        variables["TAP"] = generateTapFunction(1);
        variables["DOUBLE_TAP"] = generateTapFunction(2);