A control method, device, electronic device and storage medium for controlling control time
By obtaining control information and using time functions to control long press operations, the problem of inaccurate long press time in the existing technology is solved, and the precise control and accuracy of long press time of control is achieved.
Patent Information
- Application Number
- CN201911421929.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-31
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2039-12-31
AI Technical Summary
In the prior art, long pressing time is inaccurate through step length parameter control, resulting in low accuracy of long pressing time control, affecting test efficiency.
By obtaining control information, the first operation event is injected into the target control object, and the simulation time is controlled using the time function. If the simulation of the first operation event is completed, the second operation event is injected to achieve accurate long press operation.
It realizes accurate control of the control's long press time, improves the accuracy of the long press time, avoids uncertainty caused by step length, and improves testing efficiency.
Smart Images

Figure CN113127114B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automation technology, and in particular to a control method, device, electronic device and storage medium for controlling control time. Background Art
[0002] Currently, the main method for implementing a long press is to call the UIAutomator swipe method and control the long press duration using the step parameter. This step-based control doesn't accurately control the long press duration. For example, if you need to long press a control for 3 seconds, you don't know how large the step parameter should be to achieve 3 seconds. Multiple parameter adjustments are required to find a rough estimate. If the step parameter is set too low, the long press effect won't be achieved. If the step parameter is set too high, the waiting time for the step parameter is too long, resulting in reduced test efficiency. Therefore, the existing technology suffers from low accuracy in long press duration control. Summary of the Invention
[0003] An embodiment of the present invention provides a method for controlling the time of a control, which can improve the accuracy of the long press time of a control.
[0004] In a first aspect, an embodiment of the present invention provides a method for controlling a control time, the method comprising the following steps:
[0005] Acquire control information, wherein the control information includes a target control object;
[0006] Injecting a first operation event into the target control object, simulating the first operation event, and controlling a simulation time of simulating the first operation event through a time function;
[0007] If the simulation of the first operation event is completed, a second operation event is injected into the target control object to simulate the second operation event.
[0008] In a second aspect, an embodiment of the present invention further provides a device for controlling a control time, comprising:
[0009] An acquisition module, configured to acquire control information, wherein the control information includes a target control object;
[0010] An injection module, configured to inject a first operation event into the target control object, simulate the first operation event, and control a simulation time of the first operation event through a time function;
[0011] If the simulation of the first operation event is completed, a second operation event is injected into the target control object to simulate the second operation event.
[0012] In a third aspect, an embodiment of the present invention further provides an electronic device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the control method for controlling the control time provided in the embodiment when executing the computer program.
[0013] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the control method of the control time provided by the embodiment are implemented.
[0014] In an embodiment of the present invention, by acquiring control information, the control information includes a target control object; injecting a first operation event into the target control object, simulating the first operation event, and controlling the simulation time of the first operation event through a time function; if the simulation of the first operation event ends, injecting a second operation event into the target control object and simulating the second operation event. For automated testing, after acquiring control information, the embodiment of the present invention injects a first operation event into the target control object and simulates the first operation event, and controls the duration of the simulation of the first operation event based on a time function, thereby achieving a long press effect. After the simulation of the first operation event ends, the second operation event is injected into the target control object and simulated to complete the entire operation simulation process; and the time parameter of the above-mentioned time function can reach the millisecond level, which can more accurately control the long press time, avoid sliding the touch area of the target control object in a step-by-step manner to achieve a long press effect, resulting in the problem that the step parameter setting cannot be determined, which is beneficial to improving the accuracy of the control long press time. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0016] Figure 1 This is a flow chart of a control time control method provided by an embodiment of the present invention;
[0017] Figure 2 is a flow chart of another control method for control time provided by an embodiment of the present invention;
[0018] Figure 3 is a flow chart of another control method for control time provided by an embodiment of the present invention;
[0019] Figure 4 1 is a schematic structural diagram of a control device for a control time provided by an embodiment of the present invention;
[0020] Figure 5 1 is a schematic structural diagram of another control device for control time provided by an embodiment of the present invention;
[0021] Figure 6 1 is a schematic structural diagram of another control device for control time provided by an embodiment of the present invention;
[0022] Figure 7 1 is a schematic structural diagram of another control device for control time provided by an embodiment of the present invention;
[0023] Figure 8 1 is a schematic structural diagram of another control device for control time provided by an embodiment of the present invention;
[0024] Figure 9 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0026] The terms "including" and "having" and any variations thereof in the specification, claims and drawings of this application are intended to cover non-exclusive inclusions. The terms "first", "second" and the like in the specification, claims or drawings of this application are used to distinguish different objects rather than to describe a specific order. Reference to "embodiments" herein means that the specific features, structures or characteristics described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0027] like Figure 1 As shown, Figure 1 1 is a flow chart of a control method for controlling control time provided by an embodiment of the present invention, the control method for controlling control time comprising the following steps:
[0028] 101. Get control information, which includes a target control object.
[0029] In this embodiment, the control time control method can be applied to various electronic devices with touchscreen UIAutomator (user interface automation) control systems, such as mobile gaming operating systems, WeChat operating systems, SMS operating systems, and email management systems. The findAccessibilityNodeInfo function (find accessibility / no queryability information) can be selected to locate the target control object to be simulated. When a user controls an operation on the touchscreen with their finger, that operation becomes the target control object targeted by the findAccessibilityNodeInfo function. For example, if a user presses and holds the WeChat chat interface for 2 seconds and a dialog box with functions such as copy, forward, and favorite pops up, the function corresponding to the long-press operation becomes the target control object.
[0030] The above-mentioned control information may refer to the information generated by the control operated by the user, and the control information may include the target control object (UiObject), the coordinate information of the target control object, the time information of the target control object, etc. The above-mentioned target control object may refer to the object of the operation, such as: cancel, confirm, forward, shoot, etc. The above-mentioned coordinate information of the target control object may refer to the position of the target control object in the touch screen, such as: the upper left / right corner of the current interface in the touch screen, etc. For different touch screen interfaces, the position of the target control object is different. For the same touch screen interface, the position information of the target control object in the touch screen interface may also be different due to the different directions of placement of the electronic device configuring the touch screen interface, such as: horizontal screen, vertical screen, split screen, etc. The above-mentioned time information of the target control object may refer to the long press time of the user operating the target control object, such as: 2s, 5s, etc.
[0031] Specifically, because a touch screen is composed of a touch detection component and a touch screen controller, the touch detection component is installed in front of the display screen to detect the user's touch position. After detection, it sends it to the touch screen controller. The touch screen controller receives the touch position sent by the touch detection component, converts it into touch point coordinates, and then sends it to the processor. When the processor receives the touch position, it can search for the control object corresponding to the touch point coordinates. The control object found is the target control object. For example, if a user long presses SMS A on a mobile phone for 1 second, when the touch detection component detects the touch position on the touch screen where SMS A is located and sends it to the touch screen controller, the touch screen controller converts the touch position where SMS A is located into touch point coordinates and then sends them to the processor. The processor searches for the control object based on the touch point coordinates and uses the found control object as the target control object.
[0032] It should be noted that the above-mentioned mobile terminal can be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, players, laptop computers and desktop computers, etc.
[0033] 102. Inject a first operation event and a second operation event into the target control object, simulate the first operation event in advance, and control the simulation time of the first operation event through a time function.
[0034] The first action event mentioned above can be a touchDown event, which indicates a finger pressing down on the screen; the second action event mentioned above can be a touchUp event, which indicates a finger lifting off the screen. The InteractionController can be used to inject touchDown and touchUp events into the target control object, and the injected touchDown events can be simulated in advance. The InteractionController can also be used to inject various other events into the target control object, such as double-clicks, single-clicks, keyboard input, and actions (such as pressing the Send key, waking the screen with the power button, and swiping).
[0035] The time parameter can be used to control the duration of the touchDown event simulation, and the time function can be SystemClock.sleep(time). The time parameter of SystemClock.sleep(time) is in milliseconds and has high precision. Therefore, by using SystemClock.sleep(time) to simulate the duration of the touchDown event on the screen, it is possible to precisely control the simulation duration of the long press operation.
[0036] Specifically, as shown in the embodiment of step 101, after the processor finds the target control object according to the contact coordinates, it can inject the first operation event and the second operation event into the target control object. Injecting the first operation event and the second operation event facilitates the simulation of a complete long press operation. After the event is injected, a time control is required to simulate the first operation event. Therefore, calling the above-mentioned time function SystemClock.sleep(time) can accurately control the simulation time, which is conducive to providing the user with the function corresponding to the target control object quickly and accurately, without causing delays or timeouts. In addition, the user may also perform intermittent continuous operations on the same target control object. If the step size method is used, the accuracy of its time parameters is too low, which may cause erroneous operations to the user. However, by using the above-mentioned time function SystemClock.sleep(time) to control the simulation time of the touchDown event in milliseconds, a more comfortable experience can be provided to users. For example, when playing a game, a user clicks and shoots 10 times within 1 second. These 10 clicks require the simulation of 10 touchDown events and 10 touchUp events. Therefore, the simulation time control accuracy in this process must be in the millisecond level. The above-mentioned time function can accurately control the simulation time of 10 touchDown events.
[0037] 103. If the simulation of the first operation event is completed, simulate the second operation event.
[0038] The above method uses SystemClock.sleep(time) to simulate the duration of a touchDown event on the screen. Once the touchDown event simulation is complete, the touchUp event injected into the target control object via the InteractionController is simulated. Simulating the touchUp event simulates the user controlling the corresponding control object. When the user releases their finger from the screen, the InteractionController simulates the finger release event. Once the simulation is complete, a long press operation is complete.
[0039] In an embodiment of the present invention, by acquiring control information, the control information includes a target control object; injecting a first operation event into the target control object, simulating the first operation event, and controlling the simulation time of the first operation event through a time function; if the simulation of the first operation event ends, injecting a second operation event into the target control object and simulating the second operation event. For automated testing, after acquiring the control information, the embodiment of the present invention injects a first operation event into the target control object and simulates the first operation event, and controls the duration of the simulation of the first operation event based on a time function, thereby achieving a long press effect. After the simulation of the first operation event ends, the second operation event is injected into the target control object and simulated to complete the entire operation simulation process. Moreover, the time parameter of the above-mentioned time function can reach the millisecond level, which can more accurately control the long press time, avoid sliding the touch area of the target control object in a step-by-step manner to achieve a long press effect, resulting in the problem that the step parameter setting cannot be determined, and is conducive to improving the accuracy of the control long press time.
[0040] like Figure 2 As shown, Figure 2 Another method flow chart provided by an embodiment of the present invention includes the following steps:
[0041] 201. Search the control tree and traverse the control nodes on the control tree, where the control nodes include the target control object.
[0042] Among them, the control tree can be a UI (User Interface) tree, which has multiple control nodes. The above-mentioned target control object can be found in the UI tree. The target control object represents a control node on the UI tree. The UI tree can form trees with different structures for different touch screens, which is equivalent to the different structures of the trees constructed by different touch screens. For example, on a UI tree, its control nodes can have name, gender, nationality, place of origin, date of birth, preferences, major, education, etc. The above-mentioned target control object that needs to be operated is found through findAccessibilityNodeInfo. The specific search process is as follows:
[0043] First, the UiObject object finds the UiAutomation object and then notifies it that it wants to retrieve the root node of the AccessibilityNodeInfo type for all elements in the UI tree of the currently active window. This can be done by obtaining a QueryController object from the UiObject object and then calling the findAccessibilityNodeInfo method of that object.
[0044] Secondly, the AccessibilityNodeInfo above represents a node of a control element on the screen. It can also be used as a basis to obtain other control nodes. You can think of all the control nodes on the screen as organized in an XML-like format. Therefore, as long as you know the root node and the target control information specified by the selector UiSelector (selector), you can traverse all window control nodes in the entire UI tree.
[0045] Finally, when the QueryController object obtains the root node, it calls the tranlateCompoundSelector method to traverse all controls in the window until it finds the control object specified by the selector UiSelector.
[0046] It should be clear that the above AccessibilityNodeInfo only represents one control. When traversing the UI tree, once the information of the next control object is needed, it must be obtained again through UiAutomation.
[0047] 202. Get the target control object in the control node.
[0048] Among them, after finding the control object specified by the selector UiSelector, the control object can be obtained. The control object is the target control object mentioned above, and the target control object is the control object currently being operated by the user.
[0049] 203. Inject the first operation event and the second operation event into the target control object, simulate the first operation event in advance, and control the simulation time of the first operation event through a time function.
[0050] 204. If the simulation of the first operation event is completed, simulate the second operation event.
[0051] In an embodiment of the present invention, all control nodes on the control tree are identified until the target control object is found. After the target space object is found, the target control object is acquired, and the first operation event and the second operation event are injected into the target control object. The first operation event is simulated in advance, and the simulation time of the first operation event is controlled by a time function. When the simulation of the first operation event ends, the second operation event is simulated again to achieve a long press effect. Moreover, the time parameter of the time function can reach the millisecond level, which can more accurately control the long press time and avoid the problem of sliding the touch area of the target control object in a step-by-step manner to achieve a long press effect, which makes it impossible to determine the setting of the step parameter. This is conducive to accurately controlling the long press time.
[0052] like Figure 3 As shown, Figure 3 A flowchart of another control method for controlling control time provided for the present invention specifically includes the following steps:
[0053] 301. Obtain control information, where the control information includes a target control object.
[0054] 302. Inject the first operation event and the second operation event into the target control object through the controller.
[0055] The controller may also be called an interaction controller (InteractionController), and the controller may be used to inject the first operation event, the second operation event, or even more operation events into the target control object.
[0056] 303. Pre-call a simulated operation event to simulate the first operation event, and control the simulation time of the first operation event through a time function.
[0057] After injecting both the first and second operation events into the target control object, because the first operation event is a touchDown event and the second operation event is a touchUp event, the touch-down event precedes the touch-up event, creating a sequential relationship. Therefore, a simulated operation event must be pre-invoked to simulate the first operation event. The simulated operation event etch is a class specifically designed to simulate the injected first and second operation events. This class is the foundation for information encapsulation in object-oriented programming and is a user-defined type. Instances of a class are called objects, and each class contains data descriptions and a set of functions that manipulate data or transmit messages.
[0058] Optionally, in step 303 above, the time function is a delay function, and the simulation time steps of simulating the first operation event by controlling the time function include:
[0059] It is detected whether the simulated operation event simulates the first operation event.
[0060] Among them, the screen can be detected in real time to identify whether there is a user operating the screen. When the user's finger presses and touches the screen, the target control object operated by the user can be obtained, and the touchDown event and touchUp event can be injected into the target control object, and the touchDown event can be simulated in advance by simulating the operation event.
[0061] If the simulated operation event is simulating the first operation event, the delay function is called to extend the simulation time of the first operation event through the delay function.
[0062] When a simulated action is simulating a touchDown event, you can call the delay function SystemClock.sleep(time) to extend the touchDown event and precisely control the simulation time. Because the delay function's time parameter is in milliseconds, it allows for more precise control of the simulation time than the step size parameter, achieving a precise long-press effect.
[0063] 304. If the simulation of the first operation event is completed, simulate the second operation event.
[0064] Optionally, the above step 304 includes:
[0065] It is detected whether the simulation of the first operation event is completed by the simulated operation event.
[0066] When the above-mentioned first operation event is simulated through a simulated operation event and the simulation time of the simulated operation event is accurately controlled using a delay function, it is possible to detect whether the simulation of the first operation event by the above-mentioned simulated operation event is completed. For example: if the user long presses the chat object window of the WeChat interface for 2 seconds, the target control object will be obtained, and the touchDown event and touchUp event will be injected into the target control object. The touchDown event is simulated through the simulated operation event, that is, the action of pressing the interface is simulated. The simulation process can be delayed by the above-mentioned delay function SystemClock.sleep(time) to control the simulation operation event so as to accurately control it at the moment of 2s. Because the time parameter of the delay function is accurate to the millisecond level, the simulation time will not exceed 2s, nor will it be less than 2s.
[0067] If the simulation operation event completes the simulation of the first operation event, the simulation operation event is called to simulate the second operation event.
[0068] When the delay function completes the simulation time control of the simulated operation event, it means that the simulated operation event has finished simulating the touchDown event. The end of the simulation can also indicate that the user is about to perform the next operation, that is, lift the finger off the screen. When the user lifts the finger off the screen, the simulated operation event can be called to simulate the previously injected touchUp event. In other words, the action of lifting the finger off the screen is simulated through the simulated operation event, so as to accurately control the simulation time and achieve a long press effect.
[0069] In an embodiment of the present invention, by obtaining control information, extracting the target control object in the control information, and injecting the first operation event and the second operation event into the target control object, the first operation event is simulated in advance through a simulated operation event, and a delay function is called to extend the simulation time of the first operation event through the delay function. When the simulation of the first operation event ends, the simulated operation event is continued to be called to simulate the second operation event, thereby achieving a long press effect. In addition, the time parameter of the above-mentioned time function can reach the millisecond level, which can more accurately control the simulation time of the simulated operation event. The problem of sliding the touch area of the target control object in a step-by-step manner to achieve a long press effect, which makes it impossible to determine the setting of the step-by-step parameter, is avoided, which is conducive to accurately controlling the long press time.
[0070] like Figure 4 As shown, Figure 4 : is a schematic diagram of a control device for a control time according to an embodiment of the present invention. The control device 400 for a control time includes:
[0071] The acquisition module 401 is used to acquire control information, which includes a target control object;
[0072] The control module 402 is used to inject the first operation event and the second operation event into the target control object, simulate the first operation event in advance, and control the simulation time of the first operation event through a time function;
[0073] The simulation module 403 is configured to simulate a second operation event if the simulation of the first operation event is completed.
[0074] Optional, such as Figure 5 As shown, Figure 5 4 is a schematic diagram of the structure of another control device for control time provided by an embodiment of the present invention. The acquisition module 401 includes:
[0075] A search unit 4011 is used to search the control tree and traverse the control nodes on the control tree, where the control nodes include the target control object.
[0076] The acquisition unit 4012 is used to acquire the target control object in the control node.
[0077] Optional, such as Figure 6 As shown, Figure 6 4 is a schematic diagram of the structure of another control device for control time provided by an embodiment of the present invention. The control module 402 includes:
[0078] The injection unit 4021 is configured to inject the first operation event and the second operation event into the target control object through the controller;
[0079] The calling unit 4022 is configured to pre-call a simulated operation event to simulate the first operation event.
[0080] Optional, such as Figure 7 As shown, Figure 7 4 is a schematic diagram of the structure of another control device for control time provided by an embodiment of the present invention. The control module 402 further includes:
[0081] A first detection unit 4023 is configured to detect whether the simulated operation event simulates the first operation event;
[0082] The control unit 4024 is configured to call the time function if the simulated operation event is simulating the first operation event, and extend the simulation time of the first operation event through the time function.
[0083] Optional, such as Figure 8 As shown, Figure 8 4 is a schematic diagram of the structure of another control device for control time provided by an embodiment of the present invention. The simulation module 403 includes:
[0084] The second detection unit 4031 is used to detect whether the simulation operation event has completed the simulation of the first operation event;
[0085] The simulation unit 4032 is configured to call the simulated operation event to simulate the second operation event if the simulated operation event completes the simulation of the first operation event.
[0086] The control device for control time provided in the embodiment of the present invention can implement each process implemented by the control method for control time in the above method embodiment and can achieve the same beneficial effects. To avoid repetition, it will not be described here.
[0087] like Figure 9 As shown, Figure 9This is a structural diagram of an electronic device provided in an embodiment of the present invention. The electronic device 900 includes: a memory 902, a processor 901, a network interface 903, and a computer program stored in the memory 902 and executable on the processor 901. When the processor 901 executes the computer program, the steps in the control method of the control time provided in the embodiment are implemented.
[0088] Specifically, the processor 901 is configured to perform the following steps:
[0089] Get control information, including the target control object;
[0090] Injecting a first operation event and a second operation event into a target control object, simulating the first operation event in advance, and controlling a simulation time of the first operation event through a time function;
[0091] If the simulation of the first operation event is completed, the simulation of the second operation event is performed.
[0092] Optionally, the step of obtaining control information executed by the processor 901 includes:
[0093] Search the control tree and traverse the control nodes on the control tree, which include the target control object;
[0094] Gets the target control object in the control node.
[0095] Optionally, the step of injecting the first operation event and the second operation event into the target control object and pre-simulating the first operation event executed by the processor 901 includes:
[0096] Injecting the first operation event and the second operation event into the target control object through the controller;
[0097] A simulated operation event is called in advance to simulate the first operation event.
[0098] Optionally, the simulation time step of simulating the first operation event by controlling the time function executed by the processor 901 includes:
[0099] detecting whether the simulated operation event simulates the first operation event;
[0100] If the simulated operation event is simulating the first operation event, the time function is called to extend the simulation time of the first operation event through the time function.
[0101] Optionally, if the simulation of the first operation event is completed, the step of simulating the second operation event executed by the processor 901 includes:
[0102] Detecting whether the simulated operation event has completed the simulation of the first operation event;
[0103] If the simulation operation event completes the simulation of the first operation event, the simulation operation event is called to simulate the second operation event.
[0104] It should be noted that the electronic device 900 on which the control time control method is executed can obtain control information via a wired connection or a wireless connection. It should be noted that the above-mentioned wireless connection method may include but is not limited to 3G / 4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.
[0105] The electronic device 900 provided in the embodiment of the present invention can implement various implementations of the control method of the control time and the corresponding beneficial effects, which will not be described here in order to avoid repetition.
[0106] It should be noted that the figure only shows components 901-903, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead. Among them, those skilled in the art will understand that the electronic device 900 here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc.
[0107] The electronic device 900 may be a computing device such as a desktop computer, a notebook computer, a palmtop computer, etc. The electronic device 900 may interact with a user via a keyboard, a mouse, a remote controller, a touchpad, or a voice control device.
[0108] The aforementioned memory 902 includes at least one type of readable storage medium, including flash memory, a hard disk, a multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, and the like. In some embodiments, the memory 902 may be an internal storage unit of the electronic device 900, such as the hard disk or internal memory of the electronic device 900. In other embodiments, the memory 902 may also be an external storage device of the electronic device 900, such as a plug-in hard disk, a SmartMedia Card (SMC), a Secure Digital (SD) card, a flash memory card, and the like. Of course, the memory 902 may also include both the internal storage unit of the electronic device 900 and its external storage device. In this embodiment, the memory 902 is typically used to store the operating system and various application software installed on the electronic device 900, such as the program code of the control time control method. In addition, the memory 902 can also be used to temporarily store various types of data that have been output or will be output.
[0109] In some embodiments, the processor 901 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 901 is typically used to control the overall operation of the electronic device 900. In this embodiment, the processor 901 is used to execute program code stored in the memory 902 or process data, such as executing program code for a method for controlling control time.
[0110] The network interface 903 may include a wireless network interface or a wired network interface. The network interface 903 is generally used to establish a communication connection between the electronic device 900 and other electronic devices.
[0111] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by the processor 901, the various processes in the control method of the control time provided in the embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0112] Those skilled in the art will appreciate that all or part of the processes in the embodiment methods can be implemented by instructing related hardware through a computer program. The program can be stored in a computer-readable storage medium. When executed, the program can include the processes in the embodiment methods. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory 1002 (RAM).
[0113] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0114] The above disclosure is merely a preferred embodiment of the present invention and certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A control method for control time, characterized in that: The following steps are involved: Acquire control information, wherein the control information includes a target control object; Injecting a first operation event and a second operation event into the target control object, simulating the first operation event in advance, and controlling a simulation time of simulating the first operation event through a time function; If the simulation of the first operation event is completed, simulating the second operation event; The step of obtaining control information includes: Searching a control tree, and traversing control nodes on the control tree, wherein the control nodes include a target control object; Obtain the target control object in the control node; The control information refers to the information generated by the control operated by the user, including the target control object (UiObject), the coordinate information of the target control object, the time information of the target control object, etc. The target control object refers to the object of the operation; the coordinate information of the target control object refers to the position of the target control object on the touch screen; Specifically, since the touch screen is composed of a touch detection component and a touch screen controller, the touch detection component is installed in front of the display screen to detect the user's touch position, and sends it to the touch screen controller after detection. The touch screen controller receives the touch position sent by the touch detection component, converts it into touch point coordinates, and then sends it to the processor; when the processor receives the touch position, it searches for the control object corresponding to the touch point coordinates, and the control object found is the target control object.
2. The control method of control time according to claim 1, characterized in that: The step of injecting the first operation event and the second operation event into the target control object and simulating the first operation event in advance comprises: Injecting the first operation event and the second operation event into the target control object through a controller; A simulated operation event is called in advance to simulate the first operation event.
3. The control method of control time according to claim 2, characterized in that: The simulation time step of simulating the first operation event by controlling the time function includes: detecting whether the simulated operation event simulates the first operation event; If the simulated operation event is simulating the first operation event, the time function is called to extend the simulation time of the first operation event through the time function.
4. The control method of control time according to claim 2, characterized in that: If the simulation of the first operation event is completed, the step of simulating the second operation event includes: detecting whether the simulated operation event has completed simulation of the first operation event; If the simulation of the first operation event by the simulated operation event is completed, the simulated operation event is called to simulate the second operation event.
5. A control device for control time, characterized in that: include: An acquisition module, configured to acquire control information, wherein the control information includes a target control object; A control module, configured to inject a first operation event and a second operation event into the target control object, simulate the first operation event in advance, and control a simulation time of the first operation event through a time function; a simulation module, configured to simulate the second operation event if the simulation of the first operation event is completed; The acquisition module includes: A search unit, configured to search a control tree and traverse control nodes on the control tree, wherein the control nodes include a target control object; An acquiring unit, configured to acquire the target control object in the control node; The control information refers to the information generated by the control operated by the user, including the target control object (UiObject), the coordinate information of the target control object, the time information of the target control object, etc. The target control object refers to the object of the operation; the coordinate information of the target control object refers to the position of the target control object on the touch screen; Specifically, since the touch screen is composed of a touch detection component and a touch screen controller, the touch detection component is installed in front of the display screen to detect the user's touch position, and sends it to the touch screen controller after detection. The touch screen controller receives the touch position sent by the touch detection component, converts it into touch point coordinates, and then sends it to the processor; when the processor receives the touch position, it searches for the control object corresponding to the touch point coordinates, and the control object found is the target control object.
6. The control device for control time according to claim 5, characterized in that: The control module includes: an injection unit, configured to inject the first operation event and the second operation event into the target control object through a controller; The calling unit is configured to pre-call a simulated operation event to simulate the first operation event.
7. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the control method of any one of claims 1 to 4 when executing the computer program.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the control time control method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Game automated testing method and related device
CN107025165A