Screen display function test method and device, electronic equipment and storage medium
By adjusting the background brightness using configuration instructions and color values in the OSD function test of the network camera, and generating test pictures to determine the test results, the problems of low testing efficiency and low accuracy in the prior art are solved, and efficient and accurate screen display function testing is achieved.
Patent Information
- Application Number
- CN202411804577.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, when testing the OSD function of a network camera, there are problems such as low testing efficiency and low accuracy of test results.
A test method for screen display function is provided. By sending configuration instructions to the device to be tested, adjusting the background brightness of the display screen according to the first color value of the first text in the configuration data, acquiring video streams and generating test pictures, obtaining the second text and position information therefrom, and determining the test results of the screen display function.
The contrast between the first text and the background is improved, the accuracy of the second text and position information is improved, and the multi-dimensional testing of the screen display function of the equipment to be tested is realized, the accuracy and reliability of the test results are improved, and automated testing is supported, which improves the testing efficiency.
Smart Images

Figure CN119893077A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and in particular relates to a method, device, electronic equipment and storage medium for testing screen display functions. Background Art
[0002] In the video surveillance system, the On-Screen Display (OSD) function of the IP Camera (IPC) is crucial. The IP Camera can display various information on the video screen through the OSD function, such as time, date, camera number, etc.
[0003] At present, in the R&D test and production test process of network cameras, the test of the OSD function of network cameras is mainly carried out manually, requiring testers to manually input various test data and observe the display effect on the network camera screen. This testing method is not only time-consuming and labor-intensive, but also inefficient, and easily affects the accuracy of the test results due to human factors. Summary of the invention
[0004] The embodiments of the present invention provide a method, device, electronic device and storage medium for testing screen display function, which can solve the problems of low test efficiency and low test result accuracy in the process of testing the OSD function of a network camera in the related art.
[0005] In order to solve the above problem, an embodiment of the present invention discloses a method for testing a screen display function, the method comprising:
[0006] Sending a configuration instruction to the device under test; the configuration instruction carries configuration data, and the configuration instruction is used to instruct the device under test to configure the screen display function of the device under test according to the configuration data; the configuration data includes a first text, first position information of the first text, and a first color value of the first text;
[0007] According to the first color value, adjusting the background brightness of the display screen of the device under test to a target display brightness;
[0008] Obtaining a video stream of the device under test and generating a test picture corresponding to the video stream;
[0009] Acquire a second text in the test image and second position information of the second text;
[0010] A test result of the screen display function of the device under test is determined according to the second text, the second location information and the configuration data.
[0011] On the other hand, an embodiment of the present invention discloses a device for testing a screen display function, the device comprising:
[0012] A sending module, used for sending a configuration instruction to the device under test; the configuration instruction carries configuration data, and the configuration instruction is used for instructing the device under test to configure the screen display function of the device under test according to the configuration data; the configuration data includes a first text, first position information of the first text, and a first color value of the first text;
[0013] An adjustment module, used for adjusting the background brightness of the display screen of the device under test to a target display brightness according to the first color value;
[0014] A first acquisition module, used to acquire a video stream of the device under test and generate a test picture corresponding to the video stream;
[0015] A second acquisition module, used to acquire a second text in the test image and second position information of the second text;
[0016] A determination module is used to determine a test result of the screen display function of the device under test according to the second text, the second location information and the configuration data.
[0017] On the other hand, an embodiment of the present invention further discloses an electronic device, which includes a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the aforementioned screen display function test method.
[0018] The embodiment of the present invention further discloses a readable storage medium. When the instructions in the readable storage medium are executed by the processor of the electronic device, the electronic device can execute the aforementioned test method for the screen display function.
[0019] The embodiments of the present invention include the following advantages:
[0020] The embodiment of the present invention provides a method for testing a screen display function. After sending a configuration instruction to a device under test, the background brightness of the display screen of the device under test is adjusted to a target display brightness according to the first color value of the first text in the configuration data carried in the configuration instruction, so as to improve the contrast between the first text and the background in the display screen of the device under test, improve the accuracy of the second text obtained from the test picture and the second position information of the second text, and thus improve the accuracy of the test result of the screen display function of the device under test determined according to the second text, the second position information and the configuration data. Further, the embodiment of the present invention determines the test result of the screen display function of the device under test according to the second text, the second position information and the configuration data in the test picture, realizes a multi-dimensional test of the screen display function of the device under test, improves the comprehensiveness of the test of the screen display function of the device under test, further improves the accuracy and reliability of the test result of the screen display function of the device under test determined by the embodiment of the present invention, and the test method of the screen display function provided by the embodiment of the present invention can be performed automatically, which improves the efficiency of the screen display function test of the device under test. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0022] Figure 1 It is a flowchart of the steps of a method for testing a screen display function provided by an embodiment of the present invention;
[0023] Figure 2 It is a logic block diagram of an automated testing environment provided by an embodiment of the present invention;
[0024] Figure 3 is a flowchart of another method for testing a screen display function provided by an embodiment of the present invention;
[0025] Figure 4 It is a logic block diagram of a test device for screen display function provided by an embodiment of the present invention;
[0026] Figure 5 It is a structural block diagram of an electronic device for testing a screen display function provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are 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 creative work are within the scope of protection of the present invention.
[0028] Method Embodiment
[0029] Reference Figure 1 , shows a flowchart of a method for testing a screen display function provided by an embodiment of the present invention, the method may specifically include the following steps:
[0030] Step S101, sending a configuration instruction to the device under test; the configuration instruction carries configuration data, and the configuration instruction is used to instruct the device under test to configure the screen display function of the device under test according to the configuration data; the configuration data includes a first text, first position information of the first text, and a first color value of the first text.
[0031] Step S102: adjusting the background brightness of the display screen of the device under test to a target display brightness according to the first color value.
[0032] Step S103: Acquire the video stream of the device under test, and generate a test picture corresponding to the video stream.
[0033] Step S104: Acquire a second text in the test image and second position information of the second text.
[0034] Step S105: Determine a test result of the screen display function of the device under test according to the second text, the second location information and the configuration data.
[0035] The screen display function testing method provided in the embodiment of the present invention can be applied to any electronic device with data processing function, which may include but is not limited to: smart terminals, computers, personal digital assistants (PDAs), tablet computers, e-book readers, laptop computers, vehicle-mounted devices, smart televisions, wearable devices, etc.
[0036] An automated test environment is built in the electronic device, and the electronic device can test the screen display function of the device under test by running the automated test environment.
[0037] Reference Figure 2, shows a logic block diagram of an automated testing environment provided by an embodiment of the present invention, the automated testing environment includes an automated testing framework, a runtime library on which the automated testing framework depends, and a processing engine on which the runtime library depends.
[0038] Among them, the automated testing framework is an infrastructure that provides support for automated testing of screen display functions. Testers can use the automated testing framework to write, organize and execute test cases corresponding to the device under test to implement operations corresponding to steps S101 to S105.
[0039] The automated testing framework relies on some runtime libraries when executing test cases. The runtime library is a package library of some processing engines, and the use of the runtime library depends on the processing engine packaged by the runtime library. In the process of building an automated testing framework in an electronic device according to an embodiment of the present invention, it is also necessary to install the processing engines packaged by each runtime library.
[0040] The processing engine encapsulated by the runtime library is used to implement specific functions during the test of the screen display function, such as audio and video processing, optical character recognition (OCR), test report generation, etc.
[0041] In an embodiment of the present invention, the processing engine may include but is not limited to: an OCR engine, an audio and video processing engine, and a test report engine, etc. The OCR engine is used to convert the text information in the test image into structured text content readable by the electronic device through optical character recognition technology and obtain the relative position information of the structured text content in the test image, and obtain the second text in the test image and the second position information of the second text; the audio and video processing engine is used to encapsulate the video frame data into a test image in a preset format; the test report engine is used to collect the test results obtained by the automated test framework through step S105, and generate a test report based on the test results.
[0042] The automated testing framework can be a testing framework for building projects based on open source testing frameworks such as unittest and pytest. The automated testing framework can develop test cases corresponding to the device under test according to the selected framework coding, manage test cases and automatically execute test cases.
[0043] As an example, the tester uses the python language to build an automated test framework and obtains an automated test framework based on pytest. The automated test framework depends on some operating environments (for example, the python operating environment) and operating libraries (for example, pytest, loguru, pytest-assume and other python libraries). The pytesseract library and the ffmpy library are required to write test cases corresponding to the device under test in the automated test framework; among them, the pytesseract library is a Python encapsulation library for the Tesseract OCR engine, and the implementation of its underlying functions depends on the Tesseract OCR engine; the ffmpy library is a encapsulation library for the FFmpeg tool, and the implementation of its underlying functions depends on the FFmpeg tool.
[0044] Among them, the Tesseract OCR engine is used as the OCR engine in the embodiment of the present invention, and the Tesseract OCR engine is an open source OCR engine; the FFmpeg (Fast Forward Mpeg) tool is used as the audio and video processing engine in the embodiment of the present invention, and FFmpeg is a set of open source computer programs that can be used to record and convert digital audio and video, and can convert them into streams.
[0045] After the final test case is written, it is automatically run in the automated testing framework to obtain the test results. After obtaining the test results, the automated testing framework can generate a test report. In this process, the automated testing framework depends on the allure-pytest library and the allure-python-commons library, etc. Among them, the allure-python-commons library is an encapsulation library of Allure, and the implementation of its underlying functions depends on the Allure component. Among them, the Allure component serves as the test report engine in the embodiment of the present invention.
[0046] In the embodiment of the present invention, Figure 2 As shown, the automated testing framework includes a device interaction module, a brightness calculation module, an image processing module, and a use case assertion module.
[0047] Among them, the electronic device can use the brightness calculation module to determine the target display brightness corresponding to the background of the display screen of the device under test in step S102. The electronic device can use the device interaction module to send a configuration instruction to the device under test in step S101, and use the device interaction module to adjust the background brightness of the display screen of the device under test to the target display brightness based on the target display brightness determined by the brightness calculation module in step S102, and use the device interaction module to obtain the video stream of the device under test in step S103. The electronic device can use the image processing module to call the audio and video processing engine to generate a test picture corresponding to the video stream based on the video stream obtained by the device interaction module in step S103, and use the image processing module to call the OCR engine to obtain the second text in the test picture and the second position information of the second text in step S104. The electronic device can use the use case assertion module to determine the test result of the screen display function of the device under test in step S105.
[0048] Before the electronic device executes steps S101 to S105 to implement the screen display function test of the device to be tested, the tester can first build an automated testing environment in the electronic device, including building an automated testing framework, installing an OCR engine, an audio and video processing engine, a test report engine, and various runtime libraries.
[0049] After building the automated testing environment in the electronic device, the tester can use the automated testing framework to write test cases corresponding to the device under test, and execute the test cases in the automated testing framework to implement operations corresponding to steps S101 to S105.
[0050] Specifically, before step S101, the electronic device can use the device interaction module to connect to the device under test and call the login authentication interface of the device under test to obtain the authentication information of the device under test; wherein the authentication information refers to user authentication information used to verify whether the user has the right to access the system or specific resources. The authentication information may include but is not limited to token and sessionid.
[0051] In an embodiment of the present invention, the electronic device can use the device interaction module to call the login authentication interface of the device under test through the user name, password or user information such as appkey, secretkey, etc.; when the device under test verifies that the user information is passed, the authentication information is returned to the device interaction module; thereafter, the electronic device can use the device interaction module to interact and communicate with the device under test based on the authentication information.
[0052] As a module that directly interacts with the device under test in the automated testing framework, the device interaction module can, based on the authentication information of the device under test, implement interactive communication between the electronic device and the device under test through communication protocols such as http and websocket. Specifically, the interactive communication between the electronic device and the device under test may include but is not limited to: obtaining the authentication information of the device under test, sending configuration instructions to the device under test, adjusting the background brightness of the display screen of the device under test to the target display brightness, obtaining the video stream of the device under test, etc.
[0053] When the electronic device performs step S101:
[0054] First, configuration data corresponding to the device under test is obtained, wherein the configuration data is test data input by a tester into the electronic device to perform a screen display function test on the device under test.
[0055] The configuration data includes a first text, first position information of the first text, and a first color value of the first text. The first text is the text content that needs to be superimposed on the background of the display screen of the device under test; the first position information is the position information of the first text on the display screen of the device under test, specifically, the first position information can be the vertex coordinates of the text box where the first text is located; the first color value refers to the RGB value of the first text.
[0056] As an example, when the OCR engine is the Tesseract OCR engine, the first position information is: the four bounding box coordinates of the text box where the first text is located (the x-axis coordinate x1 of the upper left corner, the y-axis coordinate y1 of the lower left corner, the x-axis coordinate x2 of the upper right corner, and the y-axis coordinate y2 of the lower right corner).
[0057] As another example, when the OCR engine is the EasyOCR engine, the first position information is: the coordinates of four vertices of the text box where the first text is located (x1, y1, x2, y2, x3, y3, x4, y4).
[0058] Then, the electronic device generates a configuration instruction according to the configuration data, and uses the device interaction module to send the configuration instruction to the device under test, so that the device under test configures the screen display function of the device under test according to the configuration data carried in the configuration instruction, specifically including configuring the first text, the first position information of the first text, and the first color value of the first text in the screen display function of the device under test. It can be understood that after the device under test configures the screen display function, the first text with the first color value is superimposed and displayed at the first position indicated by the first position information in the display screen of the device under test.
[0059] The device under test is any electronic device that needs to test the screen display function. Specifically, the device under test may be an IP camera, and the screen display function is an OSD function.
[0060] When the electronic device performs step S102:
[0061] First, a brightness calculation module is used to determine a target display brightness corresponding to the background of a display screen of the device under test according to a first color value in the configuration data; wherein the target display brightness is a brightness having a maximum contrast ratio with the first color value.
[0062] Specifically, firstly, the first color value (RGB value) is converted to the target color space; then, the brightness or lightness value is extracted from the converted color space; then, according to the required contrast between the first text and the display screen background, a background brightness value having a large difference from the extracted brightness or lightness value is selected; finally, the selected background brightness value is converted back to the RGB value to obtain the target display brightness. The target color space may include but is not limited to the HSV color model and the HSL color model.
[0063] Then, the electronic device uses the device interaction module to send a brightness adjustment instruction to the device under test, the brightness adjustment instruction carries the target display brightness, and the brightness adjustment instruction is used to instruct the device under test to adjust the background brightness of the display screen to the target display brightness.
[0064] Among them, the background of the display screen of the device under test is the screen content of the display screen of the device under test except the first text. In the embodiment of the present invention, the electronic device adjusts the background brightness of the display screen of the device under test to the target display brightness according to the first color value of the first text, and can improve the accuracy of the second text and the second position information of the second text obtained by the electronic device from the test picture through step S104 by improving the contrast between the background of the display screen of the device under test and the first text, thereby improving the accuracy of the test result of the screen display function of the device under test determined according to the second text, the second position information and the configuration data.
[0065] In step S103, first, the electronic device uses the device interaction module to call the websocket interface of the real-time stream of the device under test to receive the video stream of the device under test; then, the electronic device uses the image processing module to call the audio and video processing engine to encapsulate the video stream, generate a picture in a preset format corresponding to the video stream, and obtain a test picture corresponding to the video stream.
[0066] The video stream is a data stream formed by video frames in a display screen of the device under test according to a time sequence relationship; the preset formats may include but are not limited to: jpg, png, bmp, etc.
[0067] In step S104, the electronic device uses the image processing module to call the OCR engine to detect and identify the test image obtained in step S103, converts the text information in the test image into structured text content readable by the electronic device through optical character recognition technology, and determines the structured text content as the second text; thereafter, the electronic device uses the image processing module to call the OCR engine to further identify the relative position information of the second text in the test image, and determines the relative position information as the second position information of the second text.
[0068] The second position information is the position information of the second text on the test image. Specifically, the second position information may be the vertex coordinates of the text box where the second text is located.
[0069] As an example, when the OCR engine is the Tesseract OCR engine, the second position information is: the four bounding box coordinates of the text box where the second text is located (the x-axis coordinate x1' of the upper left corner, the y-axis coordinate y1' of the lower left corner, the x-axis coordinate x2' of the upper right corner, and the y-axis coordinate y2' of the lower right corner).
[0070] As another example, when the OCR engine is the EasyOCR engine, the second position information is: the coordinates of four vertices of the text box where the second text is located (x1', y1', x2', y2', x3', y3', x4', y4').
[0071] In step S105, the electronic device uses the use case assertion module to match the second text obtained in step S104 with the first text in the configuration data; calculates the first distance between the first text and the second text according to the second position information obtained in step S104 and the first position information in the configuration data; when the second text is the same as the first text and the first distance is less than the second preset threshold, it indicates that the second text displayed in the display screen of the device under test and the second position information of the second text in the display screen are consistent with the first text and the first position information in the configuration data, that is, the device under test can correctly execute the screen display function according to the configuration data, and the electronic device can determine that the test result of the screen display function of the device under test is passed; when the second text is not the same as the first text, and / or the first distance is greater than or equal to the second preset threshold, it indicates that the second text displayed in the display screen of the device under test and / or the second position information of the second text in the display screen are inconsistent with the first text and the first position information in the configuration data, that is, the device under test cannot correctly execute the screen display function according to the configuration data, and the electronic device can determine that the test result of the screen display function of the device under test is failed.
[0072] The second text being the same as the first text means that the text content of the second text is the same as the text content of the first text.
[0073] The first distance between the first text and the second text refers to the coordinate distance between the first vertex in the text box where the first text is located and the second vertex in the text box where the second text is located. The electronic device can calculate the first distance between the first text and the second text by the following formula:
[0074]
[0075] Wherein, d represents the first distance; x′1 represents the x-axis coordinate of the second vertex; y′1 represents the y-axis coordinate of the second vertex; x1 represents the x-axis coordinate of the first vertex; and y1 represents the y-axis coordinate of the first vertex.
[0076] The first vertex and the second vertex are vertices at the same position in the text box where the first text is located and the text box where the second text is located; illustratively, when the first vertex is the vertex at the upper left corner of the text box where the first text is located, the second vertex is the vertex at the upper left corner of the text box where the second text is located.
[0077] The second preset threshold is an error threshold that can be used in actual application scenarios to default the second position information of the second text in the display screen to be consistent with the first position information in the configuration data. The second preset threshold can be determined according to actual test needs, and the embodiment of the present invention does not make specific limitations on this; illustratively, the second preset threshold can be 3.
[0078] It should be noted that, when the electronic device is unable to execute step S105 to determine the test result as passed or failed due to reasons of the device under test or the electronic device, the electronic device may determine the test result of the screen display function of the device under test as skipped test without executing step S105.
[0079] An embodiment of the present invention provides a method for testing a screen display function. After sending a configuration instruction to a device under test, the background brightness of a display screen of the device under test is adjusted to a target display brightness according to a first color value of a first text in configuration data carried in the configuration instruction, so as to improve the contrast between the first text and the background in the display screen of the device under test, and improve the accuracy of a second text and second position information of the second text obtained from a test image. In addition, the electronic device adjusts the background brightness of the display screen of the device under test to the target display brightness according to the first color value, and can also shield the influence of environmental factors (for example, screen content, light environment, etc.) in which the device under test is located on the accuracy of the obtained second text and second position information, which not only improves the accuracy of the test result of the screen display function of the device under test determined according to the second text, the second position information and the configuration data, but also improves the stability and practicality of the test process of the screen display function of the embodiment of the present invention.
[0080] Furthermore, the embodiment of the present invention determines the test result of the screen display function of the device under test based on the second text, the second position information and the configuration data in the test image, taking the second text as a whole, which not only realizes the multi-dimensional test of the screen display function of the device under test, but also ensures the integrity of the second text during the test process, improves the comprehensiveness of the test of the screen display function of the device under test, and further improves the accuracy and reliability of the test result of the screen display function of the device under test determined by the embodiment of the present invention; moreover, the test method of the screen display function provided by the embodiment of the present invention can be automatically performed, has high feasibility, and can quickly develop and execute a large number of test cases for the screen display function, while reducing labor costs, and improving the efficiency of the screen display function test of the device under test.
[0081] Optionally, in step S102, adjusting the background brightness of the display screen of the device under test to a target display brightness according to the first color value includes:
[0082] Step S1021: Calculate the target display brightness corresponding to the device under test according to the first color value.
[0083] Step S1022: calling the brightness adjustment interface of the device under test, and adjusting the background brightness of the display screen of the device under test to the target display brightness through the brightness adjustment interface.
[0084] In an embodiment of the present invention, when the electronic device is adjusting the background brightness of the display screen of the device under test to the target display brightness according to the first color value, it can first calculate the target display brightness corresponding to the device under test according to the first color value through step S1021, and then call the brightness adjustment interface of the device under test through step S1022, and adjust the background brightness of the display screen of the device under test to the target display brightness through the brightness adjustment interface.
[0085] Specifically, in step S1021, the electronic device can use the brightness calculation module to convert the first color value (RGB value) into a target color space; then extract the brightness or lightness value from the converted color space; then, based on the contrast between the required first text and the background of the display screen of the device under test, select a background brightness value that is significantly different from the extracted brightness or lightness value; finally, convert the selected background brightness value back to an RGB value to obtain the target display brightness corresponding to the device under test.
[0086] When determining the target display brightness corresponding to the device under test, the electronic device can use the device interaction module to call the brightness adjustment interface of the device under test, and directly adjust the background brightness of the display screen of the device under test to the target display brightness through the brightness adjustment interface, thereby simplifying the interaction process between the electronic device and the device under test in the process of adjusting the background brightness of the display screen of the device under test to the target display brightness, improving the efficiency of adjusting the background brightness of the display screen of the device under test to the target display brightness, and thereby improving the efficiency of determining the test results of the screen display function of the device under test.
[0087] Optionally, the step S1021 of calculating the target display brightness corresponding to the device under test according to the first color value includes:
[0088] Step A11: Calculate a first relative brightness of the first text according to the first color value.
[0089] Step A12: when the absolute value of the difference between the first relative brightness and the first reference value is less than or equal to a first preset threshold, determine the second relative brightness corresponding to the device under test as a second reference value.
[0090] Step A13: determining a target display brightness corresponding to the device under test according to the second relative brightness.
[0091] In the embodiment of the present invention, the process of the electronic device using the brightness calculation module to determine the target display brightness corresponding to the device under test according to the first color value in the configuration data can be implemented through operations corresponding to steps A11 to A13.
[0092] Specifically, in an embodiment of the present invention, the purpose of adjusting the background brightness of the display screen of the device under test to the target display brightness according to the first color value is to maximize the contrast between the background and the first text in the display screen of the device under test, thereby improving the accuracy of the second text and the second position information of the second text obtained by the electronic device from the test picture through step S104.
[0093] In step A11, the electronic device may use a brightness calculation module to calculate a first relative brightness of the first text according to the first color value of the first text by using the following formula:
[0094] L1=0.2126×R1+0.7152×G1+0.0722×B1 (2)
[0095] Wherein, L1 represents the first relative brightness; R1, G1 and B1 represent the values of the three color channels of red (Red, R), green (Green, G), and blue (Bule, B) in the first color value respectively. The values of R, G and B are as follows: if XsRGB≤0.03928, then X=XsRGB / 12.92; otherwise X=((XsRGB+0.055) / 1.055) 2.4 ; XsRGB here refers to RsRGB, GsRGB or BsRGB, and the value is XsRGB=X8bit / 255, where X8bit refers to the values of R, G, and B channels, each of which has an 8-bit / channel value of 0 to 255.
[0096] The contrast ratio between the background and the first text in the display screen of the device under test refers to the degree of difference between the color values of the background and the first text in the display screen.
[0097] As an optional implementation, when the first relative brightness is obtained, the electronic device can use the brightness calculation module to calculate the second relative brightness corresponding to the device under test according to the first relative brightness and the target contrast by the following formula:
[0098] C=(L1+0.05) / (L2+0.05) (3)
[0099] Wherein, C represents the target contrast; L2 represents the second relative brightness. It should be noted that the target contrast is the expected contrast between the background and the first text in the display screen of the device under test; the second relative brightness refers to the relative brightness of the background in the display screen of the device under test.
[0100] As another optional implementation, according to Formula 3, it can be seen that the size of the contrast mainly depends on the proportional relationship between L1 and L2; if the first relative brightness L1 is close to 1, the second relative brightness L2 of the background is 0 to maximize the contrast C; if the first relative brightness L1 is close to 0, the second relative brightness L2 of the background is 1 to maximize the contrast C. Therefore, in the process of determining the second relative brightness, the electronic device can calculate the absolute value of the difference between the first relative brightness and the first reference value through step A12.
[0101] When the absolute value of the difference between the first relative brightness and the first reference value is less than or equal to the first preset threshold, it indicates that the first relative brightness is close to the first reference value. In order to increase the contrast between the background and the first text in the display screen, the second relative brightness can be determined as the second reference value.
[0102] When the absolute value of the difference between the first relative brightness and the first reference value is greater than the first preset threshold, it indicates that the first relative brightness is significantly different from the first reference value. In order to increase the contrast between the background and the first text in the display image, the second relative brightness can be determined as the first reference value.
[0103] Among them, the first reference value and the second reference value are both relative brightness reference values, and the second reference value is a relative brightness reference value relative to the first reference value; specifically, when the first reference value is 1, the second reference value is 0; when the first reference value is 0, the second reference value is 1.
[0104] As another optional implementation, when determining the second relative brightness, the electronic device can use the brightness calculation module to determine the second relative brightness as a fourth reference value when the first relative brightness L1 is greater than or equal to the third reference value; and determine the second relative brightness as a fifth reference value when the first relative brightness L1 is less than the third reference value.
[0105] Among them, the third reference value, the fourth reference value and the fifth reference value are all relative brightness reference values; the fourth reference value is a relative brightness reference value relative to the fifth reference value, and the third reference value is an intermediate reference value between the fourth reference value and the fifth reference value; specifically, when the fourth reference value is 1, the fifth reference value is 0, and the third reference value is 0.5; when the fourth reference value is 0, the fifth reference value is 1, and the third reference value is 0.5.
[0106] In the embodiment of the present invention, when determining the second relative brightness corresponding to the device under test, the electronic device may execute step A13 to use the brightness calculation module to calculate and determine the target display brightness corresponding to the device under test according to the second relative brightness using the following formula:
[0107] L2=0.2126×R2+0.7152×G2+0.0722×B2 (4)
[0108] Among them, R2, G2 and B2 represent the values of the red, green and blue color channels in the target display brightness respectively.
[0109] It should be noted that the first color value is the RGB value of the first text, and the target display brightness is the RGB value of the background in the display screen of the device under test. The second relative brightness corresponding to the device under test is the second relative brightness of the background in the display screen of the device under test; the target display brightness corresponding to the device under test is the target display brightness of the background of the display screen of the device under test.
[0110] The screen display function testing method provided by the embodiment of the present invention improves the contrast between the background and the first text in the display screen of the device under test, and improves the accuracy of the second text and the second position information of the second text obtained by the electronic device from the test picture through step S104. At the same time, it also improves the flexibility and feasibility of the embodiment of the present invention in determining the target display brightness corresponding to the device under test, thereby improving the practicality of the embodiment of the present invention.
[0111] Optionally, the step S105 of determining a test result of a screen display function of the device under test according to the second text, the second location information and the configuration data includes:
[0112] Step S1051: Determine a target area where the second text is located in the test image according to the second position information.
[0113] Step S1052: Obtain a second color value of the target area.
[0114] Step S1053: Determine a test result of the screen display function of the device under test according to the second text, the second position information, the second color value, and the configuration data.
[0115] In an embodiment of the present invention, the electronic device first uses the image processing module to obtain the second color value of the target area where the second text is located in the test image through steps S1051 to S1052, and then uses the use case assertion module to determine the test result according to the second text, the second position information, the second color value and the configuration data, so that the electronic device can determine the test result of the screen display function of the device under test from three dimensions: text content, text position information and text color value, and can more comprehensively detect the correctness of the screen display function of the device under test, further improving the comprehensiveness and accuracy of the test result determined by the electronic device.
[0116] Specifically, in step S1051, the electronic device can use the image processing module to determine the area indicated by the second position information in the test picture as the target area based on the second position information; it can be understood that the second position information is the position information of the second text recognized by the OCR engine in the test picture, and the target area determined by the image processing module through step S1051 is the area where the second text is located in the test picture; further, the second position information is the vertex coordinates of the text box where the second text is located, and the electronic device can use the image processing module to determine the text box determined according to the second position information as the target area where the second text is located.
[0117] In step S1052, the electronic device can use the image processing module to first traverse the color values (RGB values) of all pixels in the target area and obtain the total number of pixels in the target area; then, calculate the sum of the color values of all pixels in the target area; finally, calculate the ratio of the sum of the color values of all pixels in the target area to the total number, and determine the ratio as the second color value of the target area; it can be understood that the second color value is the average color value of each pixel in the target area.
[0118] When the electronic device uses the image processing module to obtain the second color value of the target area through step S1052, it can use the use case assertion module to determine the test result of the screen display function of the device under test according to the second text, second position information, second color value and configuration data through step S1053.
[0119] Optionally, the step S1053 of determining the test result of the screen display function of the device under test according to the second text, the second position information, the second color value and the configuration data includes:
[0120] Step A21: Calculate a first distance between a second position where the second text is located and a first position where the first text is located according to the second position information and the first position information in the configuration data.
[0121] Step A22: Calculate a second distance between the second color value and the first color value in the configuration data according to the second color value.
[0122] Step A23: Match the second text with the first text in the configuration data.
[0123] Step A24: When the second text is the same as the first text, the first distance is less than a second preset threshold, and the second distance is less than a third preset threshold, determine that the test result of the screen display function of the device under test is passed.
[0124] Step A25: When the second text is different from the first text, and / or the first distance is greater than or equal to a second preset threshold, and / or the second distance is greater than or equal to a third preset threshold, determine that the test result of the screen display function of the device under test is failure to pass the test.
[0125] In an embodiment of the present invention, the process of the electronic device using the use case assertion module to determine the test result of the screen display function of the device under test according to the second text, the second location information, the second color value and the configuration data can be specifically implemented through the operations corresponding to steps A21 to A25.
[0126] The method of calculating the first distance between the second position of the second text and the first position of the first text in step A21 can refer to the specific description of step S105, which will not be repeated here to avoid repetition.
[0127] In step A22, the electronic device may use the use case assertion module to calculate the Euclidean distance between the second color value and the first color value according to the second color value and the first color value in the configuration data by the following formula, and determine the Euclidean distance as the second distance between the second color value and the first color value:
[0128]
[0129] Wherein, D represents the Euclidean distance between the second color value and the first color value; R3, G3 and B3 represent the values of the three color channels of red, green and blue in the second color value respectively.
[0130] When the second text is acquired, the electronic device may use the use case assertion module to match the second text with the first text in the configuration data through step A23 to determine whether the second text is the same as the first text.
[0131] When the first distance is obtained through step A21, the electronic device may use the use case assertion module to match the first distance with the second preset threshold to determine the magnitude relationship between the first distance and the second preset threshold.
[0132] When the second distance is obtained through step A22, the electronic device can use the use case assertion module to match the second distance with the third preset threshold to determine the size relationship between the second distance and the third preset threshold. The third preset threshold is an error threshold that can be used in actual application scenarios to default that the second color value of the second text in the display screen of the device under test is consistent with the first color value in the configuration data. The third preset threshold can be determined according to actual test needs, and the embodiment of the present invention does not specifically limit this; for example, the third preset threshold can be 5.
[0133] Specifically, when the second text is the same as the first text, the first distance is less than the second preset threshold, and the second distance is less than the third preset threshold, it indicates that the second text displayed in the display screen of the device under test, the second position information of the second text in the display screen, and the second color value of the second text in the display screen are consistent with the first text, first position information and first color value in the configuration data, that is, the device under test can correctly execute the screen display function according to the configuration data, and the electronic device can determine that the test result of the screen display function of the device under test is passed.
[0134] When the second text is different from the first text, and / or the first distance is greater than or equal to the second preset threshold, and / or the second distance is greater than or equal to the third preset threshold, it indicates that the second text displayed in the display screen of the device under test, and / or the second position information of the second text in the display screen, and / or the second color value of the second text in the display screen are inconsistent with the first text, first position information and first color value in the configuration data, that is, the device under test cannot correctly execute the screen display function according to the configuration data, and the electronic device can determine that the test result of the screen display function of the device under test is failed.
[0135] In the screen display function testing method provided by the embodiment of the present invention, the electronic device uses a use case assertion module to determine the test result of the screen display function of the device under test according to the information of three dimensions of the second text, the second position information, the second color value and the configuration data. The correctness of the screen display function of the device under test can be more comprehensively detected, and the comprehensiveness and accuracy of the test result determined by the electronic device are further improved.
[0136] Optionally, the step S103 of generating a test picture corresponding to the video stream includes:
[0137] Step S1031: Acquire key frame data of the video stream, and store the key frame data in a preset storage area.
[0138] Step S1032: Acquire the key frame data from the preset storage area.
[0139] Step S1033: encapsulate the key frame data to obtain a first picture in a preset format.
[0140] Step S1034: adjust the brightness and contrast of the first picture to obtain a test picture corresponding to the video stream.
[0141] In an embodiment of the present invention, when the electronic device is generating a test picture corresponding to a video stream, first, the device interaction module is used to execute S1031 to obtain the key frame (I frame) data of the video stream, and the key frame data is stored in a preset storage area; then, the image processing module is used to execute S1032 to step S1034 to generate a test picture corresponding to the video stream.
[0142] The preset storage area is a preset storage area accessible to the electronic device. Exemplarily, the preset storage area is a file system of the electronic device.
[0143] Specifically, after the electronic device uses the image processing module to obtain the key frame data from the preset storage area through step S1032, it can continue to use the image processing module to execute step S1033 to call the audio and video processing engine to encapsulate the key frame data into a first picture in a preset format.
[0144] After obtaining the first picture, the image processing module uses the basic image processing library to fine-tune the brightness and contrast of the first image to obtain a test picture, so as to further improve the brightness and contrast of the test picture, thereby improving the accuracy of the second text and the second position information of the second text obtained by the electronic device from the test picture.
[0145] Among them, the basic image processing library is one of the runtime libraries that the automated testing framework relies on.
[0146] Optionally, the screen display function testing method provided by the embodiment of the present invention further includes:
[0147] Step S106: Generate a test report of the screen display function of the device under test according to the test result of the screen display function of the device under test.
[0148] In the embodiment of the present invention, when the electronic device determines the test result of the screen display function of the device under test through step S105, it can execute step S106 to generate a test report of the screen display function of the device under test according to the test result of the screen display function of the device under test.
[0149] Specifically, the electronic device can call the test report engine, use the test report engine to obtain log information corresponding to the test result according to the test result of the screen display function of the device under test, and generate a test report in a target format based on the test result and the log information corresponding to the test result.
[0150] The test report may include, but is not limited to: the test results corresponding to each test case, the log information of each test step corresponding to the test result, etc. The test results include passed test, failed test and skipped test.
[0151] When an electronic device generates a test report for the screen display function of the device under test, the tester can analyze and adjust the screen display function of the device under test based on the test report. There is no need for the tester to manually participate in the entire screen display function testing process, which not only improves the test efficiency but also reduces labor costs.
[0152] As an example, see Figure 3 , shows a flowchart of another method for testing a screen display function provided by an embodiment of the present invention, wherein the method may specifically include the following steps S201 to S210:
[0153] Step S201: Building an automated testing environment.
[0154] Specifically, testers can build an automated testing environment in electronic devices, including building an automated testing framework based on pytest, installing the OCR engine Tesseract-OCR, the audio and video processing engine FFmpeg, the test report engine Allure, and the corresponding python basic library.
[0155] Step S202: Use the device interaction module to connect to the device under test and obtain authentication information of the device under test.
[0156] Among them, the device to be tested is an IP camera.
[0157] Specifically, the electronic device uses the device interaction module to connect to the IP camera and calls the login authentication interface to obtain the authentication information token of the IP camera.
[0158] Step S203: Develop automated test cases.
[0159] Specifically, the tester develops test cases corresponding to the IP camera according to the selected framework coding through the automated testing framework.
[0160] Step S204: Use the device interaction module to send configuration instructions to the device under test.
[0161] Specifically, the tester runs the test case through the automated testing framework, and the electronic device uses the device interaction module to call the interface for setting the screen display function of the IP camera based on the token obtained in step S202, simulates user operation, and sends configuration instructions to the IP camera as test input; wherein the configuration instructions are used to instruct the IP camera to configure the screen display function of the IP camera according to the configuration data; the configuration data includes a first text, first position information of the first text, and a first color value of the first text.
[0162] Step S205: Calculate the target display brightness corresponding to the device under test according to the first color value using a brightness calculation module.
[0163] Specifically, the electronic device uses a brightness calculation module to first calculate a first relative brightness of a first text according to a first color value; then, when the absolute value of the difference between the first relative brightness and the first reference value is less than or equal to a first preset threshold, the second relative brightness corresponding to the IP camera is determined as a second reference value; finally, the target display brightness corresponding to the IP camera is determined according to the second relative brightness.
[0164] Step S206: Use the device interaction module to adjust the background brightness of the display screen of the device under test to the target display brightness.
[0165] Specifically, the electronic device uses the device interaction module to call the interface for setting the brightness of the IP camera based on the token obtained in step S202, and adjusts the background brightness of the display screen of the IP camera to the target display brightness.
[0166] Step S207: Determine whether the background brightness of the display screen of the device under test is adjusted successfully.
[0167] Specifically, the electronic device uses the device interaction module to determine whether the operation of adjusting the background brightness of the display screen of the IP camera to the target display brightness in step S206 is executed successfully based on the token obtained in step S202; if the operation is successful, it is determined that the background brightness adjustment of the display screen of the IP camera is successful, and step S208 is executed; if the operation fails, it is determined that the background brightness adjustment of the display screen of the IP camera fails, and step S216 is executed.
[0168] Step S208: Receive the video stream of the device under test by using the device interaction module, obtain key frame data of the video stream and store the key frame data in a preset storage area.
[0169] Specifically, the electronic device uses the device interaction module to call the websocket interface for pulling the real-time stream of the IP camera based on the token obtained in step S202 to receive the video stream of the IP camera, and retains a frame of I frame data in the file system of the electronic device.
[0170] Step S209: Generate a test image based on the key frame data using an image processing module.
[0171] Specifically, first, the electronic device uses an image processing module to obtain key frame data from the file system of the electronic device; then, the electronic device uses the image processing module to call the audio and video processing engine FFmpeg to encapsulate the key frame data into a first picture in jpg format; finally, the electronic device uses the image processing module to use python's PIL basic library to modify the brightness and contrast of the first picture to obtain a test picture, further improve the brightness and contrast of the test picture, and thereby improve the accuracy of the second text and the second position information of the second text obtained by the electronic device from the test picture.
[0172] Step S210: using an image processing module to obtain a second text and second position information of the second text in the test image.
[0173] Specifically, the electronic device uses the image processing module to call the OCR engine through the pytesseract library to detect the test image generated in the recognition step S209, converts the text information in the test image into structured text content readable by the electronic device through optical character recognition technology, and determines the structured text content as the second text; thereafter, the electronic device uses the image processing module to call the OCR engine to further identify the relative position information of the second text in the test image, and determines the relative position information as the second position information of the second text.
[0174] Step S211: Use the use case assertion module to match the second text with the first text in the configuration data, and match the second position information with the first position information in the configuration data.
[0175] Specifically, the electronic device uses the use case assertion module to match the second text with the first text in the configuration data, and returns True if the second text is the same as the first text, otherwise returns False.
[0176] The electronic device uses the use case assertion module to calculate the first distance between the second position where the second text is located and the first position where the first text is located according to the second position information and the first position information in the configuration data. If the first distance is less than the second preset threshold (3), True is returned, otherwise False is returned.
[0177] When the second text is the same as the first text and the first distance is less than 3, it is determined that the second text is consistent with the first text and the second position information is consistent with the first position information, and step S212 is executed; when the second text is not the same as the first text, and / or the first distance is greater than or equal to 3, it is determined that the second text is inconsistent with the first text, and / or the second position information is inconsistent with the first position information, and step S216 is executed.
[0178] Step S212: using the image processing module to obtain a second color value of the target area where the second text is located in the test image.
[0179] Specifically, first, the electronic device uses the image processing module to use the Pillow library through python to determine the target area where the second text is located in the test image according to the second position information; then, the electronic device uses the image processing module to traverse the color values (RGB values) of all pixels in the target area and obtain the total number of pixels in the target area; then, the electronic device uses the image processing module to calculate the sum of the color values of all pixels in the target area; finally, the electronic device uses the image processing module to calculate the ratio of the sum of the color values of all pixels in the target area to the total number, and determines the ratio as the second color value of the target area.
[0180] Step S213: Calculate a second distance between the second color value and the first color value according to the second color value and the first color value in the configuration data using the use case assertion module.
[0181] Specifically, the electronic device calculates the Euclidean distance between the second color value and the first color value in the configuration data using the use case assertion module, and determines the Euclidean distance as the second distance between the second color value and the first color value.
[0182] Step S214: Determine whether the second distance value is less than a third preset threshold by using the use case assertion module.
[0183] Specifically, the electronic device uses the use case assertion module to determine whether the second distance value is less than a third preset threshold; when the second distance is less than the third preset threshold, it returns True and executes step S215; when the second distance is greater than or equal to the third preset threshold, it returns False and executes step S216.
[0184] Step S215: Use the use case assertion module to determine that the test result of the screen display function of the device under test is passed.
[0185] Specifically, the electronic device uses the use case assertion module to determine that the test result of the screen display function of the device under test is passed.
[0186] Step S216: using the use case assertion module to determine that the test result of the screen display function of the device under test is failure to pass the test.
[0187] Specifically, the electronic device uses the use case assertion module to determine that the test result of the screen display function of the device under test is failure to pass the test.
[0188] Step S217: Generate a test report using a test report engine.
[0189] Specifically, the electronic device calls the test report engine Allure, and uses the test report engine Allure to obtain log information corresponding to the test result based on the test result of the screen display function of the IP camera, and generates a test report in a target format based on the test result and the log information corresponding to the test result, which can be used by testers to analyze the results.
[0190] In summary, the embodiment of the present invention provides a method for testing a screen display function. After sending a configuration instruction to a device under test, the background brightness of the display screen of the device under test is adjusted to a target display brightness according to the first color value of the first text in the configuration data carried in the configuration instruction, so as to improve the contrast between the first text and the background in the display screen of the device under test, improve the accuracy of the second text obtained from the test image and the second position information of the second text, and thus improve the accuracy of the test result of the screen display function of the device under test determined according to the second text, the second position information and the configuration data. Further, the embodiment of the present invention determines the test result of the screen display function of the device under test according to the second text, the second position information and the configuration data in the test image, realizes a multi-dimensional test of the screen display function of the device under test, improves the comprehensiveness of the test of the screen display function of the device under test, further improves the accuracy and reliability of the test result of the screen display function of the device under test determined by the embodiment of the present invention, and the test method of the screen display function provided by the embodiment of the present invention can be performed automatically, which improves the efficiency of the screen display function test of the device under test.
[0191] Device Embodiment
[0192] Figure 4 : is a logic block diagram of a test device for screen display function provided by an embodiment of the present invention, and the device may include:
[0193] A sending module 401 is used to send a configuration instruction to the device under test; the configuration instruction carries configuration data, and the configuration instruction is used to instruct the device under test to configure the screen display function of the device under test according to the configuration data; the configuration data includes a first text, first position information of the first text, and a first color value of the first text;
[0194] An adjustment module 402, configured to adjust the background brightness of the display screen of the device under test to a target display brightness according to the first color value;
[0195] A first acquisition module 403 is used to acquire a video stream of the device under test and generate a test picture corresponding to the video stream;
[0196] A second acquisition module 404 is used to acquire a second text in the test image and second position information of the second text;
[0197] The determination module 405 is used to determine the test result of the screen display function of the device under test according to the second text, the second position information and the configuration data.
[0198] Optionally, the adjustment module includes:
[0199] A calculation submodule, used for calculating the target display brightness corresponding to the device under test according to the first color value;
[0200] The adjustment submodule is used to call the brightness adjustment interface of the device under test, and adjust the background brightness of the display screen of the device under test to the target display brightness through the brightness adjustment interface.
[0201] Optionally, the computing submodule includes:
[0202] A first calculation unit, configured to calculate a first relative brightness of the first text according to the first color value;
[0203] A first determining unit, configured to determine a second relative brightness corresponding to the device under test as a second reference value when an absolute value of a difference between the first relative brightness and the first reference value is less than or equal to a first preset threshold;
[0204] The second determining unit is used to determine a target display brightness corresponding to the device under test according to the second relative brightness.
[0205] Optionally, the determining module includes:
[0206] A first determining submodule, configured to determine, in the test image, a target area where the second text is located according to the second position information;
[0207] A first acquisition submodule, used to acquire a second color value of the target area;
[0208] The second determining submodule is used to determine the test result of the screen display function of the device under test according to the second text, the second position information, the second color value and the configuration data.
[0209] Optionally, the second determining submodule includes:
[0210] A second calculation unit, configured to calculate a first distance between a second position where the second text is located and a first position where the first text is located according to the second position information and the first position information in the configuration data;
[0211] a third calculating unit, configured to calculate a second distance between the second color value and the first color value in the configuration data according to the second color value;
[0212] a matching unit, configured to match the second text with the first text in the configuration data;
[0213] A third determining unit, configured to determine that the test result of the screen display function of the device under test is a pass when the second text is the same as the first text, the first distance is less than a second preset threshold, and the second distance is less than a third preset threshold;
[0214] The fourth determination unit is used to determine that the test result of the screen display function of the device under test is failure to pass the test when the second text is different from the first text, and / or the first distance is greater than or equal to a second preset threshold, and / or the second distance is greater than or equal to a third preset threshold.
[0215] Optionally, the first acquisition module includes:
[0216] A second acquisition submodule is used to acquire key frame data of the video stream and store the key frame data in a preset storage area;
[0217] A third acquisition submodule, used to acquire the key frame data from the preset storage area;
[0218] A packaging submodule, used for packaging the key frame data to obtain a first picture in a preset format;
[0219] The adjustment submodule is used to adjust the brightness and contrast of the first picture to obtain a test picture corresponding to the video stream.
[0220] Optionally, the device further comprises:
[0221] The generating module is used to generate a test report of the screen display function of the device under test according to the test result of the screen display function of the device under test.
[0222] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0223] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0224] Reference Figure 5 , is a structural block diagram of an electronic device for testing screen display function provided by an embodiment of the present invention. Figure 5 As shown, the electronic device includes: a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the test method of the screen display function of the aforementioned embodiment.
[0225] The processor may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other editable devices, transistor logic devices, hardware components or any combination thereof. The processor may also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0226] The communication bus may include a path for transmitting information between the memory and the communication interface. The communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The fact that only one line is used in the diagram does not mean that there is only one bus or only one type of bus.
[0227] The memory may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable ReadOnly), a CD-ROM (Compact Disa Read Only), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0228] The embodiment of the present invention also provides a non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device (server or terminal), the processor is able to execute Figure 1 The test method of the screen display function is shown.
[0229] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0230] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0231] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems) and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0232] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0233] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0234] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0235] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0236] The above is a detailed introduction to a screen display function testing method, device, electronic device and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for testing screen display function, characterized in that: The method comprises: Sending a configuration instruction to the device under test; the configuration instruction carries configuration data, and the configuration instruction is used to instruct the device under test to configure the screen display function of the device under test according to the configuration data; the configuration data includes a first text, first position information of the first text, and a first color value of the first text; According to the first color value, adjusting the background brightness of the display screen of the device under test to a target display brightness; Obtaining a video stream of the device under test and generating a test picture corresponding to the video stream; Acquire a second text in the test image and second position information of the second text; A test result of the screen display function of the device under test is determined according to the second text, the second location information and the configuration data.
2. The method according to claim 1, characterized in that The step of adjusting the background brightness of the display screen of the device under test to a target display brightness according to the first color value includes: Calculating the target display brightness corresponding to the device under test according to the first color value; The brightness adjustment interface of the device under test is called, and the background brightness of the display screen of the device under test is adjusted to the target display brightness through the brightness adjustment interface.
3. The method according to claim 2, characterized in that Calculating the target display brightness corresponding to the device under test according to the first color value includes: Calculating a first relative brightness of the first text according to the first color value; When the absolute value of the difference between the first relative brightness and the first reference value is less than or equal to a first preset threshold, determining the second relative brightness corresponding to the device under test as a second reference value; A target display brightness corresponding to the device under test is determined according to the second relative brightness.
4. The method according to claim 1, characterized in that: The step of determining a test result of a screen display function of the device under test according to the second text, the second location information, and the configuration data includes: Determining, in the test picture, a target area where the second text is located according to the second position information; Acquire a second color value of the target area; A test result of the screen display function of the device under test is determined according to the second text, the second position information, the second color value, and the configuration data.
5. The method according to claim 4, characterized in that The step of determining a test result of a screen display function of the device under test according to the second text, the second position information, the second color value, and the configuration data includes: Calculate a first distance between a second position where the second text is located and a first position where the first text is located according to the second position information and the first position information in the configuration data; Calculating a second distance between the second color value and the first color value in the configuration data according to the second color value; Matching the second text with the first text in the configuration data; When the second text is the same as the first text, the first distance is less than a second preset threshold, and the second distance is less than a third preset threshold, determining that the test result of the screen display function of the device under test is passed; When the second text is different from the first text, and / or the first distance is greater than or equal to a second preset threshold, and / or the second distance is greater than or equal to a third preset threshold, it is determined that the test result of the screen display function of the device under test fails the test.
6. The method according to claim 1, characterized in that The generating a test picture corresponding to the video stream includes: Acquire key frame data of the video stream, and store the key frame data in a preset storage area; Acquire the key frame data from the preset storage area; Encapsulating the key frame data to obtain a first picture in a preset format; The brightness and contrast of the first picture are adjusted to obtain a test picture corresponding to the video stream.
7. The method according to claim 1, characterized in that The method further comprises: A test report of the screen display function of the device under test is generated according to the test result of the screen display function of the device under test.
8. A device for testing screen display function, characterized in that: The device comprises: A sending module, used for sending a configuration instruction to the device under test; the configuration instruction carries configuration data, and the configuration instruction is used for instructing the device under test to configure the screen display function of the device under test according to the configuration data; the configuration data includes a first text, first position information of the first text, and a first color value of the first text; An adjustment module, used for adjusting the background brightness of the display screen of the device under test to a target display brightness according to the first color value; A first acquisition module, used to acquire a video stream of the device under test and generate a test picture corresponding to the video stream; A second acquisition module, used to acquire a second text in the test image and second position information of the second text; A determination module is used to determine a test result of the screen display function of the device under test according to the second text, the second location information and the configuration data.
9. An electronic device, characterized in that: The electronic device comprises a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store executable instructions, and the executable instructions enable the processor to execute the screen display function testing method according to any one of claims 1 to 7.
10. A readable storage medium, characterized in that: When the instructions in the readable storage medium are executed by a processor of an electronic device, the processor is enabled to execute the screen display function testing method as claimed in any one of claims 1 to 7.