CN-122019361-A - Method, device, equipment, medium and product for testing performance of converting design manuscript into code
Abstract
The present disclosure relates to the field of computer technology, and provides a method, a device, a medium and a product for testing the performance of converting design manuscript into code, wherein the method for testing the performance of converting design manuscript into code comprises the steps of obtaining a test data set containing field specific language data generated based on a target design manuscript and corresponding expected geometric information; the method comprises the steps of inputting domain specific language data to a target test platform, generating target page layout based on the data by the platform, adjusting the container width of the target page layout to be a preset target width, triggering the target test platform to conduct layout rearrangement, obtaining actual geometric information of each design node under the target width, and finally generating layout test indexes representing the page layout performance of the target test platform according to comparison results of the actual geometric information and expected geometric information. The method and the device can realize automatic and accurate verification of layout response capability of the design draft code conversion platform under different widths.
Inventors
- LIU YIQI
Assignees
- 杭州网易智企科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251219
Claims (12)
- 1. A method for testing the performance of draft transcoding, the method comprising: Acquiring a test data set, wherein the test data set comprises field specific language data generated based on a target design draft and corresponding expected geometric information; Inputting the domain-specific language data into a target test platform to generate a corresponding target page layout, wherein the target test platform is used for generating the page layout based on the domain-specific language data; Adjusting the container width of the target page layout to a preset target width so as to enable the target test platform to conduct layout rearrangement to obtain actual geometric information of each design node in the target page layout under the target width; And generating a layout test index according to the actual geometric information and the expected geometric information, wherein the layout test index is used for representing the page layout performance of the target test platform.
- 2. The method of claim 1, wherein the domain-specific language data comprises geometric information of each design node, wherein the expected geometric information is a responsive snapshot comprising expected coordinate values and expected size values that each design node should have at the target width, wherein the actual geometric information is actual coordinate values and actual size values of each design node generated by the target test platform at the target width; The generating a test index according to the actual geometric information and the expected geometric information comprises the following steps: And aiming at each design node in the responsive snapshot, obtaining a geometric deviation value of each design node according to a first difference value of an expected coordinate value and an actual coordinate value corresponding to the design node and a second difference value of an expected size value and an actual size value corresponding to the design node, wherein the layout test index comprises the geometric deviation value.
- 3. The method according to claim 2, wherein the method further comprises: and when the geometric deviation value is smaller than or equal to a preset error threshold value, judging that the page layout performance test of the target test platform passes.
- 4. The method of claim 1, wherein the test dataset further comprises page screenshot data generated based on the target design script, wherein the target test platform is further configured to generate a page structure based on the page screenshot data to obtain an actual component sequence, and wherein the method further comprises: Inputting the screenshot data of the page into the target test platform to obtain an actual assembly sequence; calculating the minimum editing operation times required for converting the actual component sequence into a reference component sequence to obtain an editing distance, wherein the reference component sequence is a pre-marked expected result; And generating similarity scores according to the editing distances to obtain structure generation test indexes, wherein the structure generation test indexes are used for representing page structure generation performance of the target test platform.
- 5. The method of claim 4, wherein the editing operation comprises at least one of insertion, deletion, and substitution, and wherein generating a similarity score based on the editing distance comprises: Determining a reference length value according to the length values in the actual component sequence and the reference component sequence; And obtaining the similarity score according to the editing distance and the reference length value.
- 6. The method according to claim 4, wherein the method further comprises: and when the similarity score is larger than or equal to a preset similarity threshold, judging that the page structure generation performance test of the target test platform passes.
- 7. The method of claim 1, wherein the domain-specific language data further comprises attribute features of each design node, the test dataset further comprises reference component labels corresponding to each design node, the target test platform is further configured to perform component recognition based on the attribute features of each design node to obtain predicted component labels, and the method further comprises: Obtaining geometric attributes and style attributes in attribute features of each design node, filtering each design node by using a preset feature screening rule to generate a candidate component set, and counting recall rates; According to the coordinate information of the design nodes in the candidate component set, performing image cutting on the target design draft to obtain a target subgraph; Inputting the target subgraph into the target test platform for classification prediction to obtain a prediction component label; matching the predicted component tag with the reference component tag to calculate accuracy; And obtaining a component identification test index according to the recall rate and the accuracy, wherein the component identification test index is used for representing the component identification performance of the target test platform.
- 8. The method of claim 7, wherein the pre-set feature screening rules are constructed based on at least one of a size scale, a hierarchy, or a color of each design node.
- 9. A design draft transcoding performance testing apparatus, said apparatus comprising: the acquisition module is used for acquiring a test data set, wherein the test data set comprises field specific language data generated based on a target design draft and corresponding expected geometric information; The generation module is used for inputting the domain-specific language data into a target test platform to generate a corresponding target page layout; The adjustment module is used for adjusting the width of the container of the target page layout to a preset target width so as to enable the target test platform to conduct layout rearrangement to obtain actual geometric information of each design node in the target page layout under the target width; The test module is used for generating a layout test index according to the actual geometric information and the expected geometric information, and the layout test index is used for representing the page layout performance of the target test platform.
- 10. An electronic device, comprising: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the design draft transcoding performance test method of any one of claims 1 to 8.
- 11. A computer-readable storage medium having stored thereon computer instructions for causing a computer to execute the design draft transcoding performance test method of any one of claims 1 to 8.
- 12. A computer program product comprising computer instructions for causing a computer to perform the design draft transcoding performance test method of any one of claims 1 to 8.
Description
Method, device, equipment, medium and product for testing performance of converting design manuscript into code Technical Field The disclosure relates to the technical field of computers, and in particular relates to a design draft transcoding performance test method, device, equipment, medium and product. Background In the field of front-end development and automated testing, design draft transcoding techniques are directed to automatically converting visual design drafts into usable front-end codes. In order to ensure that the converted code can accurately restore the design intent, strict testing of the layout performance of the generated page is required. However, when the related art verifies the design draft code, static image comparison or artificial naked eye acceptance is often relied on, and it is difficult to accurately evaluate the dynamic response capability of the page under different screen sizes. The existing test means generally cannot simulate the width change of the container and quantify the accuracy after layout rearrangement in an automatic process, so that the problem of fine dislocation or structural collapse in the responsive layout cannot be effectively found. Therefore, a method for testing the performance of the design draft-to-code is needed to solve the problem that the related art cannot effectively detect the performance of the design draft-to-code in the layout change scene. Disclosure of Invention The disclosure provides a performance test method, device, equipment, medium and product for converting design manuscript into code, which are used for solving the problem that the related technology cannot effectively detect the performance of the design manuscript into code under a layout change scene. In a first aspect, the present disclosure provides a method for testing performance of draft transcoding, the method comprising: acquiring a test data set, wherein the test data set comprises field specific language data generated based on a target design draft and corresponding expected geometric information; inputting the domain-specific language data into a target test platform to generate a corresponding target page layout; Adjusting the container width of the target page layout to a preset target width so as to enable the target test platform to conduct layout rearrangement to obtain actual geometric information of each design node in the target page layout under the target width; And generating a layout test index according to the actual geometric information and the expected geometric information, wherein the layout test index is used for representing the page layout performance of the target test platform. According to the design draft transcoding performance test method, the test data set containing the field specific language data and the expected geometric information is obtained, the data is input into the target test platform to generate the page layout, and then the width of the container is actively adjusted to trigger layout rearrangement, so that the actual geometric information of the node under the specific target width can be obtained. By comparing the actual geometric information with the expected geometric information and generating the layout test index, the application realizes the quantitative evaluation of the responsive layout capability of the design draft-to-code platform. The dynamic verification mode based on the geometric coordinates not only avoids subjective errors of manual visual inspection, but also solves the problem that dynamic layout rearrangement logic cannot be verified only by static screenshot comparison, thereby achieving the technical effect of accurately and automatically evaluating page layout correctness of the target test platform when different screen widths are processed. In an alternative implementation mode, the field specific language data comprises geometric information of each design node, wherein the expected geometric information is a responsive snapshot, and the responsive snapshot comprises expected coordinate values and expected size values which each design node should have under the target width; Generating a test index according to the actual geometric information and the expected geometric information, wherein the test index comprises the following steps: for each design node in the responsive snapshot, according to a first difference value of an expected coordinate value and an actual coordinate value corresponding to the design node and according to a second difference value of an expected size value and an actual size value corresponding to the design node, obtaining a geometric deviation value of each design node, wherein the layout test index comprises the geometric deviation value. The method converts fuzzy visual comparison into accurate numerical calculation, and can quantify the accuracy of layout reduction at a pixel level by calculating the geometric deviation (difference of position and size) of each no