Method and apparatus for testing screen adaptation
By acquiring and adjusting the size of screenshots to determine the screen adaptation of smart terminal devices, this technology solves the problem of high testing difficulty in existing technologies, achieves efficient screen adaptation testing, and reduces costs and time consumption.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-24
- Publication Date
- 2026-03-20
AI Technical Summary
Existing technologies struggle to perform effective screen adaptation testing on various types of smart terminal devices. In particular, the sheer number of device types makes it impossible to conduct real-device testing on every type of smart terminal device, resulting in high testing difficulty and cost.
By acquiring the display information and desired display style information of the smart terminal device, controlling the display information of the second device and obtaining a screenshot, adjusting the screenshot size to the size of the target device, and generating test results to determine whether the adaptation is successful, direct testing of the real device is avoided.
It enables convenient screen adaptation testing without the need for real devices, reducing testing difficulty and cost, and improving testing efficiency and accuracy.
Smart Images

Figure CN115391164B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of computer, and in particular, to a method and device for testing screen adaptation. BACKGROUND
[0002] With the continuous development of Internet of Things technology, various Internet of Things intelligent terminal devices are constantly emerging in various aspects of life. At present, the screen size, brand, operating system, etc. of intelligent terminal devices are various, in order to ensure that the same content can be normally displayed on different intelligent terminal devices, screen adaptation is one of the problems that must be considered before displaying information on different intelligent terminals.
[0003] For the test of each screen adaptation method, theoretically, it is necessary to test on various types of intelligent terminal devices. However, in some cases, due to the excessive types of intelligent terminal devices, it is impossible to use the corresponding type of real machine to test the screen adaptation of each type of intelligent terminal device. Therefore, in the face of various types of intelligent terminal devices, how to effectively test the screen adaptation is one of the directions worthy of research. SUMMARY
[0004] Embodiments of the present disclosure provide a method and device for testing screen adaptation.
[0005] In a first aspect, embodiments of the present disclosure provide a method for testing screen adaptation, the method comprising: obtaining display information corresponding to a first device and expected display style information; controlling a second device to display the display information corresponding to the first device according to the expected display style information corresponding to the first device, and obtaining a screenshot of the second device displaying the display information corresponding to the first device; adjusting the size of the screenshot to the screen size of the first device; and generating a test result indicating whether the display information corresponding to the first device is successfully adapted and displayed on the first device according to the screenshot after size adjustment.
[0006] In a second aspect, embodiments of the present disclosure provide a device for testing screen adaptation, the device comprising: an obtaining unit configured to obtain display information corresponding to a first device and expected display style information; a control unit configured to control a second device to display the display information corresponding to the first device according to the expected display style information corresponding to the first device, and obtain a screenshot of the second device displaying the display information corresponding to the first device; a size adjustment unit configured to adjust the size of the screenshot to the screen size of the first device; and a generation unit configured to generate a test result indicating whether the display information corresponding to the first device is successfully adapted and displayed on the first device according to the screenshot after size adjustment.
[0007] In a third aspect, embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device storing one or more programs; and when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any implementation manner of the first aspect.
[0008] In a fourth aspect, embodiments of the present disclosure provide a computer readable medium having stored thereon a computer program, which when executed by a processor, implements the method according to any implementation manner of the first aspect.
[0009] The method and device for testing screen adaptation provided by the embodiments of the present disclosure can verify whether the information for display can be successfully adapted and displayed on the first device according to the screen shot after size adjustment, without testing by using the real first device, thereby reducing the difficulty of screen testing and conveniently realizing screen adaptation testing of multiple first devices. BRIEF DESCRIPTION OF DRAWINGS
[0010] Other features, objects, and advantages of the present disclosure will become more apparent from the following detailed description of non-limiting embodiments made with reference to the attached drawings:
[0011] Figure 1 is an exemplary system architecture diagram to which one embodiment of the present disclosure can be applied;
[0012] Figure 2 is a flowchart of one embodiment of the method for testing screen adaptation according to the present disclosure;
[0013] Figure 3 is a schematic diagram of one application scenario of the method for testing screen adaptation according to the embodiments of the present disclosure;
[0014] Figure 4 is a flowchart of another embodiment of the method for testing screen adaptation according to the present disclosure;
[0015] Figure 5 is a structural schematic diagram of one embodiment of the device for testing screen adaptation according to the present disclosure;
[0016] Figure 6 is a structural schematic diagram of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION
[0017] The present disclosure will be further described below in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the related application, and not to limit the application. In addition, it should be noted that, for the sake of description, only the parts related to the application are shown in the drawings.
[0018] It should be noted that the embodiments in the present disclosure and the features in the embodiments can be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
[0019] Figure 1 An exemplary architecture 100 of an embodiment of the method for testing screen adaptation or the device for testing screen adaptation to which the present disclosure can be applied is shown.
[0020] As shown in Figure 1 The system architecture 100 can include terminal devices 101, 103 and a server 102. The terminal devices 101 and the server 102 can be communicatively connected through various wired, wireless communication links or optical fiber cables, etc. The terminal device 103 and the server 102 can also be communicatively connected through various wired, wireless communication links or optical fiber cables, etc.
[0021] The terminal devices 101, 103 can be various electronic devices capable of displaying information. For example, the terminal devices 101, 103 include, but are not limited to, various advertising machines, smart advertising screens, etc., shopping guide screens, self-checkout devices, various smart panels used in smart homes, etc. The screen size, brand, operating system, etc. of the terminal devices 101, 103 can be various.
[0022] The terminal devices 101, 103 can receive and display various display information. Various client applications can be installed on the terminal devices 101, 103 to provide various functions. For example, information display applications, browser applications, video playback applications, etc.
[0023] The server 102 can be a server that provides various services. For example, the server 102 can be a backend server that provides display information for the terminal devices 101, 103. The server 102 can be hardware or software. When the server 102 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When the server 102 is software, it can be implemented as multiple software or software modules (for example, multiple software or software modules used to provide distributed services), or as a single software or software module. No specific limitation is made herein.
[0024] It should be noted that the method for testing screen adaptation provided in the embodiments of this disclosure is generally executed by the server 102, and correspondingly, the device for testing screen adaptation is generally located in the server 102.
[0025] It should be understood that Figure 1 The number of terminal devices and servers shown is merely illustrative. Depending on implementation needs, there can be any number of terminal devices and servers.
[0026] Continue to refer to Figure 2 The document illustrates a flow 200 of an embodiment of a method for testing screen adaptation according to the present disclosure. The method for testing screen adaptation includes the following steps:
[0027] Step 201: Obtain the display information and expected display style information corresponding to the first device.
[0028] In this embodiment, the information to be displayed can be any type of information that can be displayed. The types of information to be displayed can be diverse. For example, the information to be displayed can be text, images, audio, video, etc.
[0029] Display style information can be used to indicate the display style of information. The display style of information can include various display styles of information. For example, the display style includes the size and arrangement of the elements included in the information, the display position of the information, the display format of the information, and so on.
[0030] The display style indicated by the expected display style information can be predetermined based on actual application requirements. The expected display style information can be of various types. For example, it can be code describing the desired display style. Or, it can be a simulated image simulating the display effect of the desired style.
[0031] First equipment (such as) Figure 1 The display information corresponding to the terminal device 103 shown may refer to the information to be displayed on the first device. The expected display style information corresponding to the first device may refer to the display style information corresponding to the display style of the expected display information on the first device.
[0032] The execution body of the method used for testing screen adaptation (e.g.) Figure 1 The server 102 shown can obtain display information and / or expected display style information corresponding to the first device from local and / or other storage devices.
[0033] Generally, for the same display content, different display information and expected display style information corresponding to the display content can be respectively designed according to different screen sizes, so that the terminal devices with different screen sizes can achieve better display effect for the display content.
[0034] For example, for a picture with a size suitable for landscape display, the terminal device in landscape display can directly display the picture, and the terminal device in portrait display can display different image regions obtained by splitting the picture in sequence in portrait.
[0035] Optionally, the display information and the expected display style information corresponding to the first device can be determined according to the screen size of the first device. For example, the local of the execution subject can pre-store a correspondence between device identifiers and the display information and the expected display style information corresponding to the devices. At this time, the execution subject can find the display information and the expected display style information corresponding to the first device according to the device identifier of the first device.
[0036] The device identifier can be various information used to identify a device. For example, the device identifier includes but is not limited to an Internet Protocol address, a MAC (Media Access Control Address) address, a geographic location, and the like.
[0037] In step 202, the second device is controlled to display the display information corresponding to the first device according to the expected display style information, and a screenshot of the second device displaying the display information corresponding to the first device is obtained.
[0038] In this embodiment, the execution subject can control the second device (e.g., the terminal device 101 shown in FIG. 1) to display the display information corresponding to the first device, and display the display information according to the display style indicated by the expected display style information corresponding to the first device. Figure 1
[0039] The second device can pre-store the display information and the expected display style information corresponding to the first device. Alternatively, the execution subject can send the display information and the expected display style information corresponding to the first device to the second device. The second device can display the display information corresponding to the first device according to the display style indicated by the expected display style information corresponding to the first device by using the information display function thereof.
[0040] The execution subject can control the second device to take a screenshot of the screen when displaying the display information corresponding to the first device by calling a preset interface, sending a control instruction, or using various existing remote screenshot technologies, and the like, and then obtain the screenshot from the second device.
[0041] Optionally, the second device can name the screenshot using the device identifier of the first device, so as to distinguish the screenshots corresponding to different first devices.
[0042] In step 203, the size of the screenshot is adjusted to the screen size of the first device.
[0043] In this embodiment, the execution subject can adjust the size of the obtained screenshot. Specifically, the screen size of the first device can be obtained first, and then the size of the screenshot is adjusted to the screen size of the first device.
[0044] The execution subject can pre-store the screen size of the first device locally, or obtain the screen size of the first device from other storage devices according to the device identifier of the first device. Then, the execution subject can adjust the size of the screenshot using various image processing methods to obtain the screenshot after size adjustment.
[0045] It should be noted that the screen size of the first device is usually different from the screen size of the second device. Therefore, when the second device displays the display information corresponding to the first device according to the display style corresponding to the first device, the display information conforming to the display style corresponding to the first device is usually compressed horizontally, stretched vertically, or other scaling operations are performed to adapt to the screen size of the second device. Therefore, the size of the screenshot of the second device when displaying the display information corresponding to the first device is the screen size of the second device, which is different from the screen size of the first device. Therefore, the screenshot with the size of the screen size of the first device needs to be obtained through size adjustment.
[0046] Optionally, for the screenshot after size adjustment, the device identifier of the first device and the screen size of the first device can be combined to name the screenshot, so that the execution subject can distinguish different screenshots.
[0047] In step 204, according to the screenshot after size adjustment, a test result indicating whether the display information is adapted to be displayed successfully on the first device is generated.
[0048] In this embodiment, after obtaining the screenshot after size adjustment, whether the display information can be adapted to be displayed successfully on the first device can be determined by determining whether the display effect of the display information on the first device conforms to the style indicated by the expected display style information, so as to obtain the test result of screen adaptation for the first device.
[0049] If the size-adjusted screenshot conforms to the display effect of the first device according to the expected display style information of the display information, it can be considered that the display information can be successfully adapted to display on the first device. Correspondingly, if the size-adjusted screenshot does not conform to the display effect of the first device according to the expected display style information of the display information, it can be considered that the display information cannot be successfully adapted to display on the first device.
[0050] The above execution subject can determine whether the size-adjusted screenshot conforms to the display effect of the first device according to the expected display style information of the display information in various ways. For example, the user of the above execution subject can determine whether the size-adjusted screenshot conforms to the display effect of the first device according to the expected display style information of the display information, and input the determination result into the above execution subject.
[0051] Optionally, the above execution subject can generate a test result according to the matching result of the actual display style information of the display information corresponding to the first device in the size-adjusted screenshot and the expected display style information corresponding to the first device.
[0052] The matching manner of the actual display style information of the display information corresponding to the first device in the size-adjusted screenshot and the expected display style information corresponding to the first device can be flexibly set according to the actual application scenario.
[0053] For example, when the expected display style information is a simulation diagram simulating the display effect of the display information on the first device, the size-adjusted screenshot can be directly used as the actual display style information, and then various image matching methods are used to match the simulation diagram and the size-adjusted screenshot to obtain the matching result.
[0054] For another example, when the expected display style information is a code describing the expected display style, a code describing the display style of the size-adjusted screenshot can be generated first, and then various text matching methods are used to match the two codes to obtain the matching result.
[0055] In this way, even without the real machine of the first device, the second device can be used to conveniently realize automatic testing of the display effect of the display information on the first device, so that whether the display information can be adapted to display on the first device can be quickly determined, and possible screen adaptation problems can be found in time, testing efficiency is improved, and testing cost is reduced.
[0056] In some optional implementations of the embodiment, the execution subject can send the page in which the information for the second device is displayed according to the expected display style information corresponding to the first device to the second device for display.
[0057] Currently, many intelligent terminals receive and display information through pages (such as H5 pages and the like). Therefore, the execution subject can first generate a page expected to be displayed on the first device according to the expected display style information corresponding to the first device and the information for display corresponding to the first device, and then send the generated page to the second device for display.
[0058] In this case, the second device can directly display the received page, which can reduce the processing pressure of the second device and avoid error conditions that can be caused by the second device performing too many information display processing steps, thereby helping to improve the accuracy of the test results.
[0059] Optionally, the expected display style information can include page layout information and scaling ratio information of page elements. The page layout information can be used to indicate page layout design. For example, the page layout can include structural design (such as the number and position of information display areas), style design (such as page background and color), and the like.
[0060] The scaling ratio information of the page elements can represent the size of the page elements. The scaling ratio information can refer to the scaling ratio of the page elements relative to a specified size. The specified size can be set by a technician according to an actual application scenario in advance.
[0061] Generally, different display styles are designed for the same display content for different screen sizes, and therefore, by analyzing the actual page layout and page elements, whether there is a screen adaptation problem can be found in a timely and accurate manner, thereby improving the test efficiency.
[0062] Referring back to Figure 3 , Figure 3 is one illustrative application scenario 300 of the method for testing screen adaptation according to the embodiment. Figure 3 As shown, the application scenario is that device “B” 302 tests the adaptation display of page 1 on device “A” 303.
[0063] Specifically, the server 301 locally pre-stores a correspondence relationship among device identifiers, display pages, and screen sizes of various devices. The server 301 can query the correspondence relationship to determine that the screen size of device “A” 303 is “X” and that the corresponding display page is page 1, and then can download page 1 to device “B” 302. Device “B” 302 can then display page 1. As indicated by reference numeral 304 in the figure, page 1 includes an image 3041.
[0064] Next, the server 301 can control the device "B" 302 to take a screenshot of the current screen to obtain a screenshot 305, and then the device "B" 302 can send the screenshot 305 to the server 301. The server 301 can modify the size of the screenshot 305 to the screen size "X" of the device "A" 303 to obtain a size-modified screenshot 306.
[0065] The server 301 can pre-simulate a screenshot of the page 1 when displayed on the device "A", and compare it with the screenshot 306. Since the aspect ratio of the image included in the page displayed in the screenshot 306 does not match the aspect ratio of the image included in the page 1 when displayed on the device "A", it can be considered that the test result indicates that the page 1 cannot be successfully adapted and displayed on the device "A" 303. Thus, without using the device "A" to directly display the page 1 for screen adaptation testing, the device "B" can complete the test of whether the page 1 can be successfully adapted and displayed on the device "A".
[0066] In the prior art, since the screen sizes of the terminal devices actually applied are various, it is difficult to cover all terminal devices with various screen sizes when performing screen adaptation testing, and it is impossible to purchase or simulate corresponding real machines to perform testing for each terminal device with a screen size. In addition, manually performing screen adaptation detection on terminal devices with various screen sizes offline will consume high human resources and the testing period is relatively long.
[0067] Therefore, the above-mentioned embodiments of the present disclosure provide a method for testing screen adaptation, which does not need to prepare devices with target screen sizes in advance, and any device with a screen size can be used to automatically test the screen adaptation of the display information on the device with the target screen size. Specifically, the display information to be displayed on the device with the target screen size and the corresponding display style information are issued to a test device, and the test device is controlled to display the display information according to the style indicated by the display style information, and a screenshot is taken at the same time. Then, the size of the screenshot is modified to the target screen size, so that the display effect of the display information in the obtained screenshot with the target screen size can be used to determine whether the display information can be successfully adapted and displayed on the device with the target screen size. Compared with the prior art, the cost of preparing devices with various screen sizes can be saved, the cost of manual on-site testing can be saved, the testing method of screen adaptation is simplified, and the testing efficiency is improved.
[0068] Further reference is made to Figure 4 which shows a flow 400 of yet another embodiment of a method for testing screen adaptation. The flow 400 of the method for testing screen adaptation comprises the following steps:
[0069] At step 401, the information for display corresponding to the first device is obtained, and the expected display style information obtained according to the preset screen adaptation algorithm is obtained.
[0070] In this embodiment, the screen adaptation algorithm can be pre-written by a technician. The screen adaptation algorithm can be used to determine the expected display style information corresponding to the device according to the screen size of the device, so that each device can use the screen adaptation algorithm to display information according to the corresponding expected display style information.
[0071] At step 402, the second device is controlled to display the information for display corresponding to the first device according to the expected display style information corresponding to the first device, and a screenshot of the second device displaying the information for display corresponding to the first device is obtained.
[0072] At step 403, the size of the screenshot is adjusted to the screen size of the first device.
[0073] At step 404, a test result indicating whether the information for display is successfully adapted and displayed on the first device is generated according to the screenshot after the size adjustment.
[0074] At step 405, in response to the obtained test result indicating that the information for display fails to be adapted and displayed on the first device, the screen adaptation algorithm is adjusted.
[0075] In this embodiment, if the obtained test result indicates that the information for display fails to be adapted and displayed on the first device, it can be considered that the current screen adaptation algorithm has certain problems, and the screen adaptation algorithm can be adjusted so that the information for display can be successfully adapted and displayed on the first device.
[0076] Specifically, the screen adaptation algorithm can be adjusted by a technician, and the adjusted screen adaptation algorithm is input to the above-mentioned execution subject, and then the above-mentioned steps 401-405 are continued to be used for testing until a test result indicating that the information for display is successfully adapted and displayed on the first device is obtained.
[0077] The contents not specifically described in this embodiment can be referred to Figure 2 The related descriptions in the corresponding embodiments are not repeated here.
[0078] The method for testing screen adaptation provided by the above-mentioned embodiments of the present disclosure can be conveniently tested before various screen adaptation algorithms are actually applied, so as to ensure that the screen adaptation algorithm can be correctly applied to devices with various screen sizes, thereby reducing the situation of screen adaptation error in actual application, and helping to reduce maintenance cost.
[0079] Further reference Figure 5As an implementation of the method shown in the above figures, the present disclosure provides one embodiment of an apparatus for testing screen adaptation, which corresponds to the method embodiment shown in Figure 2 The apparatus can be applied in various electronic devices.
[0080] As shown in Figure 5 The apparatus 500 for testing screen adaptation provided in this embodiment includes an acquisition unit 501, a control unit 502, a size adjustment unit 503, and a generation unit 504. The acquisition unit 501 is configured to acquire presentation information corresponding to a first device and expected presentation style information corresponding to the first device. The control unit 502 is configured to control a second device to present the presentation information corresponding to the first device according to the expected presentation style information corresponding to the first device, and acquire a screenshot of the second device presenting the presentation information corresponding to the first device. The size adjustment unit 503 is configured to adjust a size of the screenshot to a screen size of the first device. The generation unit 504 is configured to generate a test result indicating whether the presentation information corresponding to the first device is successfully adapted for presentation on the first device according to the screenshot with the adjusted size.
[0081] In this embodiment, the acquisition unit 501, the control unit 502, the size adjustment unit 503, and the generation unit 504 in the apparatus 500 for testing screen adaptation, and the technical effects brought by them, can refer to the related descriptions of steps 201, 202, 203, and 204 in the corresponding embodiments, which are not described here again. Figure 2 The corresponding embodiments in the corresponding embodiments, and the technical effects brought by them, can refer to the related descriptions of steps 201, 202, 203, and 204 in the corresponding embodiments, which are not described here again.
[0082] In some optional implementations of this embodiment, the expected presentation style information is obtained according to a preset screen adaptation algorithm, where the screen adaptation algorithm is used to determine the expected presentation style information according to a screen size.
[0083] In some optional implementations of this embodiment, the apparatus 500 for testing screen adaptation further includes an algorithm adjustment unit (not shown in the figure) configured to adjust the screen adaptation algorithm in response to determining that the test result indicates that the presentation information fails to be adapted for presentation on the first device.
[0084] In some optional implementations of this embodiment, the generation unit 504 is further configured to generate the test result according to a matching result of actual presentation style information of the presentation information in the screenshot with the adjusted size and the expected presentation style information.
[0085] In some optional implementations of this embodiment, the control unit 502 is further configured to send a page presenting the presentation information corresponding to the first device according to the expected presentation style information corresponding to the first device to the second device for presentation.
[0086] In some optional implementations of the embodiments, the expected display style information includes page layout information and zoom ratio information of the page elements.
[0087] The device provided by the above embodiments of the present disclosure acquires, by the acquisition unit, the display information corresponding to the first device and the expected display style information; controls, by the control unit, the second device to display the display information corresponding to the first device according to the expected display style information corresponding to the first device, and acquires a screenshot of the second device displaying the display information corresponding to the first device; adjusts, by the size adjustment unit, the size of the screenshot to the screen size of the first device; and generates, by the generation unit, a test result indicating whether the display information corresponding to the first device is successfully adapted and displayed on the first device according to the screenshot with the adjusted size, so that whether the display information can be successfully adapted and displayed on the first device can be verified without using the real first device, and the difficulty of screen testing is reduced.
[0088] Reference will be made to the following Figure 6 , which shows a structural schematic diagram of an electronic device (for example Figure 1 a server in the electronic device) 600 suitable for implementing embodiments of the present disclosure. Figure 6 The electronic device shown is merely an example and should not impose any limitation on the functions and use range of the embodiments of the present disclosure.
[0089] As shown in Figure 6 , the electronic device 600 can include a processing device (for example, a central processor, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 602 or loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0090] Generally, the following devices can be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 can allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that all the shown devices are not required to be implemented or possessed. More or fewer devices can be alternatively implemented or possessed.Figure 6 Each block in the flow diagrams of FIGS. 1-3 can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that the
[0091] In particular, in accordance with embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program comprising program code for implementing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the methods of embodiments of the present disclosure are implemented.
[0092] It should be noted that the computer readable medium in embodiments of the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination thereof. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination thereof. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In embodiments of the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, the computer readable signal medium can include a data signal carried in a baseband or as part of a carrier wave, in which the computer readable program code is carried. Such a propagated data signal can take any of a variety of forms, including but not limited to electro-magnetic, optical, or any suitable combination thereof. The computer readable signal medium can also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained in the computer readable medium can be transmitted by any suitable medium, including but not limited to wire, cable, RF, etc., or any suitable combination thereof.
[0093] The computer readable medium can be included in the electronic device; or can exist separately from the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquire the information for display corresponding to the first device and the expected display style information corresponding to the first device; control the second device to display the information for display corresponding to the first device according to the expected display style information corresponding to the first device, and acquire a screenshot of the second device displaying the information for display corresponding to the first device; adjust the size of the screenshot to the screen size of the first device; and generate a test result indicating whether the information for display corresponding to the first device is successfully adapted for display on the first device according to the screenshot after the size adjustment.
[0094] Computer program code for carrying out operations of embodiments of the present disclosure can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0095] The flow diagrams and the block diagrams in the drawings are illustrations of architectures, functionalities, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of present disclosure. In this regard, each block in the flow diagrams and the block diagrams can represent a module, a procedure, or a part of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or in the reverse order, depending on the functionality involved. It is also noted that each block of the block diagrams and / or flow diagrams and combinations of blocks in the block diagrams and / or flow diagrams can be implemented by dedicated hardware-based systems that perform the specified functions or operations, or by combinations of dedicated hardware and computer instructions.
[0096] The units described in the embodiments of the present disclosure can be implemented in the form of software, or can be implemented in the form of hardware. The described units can also be arranged in a processor, for example, a processor can be described as including an acquisition unit 501, a control unit 502, a size adjustment unit 503, and a generation unit 504. Among them, the names of these units do not constitute a limitation on the units themselves in some cases. For example, the acquisition unit can also be described as "a unit that acquires the information for display corresponding to the first device and the expected display style information".
[0097] The above description is merely preferred embodiments of the present disclosure and a description of the principles of the technology used. Those skilled in the art should understand that the scope of the application involved in the embodiments of the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or equivalent features without departing from the above inventive concept. For example, the above features are replaced with each other to form a technical solution with similar functions disclosed in the embodiments of the present disclosure (but not limited to).
Claims
1. A method for testing screen adaptation, comprising: Obtain the display information and expected display style information corresponding to the first device, wherein the expected display style information includes code describing the expected display style, and the display style of the display information includes at least one of the following: the size and arrangement of each element included in the information, the display position of the information, and the display format of the information; Control the second device to display the display information according to the desired display style information, and obtain a screenshot of the second device displaying the display information; Adjust the size of the screenshot to match the screen size of the first device; Based on the resized screenshot, a test result is generated to indicate whether the display information is successfully adapted and displayed on the first device. This includes: generating code to describe the display style of the resized screenshot; matching two code segments using a text matching method to obtain a matching result; and generating a test result. The test result is generated based on the matching result between the actual display style information of the display information in the resized screenshot and the expected display style information.
2. The method according to claim 1, wherein, The desired display style information is obtained according to a preset screen adaptation algorithm, wherein the screen adaptation algorithm is used to determine the desired display style information based on the screen size.
3. The method according to claim 2, wherein, The method further includes: In response to determining that the test result indicates that the display information fails to adapt for display on the first device, the screen adaptation algorithm is adjusted.
4. The method according to claim 1, wherein, The control of the second device to display the display information according to the desired display style information includes: The page displaying the information according to the desired display style information is sent to the second device for display.
5. The method according to claim 4, wherein, The desired display style information includes page layout information and scaling information of page elements.
6. An apparatus for testing screen adaptation, comprising: The acquisition unit is configured to acquire display information and expected display style information corresponding to the first device, wherein the expected display style information includes code describing the expected display style, and the display style of the display information includes at least one of the following: the size and arrangement of each element included in the information, the display position of the information, and the display format of the information; The control unit is configured to control the second device to display the display information according to the desired display style information, and to acquire a screenshot of the second device displaying the display information; The size adjustment unit is configured to adjust the size of the screenshot to the screen size of the first device; The generation unit is configured to generate a test result indicating whether the display information is successfully adapted and displayed on the first device based on the screen screenshot after size adjustment. This includes: generating code to describe the display style of the screen screenshot after size adjustment; matching two code segments using a text matching method to obtain a matching result; and generating a test result. The test result is generated based on the matching result between the actual display style information of the display information in the screen screenshot after size adjustment and the expected display style information.
7. The apparatus according to claim 6, wherein, The desired display style information is obtained according to a preset screen adaptation algorithm, wherein the screen adaptation algorithm is used to determine the desired display style information based on the screen size; and The device further includes: The algorithm adjustment unit is configured to adjust the screen adaptation algorithm in response to determining that the test result indicates that the display information fails to adapt for display on the first device.
8. An electronic device, comprising: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.
9. A computer-readable medium having a computer program stored thereon, wherein, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Special-shaped screen compatibility test method and device, computer equipment and storage medium
CN110321257A