CN111881049A - Acceptance method and device for application program interface and electronic equipment - Google Patents

Acceptance method and device for application program interface and electronic equipment Download PDF

Info

Publication number
CN111881049A
CN111881049A CN202010760904.XA CN202010760904A CN111881049A CN 111881049 A CN111881049 A CN 111881049A CN 202010760904 A CN202010760904 A CN 202010760904A CN 111881049 A CN111881049 A CN 111881049A
Authority
CN
China
Prior art keywords
layer
standard
checked
interface
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010760904.XA
Other languages
Chinese (zh)
Other versions
CN111881049B (en
Inventor
蔡宇
吴瑞卿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing IQIYI Science and Technology Co Ltd
Original Assignee
Beijing IQIYI Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing IQIYI Science and Technology Co Ltd filed Critical Beijing IQIYI Science and Technology Co Ltd
Priority to CN202010760904.XA priority Critical patent/CN111881049B/en
Publication of CN111881049A publication Critical patent/CN111881049A/en
Application granted granted Critical
Publication of CN111881049B publication Critical patent/CN111881049B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Design And Manufacture Of Integrated Circuits (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the invention provides an acceptance method and device for an application program interface and electronic equipment, wherein the method comprises the following steps: acquiring attribute information of each layer to be checked in an interface to be checked, and acquiring attribute information of each standard layer in a standard interface; determining the corresponding relation between each graph layer to be checked and each standard graph layer based on the size, the position and the type of each graph layer to be checked and accepted and the size, the position and the type of each standard graph layer; determining adjacent layers and intervals of each standard layer according to the size and the position of each standard layer; determining adjacent layers and intervals of each layer to be checked according to the corresponding relation; and aiming at each layer to be checked and accepted, respectively comparing the pattern and the interval of the layer to be checked and accepted with the pattern and the interval of the corresponding standard layer based on the corresponding relation, and determining the checking and accepting result of each layer to be checked and accepted. The patterns and the intervals of all layers in the interface to be checked and accepted and the standard interface do not need to be manually measured for comparison, and the checking and accepting efficiency of the application program interface can be improved.

Description

Acceptance method and device for application program interface and electronic equipment
Technical Field
The invention relates to the technical field of application program development, in particular to an acceptance method and device for an application program interface and electronic equipment.
Background
In the process of developing the application program interface, interface development is carried out according to the requirements of the design draft completed in advance, and after the development is completed, in order to detect whether the application program interface meets the requirements of the design draft, the application program interface needs to be checked and accepted.
The current way of accepting an application program interface is dependent on manual work. Specifically, an image of an application program interface is intercepted through a terminal, and the image is uploaded to a server. And then, manually measuring the patterns and the intervals between the layers in the image by using tools such as Sketch, Photoshop and the like by an acceptance staff, further comparing the patterns and the intervals with corresponding interfaces in the design draft, marking the layers with wrong patterns and/or intervals, and obtaining an acceptance result.
Therefore, in the current acceptance mode, because tools such as Sketch and PhotoShop need to be manually used for measuring the patterns and the intervals of all layers in the intercepted image, and manual comparison with the corresponding interface of the design draft is needed, the acceptance efficiency is very low.
Disclosure of Invention
The embodiment of the invention aims to provide an acceptance method and device for an application program interface and electronic equipment, so that the acceptance efficiency of the application program interface is improved. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides an acceptance method for an application program interface, where the method includes:
acquiring attribute information of each layer to be checked and accepted in an interface to be checked and acquiring attribute information of each standard layer in a standard interface, wherein the standard interface is an interface defined by a design draft corresponding to the interface to be checked and accepted, and the attribute information comprises size, position, type and style;
determining the corresponding relation between each layer to be checked and each standard layer based on the size, the position and the type of each layer to be checked and accepted and the size, the position and the type of each standard layer;
determining adjacent layers of each standard layer and a space between each standard layer and the corresponding adjacent layer according to the size and the position of each standard layer;
determining adjacent layers of each layer to be checked and a space between each layer to be checked and the corresponding adjacent layers according to the corresponding relation and the size and the position of each layer to be checked;
and aiming at each layer to be checked and accepted, respectively comparing the pattern and the interval of the layer to be checked and accepted with the pattern and the interval of the corresponding standard layer based on the corresponding relation, and determining the checking and accepting result of each layer to be checked and accepted.
Optionally, the step of determining the corresponding relationship between each layer to be checked and each standard layer based on the size, position, and type of each layer to be checked and accepted and the size, position, and type of each standard layer includes:
sequencing the layers to be checked according to the positions of the layers to be checked and accepted and a preset sequencing rule to obtain a sequencing result;
traversing each layer to be checked and accepted according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and accepted and each unmatched standard layer according to the types and the positions of each layer to be checked and accepted and each standard layer when one layer to be checked and accepted is traversed;
determining a standard layer matched with the currently traversed to-be-checked image layer based on the matching degree, recording the corresponding relation between the currently traversed to-be-checked image layer and the standard layer, and determining that the standard layer is matched;
and continuously traversing the next layer to be checked and accepted, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and accepted and each unmatched standard layer according to the types and the positions of the layers to be checked and accepted and the standard layers until all the layers to be checked and accepted are traversed, so as to obtain the corresponding relation between the layers to be checked and the standard layers.
Optionally, before the step of traversing the layers to be checked and accepted according to the sorting result, the method further includes:
determining an adjacent layer of each standard layer according to the position of each standard layer;
the step of calculating the matching degree between the currently traversed to-be-checked image layer and each currently unmatched standard image layer according to the types and the positions of the to-be-checked image layers and the standard image layers comprises the following steps:
determining adjacent layers of the currently traversed layer to be checked according to the positions of the layers to be checked;
and respectively calculating the matching degree between the currently traversed layer to be checked and accepted and each currently unmatched standard layer based on the types of the currently traversed layer to be checked and the adjacent layer thereof and the types of each currently unmatched standard layer and the adjacent layer thereof.
Optionally, the step of determining an adjacent layer of each standard layer and a distance between each standard layer and a corresponding adjacent layer according to the size and the position of each standard layer includes:
determining a layer row and/or a layer column to which each standard layer belongs according to the size and the position of each standard layer, and determining a layout relation of each standard layer in the standard interface based on the layer row and/or the layer column to which each standard layer belongs, wherein each standard layer in the layer rows has an intersection region with at least one other standard layer after being expanded in a transverse direction, and each standard layer in the layer column has an intersection region with at least one other standard layer after being expanded in a longitudinal direction;
and determining adjacent layers of each standard layer and the space between each standard layer and the corresponding adjacent layer according to the layout relation.
Optionally, the step of determining the layer rows and/or layer columns to which each standard layer belongs according to the size and position of each standard layer, and determining the layout relationship of each standard layer in the standard interface based on the layer rows and/or layer columns to which each standard layer belongs includes:
determining the layer rows to which the standard layers belong according to the sizes and the positions of the standard layers;
traversing each undetermined layer row, calculating the distance between the currently traversed layer row and the determined layer row as well as the longitudinal boundary of the standard interface, and determining the layer row corresponding to the minimum distance as a target layer row;
traversing the target layer row, if the target layer row only comprises one standard layer, adding the identifier of the standard layer to a dependency relationship array, returning to each layer row which is not determined by the traversal, and calculating the distance between the currently traversed layer row and the determined layer row as well as the distance between the currently traversed layer row and the boundary of the standard interface until the traversal of all the layer rows is finished, wherein the dependency relationship array records the identifier of the standard layer included by the traversed layer row and is used for representing the layout relationship of each standard layer in the standard interface;
if the target layer row comprises a plurality of standard layers, determining a layer column to which each standard layer belongs according to the sizes and the positions of the plurality of standard layers;
traversing each undetermined graph layer column, calculating the distance between the currently traversed graph layer column and the determined graph layer column as well as the transverse boundary of the standard interface, and determining the graph layer column corresponding to the minimum distance as a target graph layer column;
traversing the target diagram layer column, if the target diagram layer column only comprises one standard layer, adding the identifier of the standard layer into the dependency relationship array, returning to each diagram layer column which is not determined by traversal, and calculating the distance between the currently traversed layer column and the determined layer column as well as the boundary of the standard interface until all the layer columns are traversed;
if the target layer column comprises a plurality of standard layers, returning to the step of determining the layer row to which each standard layer belongs according to the size and the position of each standard layer until all layer columns corresponding to the target layer row are traversed;
the step of determining the adjacent layer of each standard layer and the distance between each standard layer and the corresponding adjacent layer according to the layout relationship comprises:
sequentially traversing each identifier in the dependency relationship array, and determining the transverse and longitudinal distances between the standard layer corresponding to the currently traversed identifier and the determined layer when one identifier is traversed;
determining the layer with the smallest corresponding transverse and longitudinal distances as an adjacent layer of a standard layer corresponding to the currently traversed identifier, determining the smallest distance as the distance between the standard layer and the adjacent layer, and determining the standard layer as the determined layer;
and continuously traversing the next identifier, and returning to the step of determining the transverse and longitudinal distances between the standard layer corresponding to the currently traversed identifier and the determined layer until all identifiers are traversed.
Optionally, the step of obtaining attribute information of each layer to be checked and accepted in the interface to be checked and obtaining attribute information of each standard layer in the standard interface includes:
calling a preset view interface, and extracting attribute information of each layer to be checked and accepted in the interface to be checked and accepted;
analyzing each standard layer in the standard interface to obtain attribute information of each standard layer in the standard interface.
Optionally, before the step of obtaining the attribute information of each layer to be checked and accepted in the interface to be checked and accepted, the method further includes:
acquiring running condition parameters of an interface to be checked and received of an application program, and configuring a running environment based on the running condition parameters;
and starting the application program based on the running environment, and entering the interface to be checked.
Optionally, before the step of determining the corresponding relationship between each layer to be checked and each standard layer based on the size, the position, and the type of each layer to be checked and accepted and the size, the position, and the type of each standard layer, the method further includes:
and performing layer processing on each to-be-checked image layer and each standard image layer by adopting at least one of the following modes:
determining a redundant layer according to the pattern and the size of each to-be-checked image layer and each standard image layer, and removing the redundant layer; or the like, or, alternatively,
aiming at an image layer to be checked and received and a standard image layer with the type of a text, adjusting the heights of the image layers with the same character size of the included characters to be the same; or the like, or, alternatively,
and combining a plurality of layers belonging to the same icon into one layer.
In a second aspect, an embodiment of the present invention provides an acceptance apparatus for an application program interface, where the apparatus includes:
the attribute information acquisition module is used for acquiring attribute information of each layer to be checked in an interface to be checked and accepted and acquiring attribute information of each standard layer in a standard interface, wherein the standard interface is an interface defined by a design draft corresponding to the interface to be checked and accepted, and the attribute information comprises size, position, type and style;
the corresponding relation determining module is used for determining the corresponding relation between each layer to be checked and accepted and each standard layer based on the size, the position and the type of each layer to be checked and accepted and the size, the position and the type of each standard layer;
a first interval determining module, configured to determine, according to the size and the position of each standard layer, an adjacent layer of each standard layer and an interval between each standard layer and a corresponding adjacent layer;
the second distance determining module is used for determining adjacent layers of each layer to be checked and the distance between each layer to be checked and the corresponding adjacent layer according to the corresponding relation and the size and the position of each layer to be checked;
and the layer acceptance module is used for comparing the patterns and the intervals of the layers to be accepted with the patterns and the intervals of the corresponding standard layers respectively based on the corresponding relation aiming at each layer to be accepted, and determining the acceptance result of each layer to be accepted.
Optionally, the correspondence determining module includes:
the layer sequencing unit is used for sequencing the layers to be checked and accepted according to the positions of the layers to be checked and accepted and a preset sequencing rule to obtain a sequencing result;
the corresponding relation determining unit is used for traversing each layer to be checked and accepted according to the sorting result, and calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and the positions of each layer to be checked and accepted and each standard layer when one layer to be checked and accepted is traversed;
determining a standard layer matched with the currently traversed to-be-checked image layer based on the matching degree, recording the corresponding relation between the currently traversed to-be-checked image layer and the standard layer, and determining that the standard layer is matched;
and continuously traversing the next layer to be checked and accepted, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and accepted and each unmatched standard layer according to the types and the positions of the layers to be checked and accepted and the standard layers until all the layers to be checked and accepted are traversed, so as to obtain the corresponding relation between the layers to be checked and the standard layers.
Optionally, the first distance determining module includes:
the layout relationship determining unit is configured to determine a layer row and/or a layer column to which each standard layer belongs according to the size and the position of each standard layer, and determine a layout relationship of each standard layer in the standard interface based on the layer row and/or the layer column to which each standard layer belongs, where each standard layer in the layer rows has an intersection region with at least one other standard layer after being expanded in a transverse direction, and each standard layer in the layer column has an intersection region with at least one other standard layer after being expanded in a longitudinal direction;
and the space determining unit is used for determining adjacent layers of each standard layer and the space between each standard layer and the corresponding adjacent layer according to the layout relation.
Optionally, the layout relationship determining unit includes:
the layer row dividing subunit is used for determining the layer rows to which the standard layers belong according to the sizes and the positions of the standard layers;
the target row determining subunit is configured to traverse each layer row that is not determined, calculate a distance between a currently traversed layer row and the determined layer row and a longitudinal boundary of the standard interface, and determine a layer row corresponding to the minimum distance as a target layer row;
a layer row traversal subunit, configured to traverse the target layer row, add an identifier of the standard layer to the dependency array if the target layer row only includes one standard layer, return to each layer row that is not determined by the traversal, and calculate a distance between a currently traversed layer row and a boundary between the determined layer row and the standard interface until all layer rows are traversed; if the target layer row comprises a plurality of standard layers, determining a layer column to which each standard layer belongs according to the sizes and positions of the plurality of standard layers, wherein the dependency relationship array records identifiers of the standard layers included in the traversed layer row and is used for representing the layout relationship of each standard layer in the standard interface;
the target column determining subunit is used for traversing each undetermined image layer column, calculating the distance between the currently traversed image layer column and the determined image layer column as well as the transverse boundary of the standard interface, and determining the image layer column corresponding to the minimum distance as a target image layer column;
a layer column traversal subunit, configured to traverse the target layer column, add, if the target layer column only includes one standard layer, an identifier of the standard layer to the dependency relationship array, return to each layer column that is not determined by the traversal, and calculate a distance between a currently traversed layer column and a boundary between the determined layer column and the standard interface until all layer columns are traversed; if the target layer column comprises a plurality of standard layers, returning to the step of determining the layer row to which each standard layer belongs according to the size and the position of each standard layer until all layer columns corresponding to the target layer row are traversed;
the pitch determination unit includes:
the identifier traversal subunit is used for sequentially traversing each identifier in the dependency relationship array, and determining the horizontal and vertical distances between the standard layer corresponding to the currently traversed identifier and the determined layer when one identifier is traversed; determining the layer with the smallest corresponding transverse and longitudinal distances as an adjacent layer of a standard layer corresponding to the currently traversed identifier, determining the smallest distance as the distance between the standard layer and the adjacent layer, and determining the standard layer as the determined layer; and continuously traversing the next identifier, and returning to the step of determining the transverse and longitudinal distances between the standard layer corresponding to the currently traversed identifier and the determined layer until all identifiers are traversed.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the steps of the acceptance method of the application program interface of any one of the first aspect when executing the program stored in the memory.
In a fourth aspect, an embodiment of the present invention provides a computer-readable cache medium, where a computer program is cached in the computer-readable cache medium, and when executed by a processor, the computer program implements the steps of the acceptance method for the application program interface according to any one of the first aspects.
In a fifth aspect, embodiments of the present invention provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of the method for accepting an application program interface according to any one of the first aspect
In the scheme provided by the embodiment of the invention, the electronic device can obtain attribute information of each layer to be checked in the interface to be checked, and obtain attribute information of each standard layer in the standard interface, wherein the standard interface is an interface defined by a design draft corresponding to the interface to be checked, the attribute information includes size, position, type and style, the corresponding relation between each layer to be checked and each standard layer is determined based on the size, position and type of each layer to be checked and each standard layer, the adjacent layer of each standard layer and the distance between each layer to be checked and each layer to be checked are determined according to the size and position of each layer to be checked and the corresponding adjacent layer, and further the adjacent layer of each layer to be checked and the distance between each layer to be checked and each layer to be checked are determined according to the corresponding relation and the size and position of each layer to be checked, and comparing the pattern and the interval of the layer to be checked with the pattern and the interval of the corresponding standard layer respectively based on the corresponding relation, and determining the checking result of each layer to be checked. The check and acceptance efficiency of the application program interface can be greatly improved because the patterns and the intervals of all the layers in the interface to be checked and the standard interface do not need to be manually measured, and the interface to be checked and accepted does not need to be manually compared with the interface corresponding to the design draft.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart of an acceptance method of an application program interface according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating the step S102 in the embodiment shown in FIG. 1;
fig. 3(a) is a schematic diagram of an interface to be checked according to an embodiment of the present invention;
FIG. 3(b) is a diagram illustrating a standard interface according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a specific step S103 in the embodiment shown in FIG. 1;
FIG. 5 is another schematic diagram of a standard interface provided by an embodiment of the present invention;
FIG. 6 is a schematic diagram of an attribute information comparison interface according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an acceptance apparatus for an application program interface according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of the correspondence relation determining module 720 in the embodiment shown in fig. 7;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
In order to improve the acceptance efficiency of the application program interface, the embodiment of the invention provides an acceptance method and an acceptance device of the application program interface, electronic equipment, a computer readable storage medium and a computer program product. The following describes a method for accepting an application program interface provided by an embodiment of the present invention.
The application program interface acceptance method provided by the embodiment of the invention can be applied to any electronic equipment which needs to accept the application program interface, and the electronic equipment can be a computer, a mobile phone, a tablet computer and the like, and is not particularly limited herein. For clarity of description, hereinafter referred to as electronic device.
As shown in fig. 1, a method for accepting an application program interface, the method comprising:
s101, acquiring attribute information of each layer to be checked and accepted in an interface to be checked and accepted, and acquiring attribute information of each standard layer in a standard interface;
the standard interface is an interface defined by a design draft corresponding to the interface to be checked and accepted, and the attribute information comprises size, position, type and style.
S102, determining the corresponding relation between each layer to be checked and each standard layer based on the size, the position and the type of each layer to be checked and accepted and the size, the position and the type of each standard layer;
s103, determining adjacent layers of each standard layer and a distance between each standard layer and the corresponding adjacent layer according to the size and the position of each standard layer;
s104, determining adjacent layers of each layer to be checked and a space between each layer to be checked and the corresponding adjacent layers according to the corresponding relation and the size and the position of each layer to be checked and accepted;
and S105, aiming at each layer to be checked and accepted, respectively comparing the pattern and the interval of the layer to be checked and accepted with the pattern and the interval of the corresponding standard layer based on the corresponding relation, and determining the checking and accepting result of each layer to be checked and accepted.
It can be seen that, in the scheme provided in the embodiment of the present invention, the electronic device may obtain attribute information of each layer to be checked in the interface to be checked, and obtain attribute information of each standard layer in the standard interface, where the standard interface is an interface defined by a design draft corresponding to the interface to be checked, and the attribute information includes a size, a position, a type, and a style, and determines a corresponding relationship between each layer to be checked and each standard layer based on the size, the position, and the type of each layer to be checked, and determines an adjacent layer of each standard layer and a distance between each layer to be checked and the corresponding adjacent layer according to the size and the position of each layer to be checked, and further determines an adjacent layer of each layer to be checked and a distance between each layer to be checked and the corresponding adjacent layer according to the corresponding relationship and the size and the position of each layer to be checked, and aiming at each layer to be checked and accepted, respectively comparing the pattern and the interval of the layer to be checked and accepted with the pattern and the interval of the corresponding standard layer based on the corresponding relation, and determining the checking and accepting result of each layer to be checked and accepted. The check and acceptance efficiency of the application program interface can be greatly improved because the patterns and the intervals of all the layers in the interface to be checked and the standard interface do not need to be manually measured, and the interface to be checked and accepted does not need to be manually compared with the interface corresponding to the design draft.
When the application program interface needs to be accepted, the electronic device may execute step S101, that is, obtain attribute information of each layer to be accepted in the interface to be accepted, and obtain attribute information of each standard layer in the standard interface, where the standard interface is an interface defined by a design draft corresponding to the interface to be accepted. The attribute information of the layer may include size, position, type, style, and the like of the layer, and the style may include information such as font, font size, border shape, color, and the like. The types of layers may include text types and picture types.
The graph layer to be checked is a graph layer in the interface to be checked, the standard graph layer is a graph layer in the standard interface defined by the design draft, and the graph layers in the two interfaces are distinguished conveniently without other limiting meanings.
After obtaining the attribute information, the electronic device may determine a corresponding relationship between each to-be-checked image layer and each standard image layer based on the size, the position, and the type of each to-be-checked image layer and each standard image layer, that is, execute the step S102.
Because it is desired to determine whether a to-be-checked drawing layer in an application program interface meets the requirements of a standard drawing layer in a corresponding interface in a design draft, it is necessary to determine according to which standard drawing layer the to-be-checked drawing layer is designed and developed, that is, it is necessary to determine which standard drawing layer the to-be-checked drawing layer corresponds to.
The size, position and type of the layer can represent the area and display position of the layer in the interface and display characters or pictures, and the layer to be checked and the standard layer are corresponding to each other can be determined according to the attribute information, so that the electronic equipment can determine the corresponding relation between each layer to be checked and each standard layer.
The pattern of the layer and the distance between the layer and the adjacent layer can represent the display effect of the layer in the interface, so that the application program interface can be checked from the aspects of the pattern of the layer and the distance between the layer and the adjacent layer, and the display effect of the application program interface is consistent with the effect of a standard interface in the design draft.
The electronic device may execute step S103 to determine adjacent layers of each standard layer and a distance between each standard layer and the corresponding adjacent layer. Specifically, since the size and the position of each standard layer are already determined, the electronic device may determine the position relationship between each standard layer according to the size and the position of each standard layer, for example, layer a is on the left side of layer B. And then the adjacent layers of each standard layer and the distance between the adjacent layers can be determined. The adjacent layer may be a layer with the smallest distance from the standard layer.
In an embodiment, the electronic device may calculate a distance between every two standard layers in each standard layer, and determine, for each standard layer, another standard layer having a smallest distance with the standard layer as an adjacent layer, where the smallest distance is a distance between two standard layers.
Because the corresponding relation between each layer to be checked and each standard layer is determined, after the adjacent layers of the standard layers and the space between each standard layer and the corresponding adjacent layer are determined, the adjacent layer of each layer to be checked can be determined according to the corresponding relation.
For example, the correspondence between each layer to be checked and each standard layer is shown in the following table:
serial number To-be-checked layer Standard pattern layer
1 Layer a to be checked Standard layer A
2 Layer b to be checked Standard layer B
3 Layer c to be checked Standard layer C
4 Layer d to be checked Standard layer D
n To-be-checked layer n Standard layer N
Then, if the electronic device determines that the adjacent layer of the standard layer C is the standard layer B, the electronic device may determine that the adjacent layer of the layer C to be checked is the layer B to be checked according to the correspondence shown in the table above.
Furthermore, the electronic device may calculate a distance between each layer to be checked and the corresponding adjacent layer. As an embodiment, since the layer is generally rectangular and has 4 boundaries, the electronic device may determine the pixel positions of the boundaries according to the position and size of the layer to be checked, and further may calculate the distance between the layer to be checked and the corresponding adjacent layer. For example, if the layer to be checked 1 is on the left side of its corresponding adjacent layer 2, the distance between the layer to be checked 1 and the adjacent layer 2 may be the pixel abscissa value of the left boundary of the adjacent layer 2 and the pixel abscissa value of the right boundary of the layer to be checked 1.
After determining the distance, the electronic device may compare the pattern and the distance of the layer to be checked with the pattern and the distance of the corresponding standard layer based on the correspondence relationship, and determine the check result of each layer to be checked, that is, execute the step S105.
Specifically, the electronic device may compare the pattern and the corresponding interval of each layer to be checked with the pattern and the corresponding interval of the standard layer corresponding to the pattern and the corresponding interval, and if the pattern and the interval are both consistent, it is determined that the display effect of the layer to be checked is consistent with the effect that the design draft wants to achieve, and then the checking result of the layer to be checked is the pass checking result.
If at least one of the pattern and the interval is inconsistent, the display effect of the layer to be checked is not consistent with the effect which is expected to be achieved by the design draft, and then the checking result of the layer to be checked is determined to be not passed checking. Therefore, the acceptance result of each layer to be accepted can be obtained, and the acceptance of the application program interface is completed.
As an implementation manner of the embodiment of the present invention, as shown in fig. 2, the step of determining the corresponding relationship between each layer to be checked and each standard layer based on the size, the position, and the type of each layer to be checked and each standard layer may include:
s201, sorting the image layers to be checked and accepted according to the positions of the image layers to be checked and accepted and a preset sorting rule to obtain a sorting result;
in order to facilitate subsequent traversal, the electronic device may sort the layers to be checked according to a preset sorting rule and the positions of the layers to be checked, so as to obtain a sorting result. The preset ordering rule may be ordering according to positions in the interface from top to bottom, from left to right, and the like, which are all reasonable.
S202, traversing each layer to be checked and accepted according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and accepted and each unmatched standard layer according to the type and the position of each layer to be checked and accepted and each standard layer when one layer to be checked and accepted is traversed;
after the sorting result is obtained, the electronic device may traverse each layer to be checked and accepted according to the sorting result, that is, the sorting result traverses from the first layer to be checked and accepted to the last layer to be checked and accepted. When traversing each layer to be checked and accepted, the electronic device may calculate the matching degree between the currently traversed layer to be checked and accepted and each unmatched standard layer according to the type and position of each layer to be checked and each standard layer.
For the first traversed layer to be checked, the standard layers that are not matched currently are all the standard layers, that is, for the first traversed layer to be checked, the matching degree between the layer to be checked and all the standard layers needs to be calculated. For the non-first traversed graph layer to be checked, the currently unmatched standard graph layer is the currently remaining standard graph layer of which the corresponding relation is not determined yet in all the standard graph layers. That is to say, for the to-be-checked image layer which is not the first traversal, the matching degree between the to-be-checked image layer and each currently remaining standard image layer for which the corresponding relationship has not been determined needs to be calculated.
In an embodiment, the electronic device may determine, according to the position of each layer to be checked, a to-be-checked image layer around the currently traversed to-be-checked image layer, and similarly, may also determine, according to the position of each standard image layer, a standard image layer around each standard image layer. Furthermore, whether the type of the currently traversed to-be-checked graph layer is the same as the type of each currently unmatched standard graph layer or not can be compared, whether the type of the standard graph layer around the currently traversed to-be-checked graph layer is the same as the type of the standard graph layer around each unmatched standard graph layer or not can be compared, and the matching degree is determined according to the two comparison results.
S203, based on the matching degree, determining a standard layer matched with the currently traversed image layer to be checked, recording the corresponding relation between the currently traversed image layer to be checked and the standard layer, and determining that the standard layer is matched;
after the matching degree is determined, the electronic device may determine a standard layer matched with the currently traversed to-be-checked image layer, and record a matching result, that is, a corresponding relationship between the currently traversed to-be-checked image layer and the standard layer.
As an implementation manner, the electronic device may determine the standard layer with the highest matching degree as the standard layer corresponding to the currently traversed layer to be checked. At this time, the standard layer, that is, the matched standard layer, may not be calculated again when traversing the next layer to be checked, so as to reduce the calculation amount and improve the matching efficiency.
And S204, continuously traversing the next layer to be checked and accepted, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and accepted and each unmatched standard layer according to the types and positions of the layers to be checked and the standard layers until the traversal of all the layers to be checked and accepted is finished, so as to obtain the corresponding relation between the layers to be checked and the standard layers.
And then, the electronic equipment can continuously traverse the next layer to be checked and returns to the step of calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and the positions of the layers to be checked and the standard layers until all the layers to be checked and accepted are traversed, so that the corresponding relation between each layer to be checked and each standard layer can be obtained.
It can be seen that, in this embodiment, the electronic device may sort the layers to be checked according to the position of each layer to be checked and the preset sorting rule, obtain a sorting result, traverse each layer to be checked according to the sorting result, and when each layer to be checked is traversed, calculate the matching degree between the layer to be checked and each unmatched standard layer according to the type and the position of each layer to be checked and each standard layer, and then determine the standard layer matched with the layer to be checked based on the matching degree, and further obtain the corresponding relationship between each layer to be checked and each standard layer. Therefore, the corresponding relation between each layer to be checked and each standard layer can be accurately determined according to the matching degree, and the checking efficiency and accuracy of the application program interface are further improved.
As an implementation manner of the embodiment of the present invention, before the step of traversing the layers to be checked according to the sorting result, the method may further include:
and determining the adjacent layer of each standard layer according to the position of each standard layer.
Since the matching degree between adjacent layers needs to be calculated when calculating the matching degree between the layers, in order to improve the traversal efficiency, the electronic device may determine the adjacent layer of each standard layer according to the position of each standard layer before traversing each to-be-checked layer according to the sorting result. The adjacent layer may be a layer adjacent to the standard layer in 4 directions, i.e., up, down, left, and right directions, in the interface, or 2 or 3 of the four directions may be selected as the adjacent layer.
Correspondingly, the step of calculating the matching degree between the currently traversed acceptance layer and each currently unmatched standard layer according to the types and positions of each layer to be accepted and each standard layer may include:
determining an adjacent layer of the current layer to be checked according to the position of each layer to be checked; and respectively calculating the matching degree between the currently traversed layer to be checked and accepted and each currently unmatched standard layer based on the types of the currently traversed layer to be checked and the adjacent layer thereof and the types of each currently unmatched standard layer and the adjacent layer thereof.
The electronic device may determine, according to the position of each layer to be checked, an adjacent layer of the currently traversed layer to be checked, where the adjacent layer may be a layer that is adjacent to the currently traversed layer to be checked in 4 directions, i.e., up, down, left, and right, in the interface, and may also select, as the adjacent layer, 2 or 3 layers that are adjacent to each other in the four directions. In order to facilitate the determination of the matching degree, the number of the adjacent layers of the currently traversed to-be-checked graph layer and the adjacent layers of the standard graph layer and the corresponding direction in the interface may be kept consistent.
After determining the adjacent layer of the currently traversed to-be-checked image layer, the electronic device may respectively calculate a matching degree between the currently traversed to-be-checked image layer and each currently unmatched standard image layer based on the currently traversed to-be-checked image layer and the type of the adjacent layer thereof, and the type of each currently unmatched standard image layer and the type of the adjacent layer thereof.
If the type of the currently traversed layer to be checked is the same as that of the standard layer, and the type of the adjacent layer of the currently traversed layer to be checked is also the same as that of the adjacent layer of the standard layer, it may be determined that the matching degree between the currently traversed layer to be checked and the standard layer is the highest, and may be, for example, recorded as 1.
If the type of the currently traversed layer to be checked is different from that of the standard layer, it may be determined that the matching degree between the currently traversed layer to be checked and the standard layer is the lowest, and may be, for example, recorded as 0.
If the type of the currently traversed layer to be checked is the same as that of the standard layer, and the type of the adjacent layer of the currently traversed layer to be checked is the same as or different from that of the adjacent layer of the standard layer, the matching degree between the currently traversed layer to be checked and the standard layer may be determined according to the number of the adjacent layers with the same type, for example, a value between 0 and 1. In an embodiment, the larger the number of adjacent layers with the same type is, the higher the matching degree between the currently traversed layer to be checked and the standard layer may be.
For example, in the interface 300 to be checked and received shown in fig. 3(a), the adjacent layers of the currently traversed layer 310 to be checked and received include an adjacent layer 311, an adjacent layer 312, and an adjacent layer 313. In the standard interface 301 shown in fig. 3(b), the unmatched standard layers include a standard layer 320, a standard layer 321, a standard layer 322, and a standard layer 323. The electronic device may determine matching degrees between the currently traversed to-be-checked graph layer 310 and the standard graph layer 320, the standard graph layer 321, the standard graph layer 322, and the standard graph layer 323, respectively.
When the matching degree between the currently traversed to-be-checked graph layer 310 and the standard graph layer 320 is calculated, whether the type of the currently traversed to-be-checked graph layer 310 is the same as that of the standard graph layer 320 or not, and whether the types of the adjacent graph layer 311, the adjacent graph layer 312, and the adjacent graph layer 313 are the same as those of the standard graph layer 321, the standard graph layer 322, and the standard graph layer 323, respectively, or not may be determined, so that the matching degree is obtained.
It can be seen that, in this embodiment, the electronic device may determine, according to the position of each layer to be checked, an adjacent layer of the currently traversed layer to be checked, and calculate the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer based on the type of the currently traversed layer to be checked and the adjacent layer thereof, and the type of each currently unmatched standard layer and the adjacent layer thereof, so that the currently traversed layer to be checked and the adjacent layer thereof may be considered at the same time, and the accuracy of the matching degree calculation is ensured.
As an implementation manner of the embodiment of the present invention, the step of determining the adjacent layer of each standard layer and the distance between each standard layer and the corresponding adjacent layer according to the size and the position of each standard layer may include:
determining a layer row and/or a layer column to which each standard layer belongs according to the size and the position of each standard layer, and determining a layout relation of each standard layer in the standard interface based on the layer row and/or the layer column to which each standard layer belongs; and determining adjacent layers of each standard layer and the space between each standard layer and the corresponding adjacent layer according to the layout relation.
And each standard layer in the layer row has an intersection region with at least one other standard layer after being expanded along the transverse direction, and each standard layer in the layer column has an intersection region with at least one other standard layer after being expanded along the longitudinal direction. The electronic device may determine whether each standard layer has an overlapping portion in the horizontal direction (horizontal direction) and an overlapping portion in the vertical direction (vertical direction), and the electronic device may determine a layer row to which each standard layer belongs according to whether each standard layer has an overlapping portion in the horizontal direction, and/or determine a layer column to which each standard layer belongs according to whether each standard layer has an overlapping portion in the vertical direction (vertical direction).
Because the layer rows and/or layer columns to which the standard layers belong can represent the position relationship of the standard layers in the standard interface, the electronic device can determine the layout relationship of each standard layer in the standard interface according to the determined layer rows and/or layer columns, that is, the position relationship of the standard layers in the standard interface, namely, the position relationship of the standard layers in the upper, lower, left and right directions.
Next, the electronic device may determine an adjacent layer of each standard layer and a distance between the adjacent layers according to a position relationship of the standard layer in the standard interface. The adjacent layer can be other standard layers with the minimum distance between the adjacent layer and the standard layer in the horizontal direction and the vertical direction.
As can be seen, in this embodiment, the electronic device may determine, according to the size and the position of each standard layer, a layer row and/or a layer column to which each standard layer belongs, determine, based on the layer row and/or the layer column to which each standard layer belongs, a layout relationship of each standard layer in the standard interface, and further determine, according to the layout relationship, an adjacent layer of each standard layer and a distance between each standard layer and a corresponding adjacent layer, so that the adjacent layer of each standard layer and the corresponding distance may be accurately and quickly determined.
As an implementation manner of the embodiment of the present invention, as shown in fig. 4, the step of determining the layer row and/or layer column to which each standard layer belongs according to the size and the position of each standard layer, and determining the layout relationship of each standard layer in the standard interface based on the layer row and/or layer column to which each standard layer belongs may include:
s401, determining the layer rows to which the standard layers belong according to the sizes and the positions of the standard layers;
when the distance between layers is determined, the electronic device may determine, according to the size and the position of each standard layer, a layer row to which each standard layer belongs. And each standard layer in the layer rows has an intersection area with at least one other standard layer after being expanded along the transverse direction.
That is, the electronic device may determine whether each of the standard layers has an overlapping portion in the horizontal direction (lateral direction), and determine a row to which each of the standard layers belongs. Wherein, the horizontal direction may be a width direction of the application program interface. And if an intersection region exists between a certain standard layer and at least one other standard layer after the certain standard layer is transversely expanded, dividing the standard layer with the intersection region into the same layer row.
For example, as shown in the standard interface 500 in fig. 5, since there is an intersection region after the standard layer a and the standard layer B are laterally expanded, the two standard layers are divided into the same layer row. Because the standard layer C-the standard layer G has an intersection area after being expanded along the transverse direction, the standard layer C-the standard layer G is divided into a layer row.
S402, traversing each undetermined layer row, calculating the distance between the currently traversed layer row and the determined layer row as well as the longitudinal boundary of the standard interface, and determining the layer row corresponding to the minimum distance as a target layer row;
after each layer row is obtained through division, the electronic device may traverse each layer row that is not determined, calculate a distance between a currently traversed layer row and a determined layer row and a longitudinal boundary of the standard interface, and determine a layer row corresponding to the minimum distance as a target layer row.
When the currently traversed layer row is the first traversed layer row, the determined layer row does not exist at this time, and then only the distance between the layer row and the longitudinal boundary of the standard interface may be calculated. Furthermore, the electronic device may determine, as the first target layer row, a row with the smallest distance from the longitudinal boundary of the standard interface among all layer rows. The electronic device may determine, as the first target layer row, a row with the minimum distance from a longitudinal boundary of the parent layer among all layer rows.
When the second target layer row is determined, the electronic device may calculate a distance between the currently undetermined layer row and the first target layer row and between the currently undetermined layer row and the longitudinal boundary of the standard interface, and further determine the layer row corresponding to the minimum distance as the second target layer row, and so on, may determine the order of all the layer rows.
S403, traversing the target layer row, if the target layer row only comprises one standard layer, adding the identifier of the standard layer into the dependency relationship array, returning to each layer row which is not determined by the traversal, and calculating the distance between the currently traversed layer row and the determined layer row and the boundary of the standard interface until the traversal of all the layer rows is finished;
and after a target layer row is determined, traversing the target layer row, if the currently traversed target layer row only comprises a standard layer, adding the identifier of the standard layer into the dependency relationship array, returning to each layer row which is not determined by the traversal, and calculating the distance between the currently traversed layer row and the determined layer row as well as the boundary of the standard interface until the traversal of all the layer rows is finished.
If the currently traversed target layer row only includes one standard layer, it is described that the standard layer in the target layer row only belongs to one layer column, and the relative position relationship between the standard layer and the standard layer in the traversed layer row can also be determined, then the identifier of the standard layer may be added to the dependency relationship array.
The dependency relationship array records identifiers of standard layers included in traversed layer rows, and is used for representing the layout relationship of each standard layer in the standard interface, that is, the upper, lower, left and right relationships between one standard layer and other standard layers in the position of the standard interface. For a normalized layer, the position of the normalized layer in the interface may be determined depending on the normalized layer in the dependency array before the normalized layer's identification.
S404, if the currently traversed target graph layer row comprises a plurality of standard graph layers, determining a graph layer column to which each standard graph layer belongs according to the sizes and the positions of the plurality of standard graph layers;
and each standard layer in the layer column has an intersection area with at least one other standard layer after being longitudinally expanded. It should be noted that, for the standard layers in the target layer row, the layer columns here are not the layer columns to which all the standard layers in the standard interface belong.
For example, as shown in fig. 5, when the currently traversed target layer behavior includes layer rows of a standard layer a and a standard layer B, the electronic device may determine, according to the sizes and positions of the standard layer a and the standard layer B, that no intersection region exists after the standard layer a and the standard layer B are longitudinally extended, so that the standard layer a and the standard layer B are divided into two layer columns.
S405, traversing each undetermined image layer column, calculating the distance between the currently traversed image layer column and the determined image layer column as well as the transverse boundary of the standard interface, and determining the image layer column corresponding to the minimum distance as a target image layer column;
after obtaining each layer column by division, the electronic device may traverse each undetermined layer column, calculate a distance between the currently traversed layer column and the determined layer column and a lateral boundary of the standard interface, and determine the layer column corresponding to the minimum distance as a target layer column.
When the currently traversed layer column is the first traversed layer column, and there is no determined layer column at this time, only the distance between the layer column and the lateral boundary of the standard interface may be calculated. Furthermore, the electronic device may determine a column having a smallest distance from a lateral boundary of the standard interface among all the map-level columns as a first target map-level column.
When determining the second target chart tier, the electronic device may calculate a distance between the currently undetermined chart tier and the first target chart tier as well as a lateral boundary of the standard interface, and further determine the chart tier corresponding to the minimum distance as the second target chart tier, and so on, may determine the order of all the chart tiers.
S406, traversing the target map-level column, if the target map-level column only comprises one standard map-level, adding the identifier of the standard map-level into the dependency relationship array, returning to each map-level column which is not determined by the traversal, and calculating the distance between the currently traversed map-level column and the determined map-level column as well as the boundary of the standard interface until all the map-level columns are traversed;
and traversing a target map-layer column after determining the target map-layer column, if the target map-layer column only comprises one standard map layer, adding the identifier of the standard map layer to the dependency relationship array, returning to each map-layer column which is not determined by the traversal, and calculating the distance between the currently traversed map-layer column and the determined map-layer column and the boundary of the standard interface until the traversal of all the map-layer columns is finished.
For example, as shown in fig. 5, when traversing the layer rows to which the standard layer C-standard layer G belongs, calculating the distance between the standard layer C-standard layer G and the lateral boundary of the parent layer, since the distance between the standard layer G and the right side boundary of the parent layer is the smallest, the column of the standard layer G is the first target layer column, traversing the target layer column, and since the target layer column only includes one standard layer G, the identifier of the standard layer G may be added to the dependency relationship array. The current dependency array is (A, B), then the addition results in a dependency array of (A, B, G).
And S407, if the target layer column includes a plurality of standard layers, returning to the step of determining the layer row to which each standard layer belongs according to the size and position of each standard layer until all layer columns corresponding to the target layer row are traversed.
If the currently traversed target map layer column includes a plurality of standard map layers, it is described that the standard map layers in the target map layer column may belong to a plurality of map layer rows, and in order to determine the position relationship between the plurality of standard map layers and the traversed map layer column and the standard map layers in the map layer rows, the electronic device may return to the step of determining the map layer rows to which the standard map layers belong according to the size and the position of the standard map layers.
That is to say, the electronic device may divide the layer rows to which the standard layers belong according to the size and the position of the currently traversed target layer column that includes a plurality of standard layers, for example, as shown in fig. 5, for a target layer column that includes a standard layer D and a standard layer E, the standard layer D and the standard layer E may be divided into different layer rows according to the size and the position of the standard layer D and the standard layer E, respectively.
Next, the electronic device may traverse each layer row that is not determined, calculate a distance between the currently traversed layer row and the determined layer row and a longitudinal boundary of the standard interface, and determine the layer row corresponding to the minimum distance as a target layer row. It should be noted that each layer row that is not currently determined is a layer row included in the target column currently traversed, for example, the layer row to which the standard layer D and the standard layer E respectively belong shown in fig. 5.
Furthermore, the electronic device may perform processing according to the above steps until the layer rows or layer columns obtained by division do not include a plurality of standard layers any more, so as to obtain a final dependency array. That is, the electronic device may determine the layout relationship of the standard layers in the standard interface in a row-column staggered manner.
For example, as shown in fig. 5, when traversing the graph layer columns where the standard layer D and the standard layer E are located, because the standard layer D and the standard layer E belong to two layer rows respectively, the electronic device may determine the current target layer row according to the distance between the standard layer D and the standard layer E and the longitudinal boundary of the determined layer row and the parent layer respectively, because the upper boundary of the standard layer D and the standard layer C is the same, the distance between the second row in the layer rows determined by the standard layer D, that is, the layer row where the second row is located is 0, which is the smallest, so the standard layer D is the current target layer row, and the electronic device may traverse the target layer row, because only the standard layer D is included, the identifier of the standard layer D may be added to the dependent array, and the dependent array is (a, B, g, F, C, D).
Next, the electronic device may traverse the layer row where the standard layer E is located, and since only the standard layer E is included, the identifier of the standard layer E may be added to the dependency array, so that the dependency array may be obtained as (a, B, G, F, C, D, E).
If the layer row of the standard layer E includes a plurality of standard layers, the above S404 is executed continuously, and so on until the identifiers of all the standard layers are added to the dependency relationship array.
In the above process, layer rows and layer columns may be exchanged, that is, in step S401, the layer column to which each standard layer belongs may be determined according to the size and the position of each standard layer, and in step S402 to step S407, the layer rows are replaced by the layer columns, and the layer columns are replaced by the layer rows, which is also reasonable.
Correspondingly, the step of determining the adjacent layer of each standard layer and the distance between each standard layer and the corresponding adjacent layer according to the layout relationship may include:
step A: sequentially traversing each identifier in the dependency relationship array, and determining the transverse and longitudinal distances between the standard layer corresponding to the currently traversed identifier and the layer with the determined distance when one identifier is traversed;
after traversing all layer rows and layer columns in the above manner, a final dependency relationship array can be determined, and the order of each identifier in the dependency array represents the dependency relationship of each standard layer in the standard interface on the position. And the electronic device may sequentially traverse each identifier in the dependency relationship array to determine a corresponding distance between each standard layer.
Specifically, when one identifier is traversed, the horizontal and vertical distances between the standard layer corresponding to the currently traversed identifier and the layer with the determined distance are determined. When the currently traversed identifier is the first identifier, there may not be a layer with a determined distance at this time, so the electronic device may determine the distance corresponding to the currently traversed identifier according to the following manner, specifically: the distance between the standard layer and the boundary of the standard interface in the horizontal direction and the vertical direction can be used as the corresponding distance; or presetting a calculation reference line, and taking the distance between the standard layer and the calculation reference line as the corresponding distance; it is also reasonable to use the distance between the standard layer and the boundary of the layer with the largest area (parent layer) in the horizontal direction and the vertical direction as the corresponding distance.
When the horizontal and longitudinal distances between the standard layer corresponding to the currently traversed identifier and the layers with the determined distances are determined, the horizontal and longitudinal distances between the standard layer corresponding to the currently traversed identifier and all the layers with the determined distances may be calculated, and the horizontal and longitudinal distances between the standard layer corresponding to the currently traversed identifier and a preset number of layers with the determined distances may also be calculated, which is not specifically limited herein.
And B: determining the layer with the smallest corresponding transverse and longitudinal distances as an adjacent layer of a standard layer corresponding to the currently traversed identifier, determining the smallest distance as the distance between the standard layer and the adjacent layer, and determining the standard layer as the layer with the determined distance;
after obtaining the horizontal and longitudinal distances, the electronic device may determine the layer with the corresponding minimum horizontal and longitudinal distances as an adjacent layer of the standard layer corresponding to the currently traversed identifier, determine the minimum distance as the distance between the standard layer and the adjacent layer, and simultaneously determine that the standard layer is the layer with the determined distance.
For example, the dependency array corresponding to the standard interface shown in fig. 5 is (a, B, G, F, C, D, E). When the identifier D is traversed, the layers with the currently determined distances are respectively the standard layer a, the standard layer B, the standard layer G, the standard layer E, and the standard layer C, and then the electronic device may calculate 5 distances in the horizontal direction and 5 distances in the longitudinal direction.
If the minimum distance between the standard layer D and the reference layer D in the transverse direction is the standard layer C, it may be determined that the layer adjacent to the standard layer D in the transverse direction is the standard layer C, and the distance is the distance between the standard layer D and the standard layer C in the transverse direction. If the minimum distance between the standard layer D and the longitudinal direction is the standard layer a, it may be determined that the layer adjacent to the standard layer D in the longitudinal direction is the standard layer a, and the distance is the longitudinal distance between the standard layer D and the standard layer a.
And C: and continuously traversing the next identifier, and returning to the step of determining the distance between the standard layer corresponding to the currently traversed identifier and the layer with the determined distance in the horizontal direction and the vertical direction until all identifiers are traversed.
Next, the electronic device may continue to traverse the next identifier, and return to the step of determining the distance between the standard layer corresponding to the currently traversed identifier and the layer with the determined distance in the horizontal direction and the vertical direction until all identifiers are traversed, that is, the adjacent layers and the corresponding distances of all the standard layers are determined.
Therefore, in the embodiment, the electronic device can accurately determine the adjacent layers of the standard layers in the horizontal direction and the vertical direction and the distance between the adjacent layers by adopting the above mode, manual measurement is not needed, and the acceptance efficiency of the application program interface can be improved.
As an implementation manner of the embodiment of the present invention, the step of obtaining attribute information of each layer to be checked in the interface to be checked and obtaining attribute information of each standard layer in the standard interface may include:
calling a preset view interface, and extracting attribute information of each layer to be checked and accepted in the interface to be checked and accepted; analyzing each standard layer in the standard interface to obtain attribute information of each standard layer in the standard interface.
Because the interface to be checked is a developed and executable application program interface, the electronic device can call a preset view interface and extract attribute information of each layer to be checked in the interface to be checked. The preset view interface may be any interface capable of providing a function of analyzing layer attribute information in the interface, and is not specifically limited herein.
The standard interface is an interface in a design draft, the design draft is a manuscript drawn by a design institute for guiding development, and the design draft is generally a file in a psd format, a sketch format and the like, so that the attribute information of a standard layer in the standard interface cannot be extracted through a preset view interface. In order to obtain the attribute information of the standard layer, the electronic device may analyze each standard layer in the standard interface through image processing software and the like, so as to obtain the attribute information of each standard layer in the standard interface. The image processing software may be PhotoShop, Sketch, Figma, etc., and is not limited herein.
As can be seen, in this embodiment, the electronic device may call the preset view interface, extract attribute information of each layer to be checked in the interface to be checked, analyze each standard layer in the standard interface, and obtain attribute information of each standard layer in the standard interface. Therefore, the attribute information of the layer in the interface to be checked can be accurately obtained no matter the interface is the interface to be checked or the standard interface is the interface to be checked.
As an implementation manner of the embodiment of the present invention, before the step of obtaining attribute information of each layer to be checked and accepted in the interface to be checked and accepted, the method may further include:
acquiring running condition parameters of an interface to be checked and received of an application program, and configuring a running environment based on the running condition parameters; and starting the application program based on the running environment, and entering the interface to be checked.
When the acceptance is started, the acceptance personnel can enter the operation condition parameters of the interface to be accepted, and the operation condition parameters can include an entry path of the interface to be accepted, test environment configuration parameters of the interface to be accepted and the like. Furthermore, the electronic equipment can acquire the running condition parameters input by the acceptance staff, and the running environment is configured through the automatic test script based on the running condition parameters.
And then, starting an application program based on the configured running environment, entering an interface to be checked and accepted, acquiring attribute information of each layer to be checked and accepted in the interface to be checked and accepted, and further continuing to execute other checking and accepting operations.
Therefore, in this embodiment, the electronic device may obtain the operation condition parameters of the interface to be checked and received of the application program, configure the operation environment based on the operation condition parameters, and then start the application program based on the operation environment to enter the interface to be checked and received. In the process of configuring the operating environment and entering the interface to be checked and accepted after the application program is started, the manual operation of checking and accepting personnel is not needed, and the automation degree and efficiency of checking and accepting the interface of the application program are further improved.
As an implementation manner of the embodiment of the present invention, in order to further improve the acceptance efficiency of the application program interface, before the step of determining the corresponding relationship between each layer to be accepted and each standard layer based on the size, the position, and the type of each layer to be accepted and each standard layer, the method may further include:
and performing layer processing on each to-be-checked image layer and each standard image layer by adopting at least one of the following modes:
the first mode is as follows: and determining a redundant layer according to the pattern and the size of each to-be-checked image layer and each standard image layer, and removing the redundant layer.
Since some redundant layers may exist in each layer to be checked and each standard layer, for example, a layer with a transparency of 100%, a layer completely covered by other layers, and the like, when the layers are displayed in the screen of the electronic device in the application program interface, the layers are visually invisible to a user, that is, the redundant layers, and may be removed in order to improve the checking efficiency.
The first mode is as follows: aiming at the graph layer to be checked and received and the standard graph layer with the type of the text type, the heights of the graph layers with the same word size are adjusted to be the same.
Because the height of each layer can influence the calculation of the distance between the layers, the distance between the layers is conveniently calculated subsequently, the accuracy of the distance calculation result is ensured, and for the to-be-checked and accepted layer and the standard layer with the text type, the electronic equipment can adjust the height of the layer with the same character number of the included characters to be the same height.
The third mode is as follows: and combining a plurality of layers belonging to the same icon into one layer.
In the standard interface corresponding to the design draft, some icons are composed of a plurality of layers, and the icons are essentially the layers corresponding to one icon, so that the plurality of layers belonging to the same icon can be combined into one layer for convenience of processing.
It can be seen that, in this embodiment, the electronic device may perform layer processing on the layer to be checked and accepted and the standard layer in at least one of the three manners, so that the checking and accepting efficiency of the application program interface and the accuracy of the checking and accepting result may be further improved.
As an implementation manner of the embodiment of the present invention, the method may further include:
intercepting the image of the interface to be checked; and displaying the acceptance result and the image.
In order to facilitate the checking and accepting personnel to check the checking and accepting result, the electronic equipment can also intercept the image of the interface to be checked and accepted, and then display the image while displaying the checking and accepting result. In one embodiment, the image may be further marked with an acceptance layer to be accepted with an acceptance result of non-acceptance, so that an acceptance person can quickly locate the acceptance layer to be accepted with non-acceptance.
Therefore, in the embodiment, the electronic device can also intercept the image of the interface to be checked and accepted, and display the checking and accepting result and the image, so that checking and accepting personnel can conveniently check the checking and accepting result, and the layer to be checked and accepted, which does not pass the checking and accepting, can be quickly positioned.
As an implementation manner of the embodiment of the present invention, after the step of obtaining the attribute information of each layer to be checked in the interface to be checked and obtaining the attribute information of each standard layer in the standard interface, the method may further include:
displaying the interface to be checked and accepted and the standard interface; when the click operation is captured, displaying attribute information of a layer to be checked and received corresponding to the click operation and attribute information of a standard layer; when the checking operation is captured, recording attribute information corresponding to the checking operation, and generating an acceptance result.
After the electronic device obtains the attribute information of each image layer to be checked and accepted and the attribute information of each standard image layer, the electronic device can display the interface to be checked and accepted and the standard interface, and at the moment, a checking and accepting person can click the image layer to be checked and accepted and the standard image layer to be compared. And when capturing the click operation, the electronic equipment displays the attribute information of the layer to be checked and received corresponding to the click operation and the attribute information of the standard layer.
Furthermore, the acceptance can quickly check the attribute information of the image layer to be accepted and the attribute information of the standard image layer, and further determine whether the attribute information and the standard image layer are consistent, if the wrong attribute information exists, the attribute information can be selected, and the electronic equipment can store the attribute information selected by the acceptance staff.
For example, the electronic device displays the interface to be checked and the standard interface, and the check personnel clicks the layer to be checked and the standard layer to be compared. When capturing the click operation, the electronic device may display an attribute information comparison interface as shown in fig. 6, so that an acceptance inspector may quickly check whether the attribute information of the to-be-accepted image layer is consistent with the attribute information of the standard image layer. The attribute information comparison interface may display attribute information such as width, height, font size, and shadow of the to-be-checked drawing layer corresponding to the click operation in the development draft (to-be-checked interface), which is not specifically limited herein.
As can be seen, in this embodiment, the electronic device may display the interface to be checked and accepted and the standard interface; and when capturing the click operation, displaying the attribute information of the layer to be checked corresponding to the click operation and the attribute information of the standard layer, and further recording the attribute information corresponding to the check operation when capturing the check operation to generate a check result. Therefore, the acceptance personnel only need to check the attribute information and do not need to acquire the attribute information in a manual measurement mode, and the acceptance efficiency of the application program interface can be improved.
Corresponding to the acceptance method of the application program interface, the embodiment of the invention also provides an acceptance device of the application program interface. The following describes an acceptance apparatus for an application program interface according to an embodiment of the present invention.
As shown in fig. 7, an acceptance apparatus for an application program interface, the apparatus comprising:
the attribute information acquiring module 710 is configured to acquire attribute information of each layer to be checked in the interface to be checked, and acquire attribute information of each standard layer in the standard interface;
the standard interface is an interface defined by a design draft corresponding to the interface to be checked and accepted, and the attribute information comprises size, position, type and style.
A corresponding relation determining module 720, configured to determine, based on the sizes, positions, and types of the to-be-checked and accepted image layers and the standard image layers, a corresponding relation between each to-be-checked and accepted image layer and each standard image layer;
a first distance determining module 730, configured to determine, according to the size and the position of each standard layer, an adjacent layer of each standard layer and a distance between each standard layer and a corresponding adjacent layer;
a second distance determining module 740, configured to determine, according to the correspondence and the size and position of each layer to be checked and accepted, an adjacent layer of each layer to be checked and a distance between each layer to be checked and the corresponding adjacent layer;
and the layer acceptance module 750 is configured to compare the pattern and the interval of each layer to be accepted with the pattern and the interval of the corresponding standard layer, respectively, based on the corresponding relationship, and determine an acceptance result of each layer to be accepted.
It can be seen that in the scheme provided in the embodiment of the present invention, the electronic device may obtain attribute information of each layer to be checked in the interface to be checked, and obtain attribute information of each standard layer in the standard interface, where the standard interface is an interface in a design draft corresponding to the interface to be checked, and the attribute information includes a size, a position, a type, and a style, and determines a corresponding relationship between each layer to be checked and each standard layer based on the size, the position, and the type of each layer to be checked, and determines an adjacent layer of each standard layer and a distance between each layer to be checked and the corresponding adjacent layer according to the size and the position of each layer to be checked, and further determines an adjacent layer of each layer to be checked and a distance between each layer to be checked and the corresponding adjacent layer according to the corresponding relationship and the size and the position of each layer to be checked, and aiming at each layer to be checked and accepted, respectively comparing the pattern and the interval of the layer to be checked and accepted with the pattern and the interval of the corresponding standard layer based on the corresponding relation, and determining the checking and accepting result of each layer to be checked and accepted. The check and acceptance efficiency of the application program interface can be greatly improved because the patterns and the intervals of all the layers in the interface to be checked and the standard interface do not need to be manually measured, and the interface to be checked and accepted does not need to be manually compared with the interface corresponding to the design draft.
As an implementation manner of the embodiment of the present invention, as shown in fig. 8, the correspondence determining module 720 may include:
the layer sequencing unit 721 is configured to sequence the layers to be checked and accepted according to the positions of the layers to be checked and accepted and a preset sequencing rule, so as to obtain a sequencing result;
the corresponding relation determining unit 722 is configured to traverse the layers to be checked according to the sorting result, and when each layer to be checked is traversed, calculate a matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and positions of the layers to be checked and the standard layers;
determining a standard layer matched with the currently traversed to-be-checked image layer based on the matching degree, recording the corresponding relation between the currently traversed to-be-checked image layer and the standard layer, and determining that the standard layer is matched;
and continuously traversing the next layer to be checked and accepted, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and accepted and each unmatched standard layer according to the types and the positions of the layers to be checked and accepted and the standard layers until all the layers to be checked and accepted are traversed, so as to obtain the corresponding relation between the layers to be checked and the standard layers.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
an adjacent layer determining module, configured to determine, according to the position of each standard layer, an adjacent layer of each standard layer before traversing each to-be-checked and received layer according to the sorting result;
the matching degree calculation unit may include:
an adjacent layer determining subunit, configured to determine, according to the position of each layer to be checked and accepted, an adjacent layer of a currently traversed layer to be checked and accepted;
and the matching degree calculation operator unit is used for respectively calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer based on the types of the currently traversed layer to be checked and the adjacent layers thereof and the types of each currently unmatched standard layer and the adjacent layers thereof.
As an implementation manner of the embodiment of the present invention, the first distance determining module 730 may include:
the layout relation determining unit is used for determining the layer rows and/or layer columns to which each standard layer belongs according to the size and the position of each standard layer, and determining the layout relation of each standard layer in the standard interface based on the layer rows and/or the layer columns to which each standard layer belongs;
and each standard layer in the layer row has an intersection region with at least one other standard layer after being expanded along the transverse direction, and each standard layer in the layer column has an intersection region with at least one other standard layer after being expanded along the longitudinal direction.
And the space determining unit is used for determining adjacent layers of each standard layer and the space between each standard layer and the corresponding adjacent layer according to the layout relation.
As an implementation manner of the embodiment of the present invention, the layout relationship determining unit may include:
the layer row and column dividing subunit is used for determining the layer rows to which the standard layers belong according to the sizes and the positions of the standard layers;
the target row determining subunit is configured to traverse each layer row that is not determined, calculate a distance between a currently traversed layer row and the determined layer row and a longitudinal boundary of the standard interface, and determine a layer row corresponding to the minimum distance as a target layer row;
a layer row traversal subunit, configured to traverse the target layer row, add an identifier of the standard layer to the dependency array if the target layer row only includes one standard layer, return to each layer row that is not determined by the traversal, and calculate a distance between a currently traversed layer row and a boundary between the determined layer row and the standard interface until all layer rows are traversed; if the target layer row comprises a plurality of standard layers, determining a layer column to which each standard layer belongs according to the sizes and positions of the plurality of standard layers, wherein the dependency relationship array records identifiers of the standard layers included in the traversed layer row and is used for representing the layout relationship of each standard layer in the standard interface;
the target column determining subunit is used for traversing each undetermined image layer column, calculating the distance between the currently traversed image layer column and the determined image layer column as well as the transverse boundary of the standard interface, and determining the image layer column corresponding to the minimum distance as a target image layer column;
a layer column traversal subunit, configured to traverse the target layer column, add, if the target layer column only includes one standard layer, an identifier of the standard layer to the dependency relationship array, return to each layer column that is not determined by the traversal, and calculate a distance between a currently traversed layer column and a boundary between the determined layer column and the standard interface until all layer columns are traversed; if the target layer column comprises a plurality of standard layers, returning to the step of determining the layer row to which each standard layer belongs according to the size and the position of each standard layer until all layer columns corresponding to the target layer row are traversed;
the above-mentioned interval determination unit may include:
the identifier traversal subunit is used for sequentially traversing each identifier in the dependency relationship array, and determining the horizontal and vertical distances between the standard layer corresponding to the currently traversed identifier and the determined layer when one identifier is traversed; determining the layer with the smallest corresponding transverse and longitudinal distances as an adjacent layer of a standard layer corresponding to the currently traversed identifier, determining the smallest distance as the distance between the standard layer and the adjacent layer, and determining the standard layer as the determined layer; and continuously traversing the next identifier, and returning to the step of determining the transverse and longitudinal distances between the standard layer corresponding to the currently traversed identifier and the determined layer until all identifiers are traversed.
As an implementation manner of the embodiment of the present invention, the attribute information obtaining module 710 may include:
the first attribute information determining unit is used for calling a preset view interface and extracting attribute information of each layer to be checked and accepted in the interface to be checked and accepted;
and the second attribute information determining unit is used for analyzing each standard layer in the standard interface to obtain the attribute information of each standard layer in the standard interface.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
the operation environment configuration module is used for acquiring operation condition parameters of the to-be-checked and accepted interface of the application program before acquiring the attribute information of each to-be-checked and accepted layer in the to-be-checked and accepted interface, and configuring an operation environment based on the operation condition parameters;
and the application program starting module is used for starting the application program based on the running environment and entering the interface to be checked and received.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
the layer processing module is configured to perform layer processing on each to-be-checked image layer and each standard layer in at least one of the following manners before determining a correspondence between each to-be-checked image layer and each standard layer based on the size, the position, and the type of each to-be-checked image layer and each standard layer:
determining a redundant layer according to the pattern and the size of each to-be-checked image layer and each standard image layer, and removing the redundant layer; or the like, or, alternatively,
aiming at an image layer to be checked and received and a standard image layer with the type of a text, adjusting the heights of the image layers with the same character size of the included characters to be the same; or the like, or, alternatively,
and combining a plurality of layers belonging to the same icon into one layer.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
the image intercepting module is used for intercepting the image of the interface to be checked and received;
and the result display module is used for displaying the acceptance result and the image.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
the interface display module is used for displaying the interface to be checked and accepted and the standard interface after acquiring the attribute information of each layer to be checked and accepted in the interface to be checked and acquiring the attribute information of each standard layer in the standard interface;
the attribute information display module is used for displaying the attribute information of the layer to be checked and accepted corresponding to the click operation and the attribute information of the standard layer when the click operation is captured;
and the acceptance result generating module is used for recording the attribute information corresponding to the checking operation when the checking operation is captured, and generating an acceptance result.
An embodiment of the present invention further provides an electronic device, as shown in fig. 9, which includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete mutual communication through the communication bus 904,
a memory 903 for storing computer programs;
the processor 901 is configured to implement the steps of the method for accepting the application program interface according to any of the embodiments described above when executing the program stored in the memory 903.
It can be seen that, in the scheme provided in the embodiment of the present invention, the electronic device may obtain attribute information of each layer to be checked in the interface to be checked, and obtain attribute information of each standard layer in the standard interface, where the standard interface is an interface defined by a design draft corresponding to the interface to be checked, and the attribute information includes a size, a position, a type, and a style, and determines a corresponding relationship between each layer to be checked and each standard layer based on the size, the position, and the type of each layer to be checked, and determines an adjacent layer of each standard layer and a distance between each layer to be checked and the corresponding adjacent layer according to the size and the position of each layer to be checked, and further determines an adjacent layer of each layer to be checked and a distance between each layer to be checked and the corresponding adjacent layer according to the corresponding relationship and the size and the position of each layer to be checked, and aiming at each layer to be checked and accepted, respectively comparing the pattern and the interval of the layer to be checked and accepted with the pattern and the interval of the corresponding standard layer based on the corresponding relation, and determining the checking and accepting result of each layer to be checked and accepted. The check and acceptance efficiency of the application program interface can be greatly improved because the patterns and the intervals of all the layers in the interface to be checked and the standard interface do not need to be manually measured, and the interface to be checked and accepted does not need to be manually compared with the interface corresponding to the design draft.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one cache device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which has instructions cached therein, and when the computer-readable storage medium is run on a computer, the computer is caused to execute the steps of the acceptance method of the application program interface described in any of the above embodiments.
It can be seen that in the scheme provided in the embodiment of the present invention, when running on a computer, a command cached in a computer-readable storage medium may obtain attribute information of each layer to be checked in an interface to be checked, and obtain attribute information of each standard layer in a standard interface, where the standard interface is an interface defined by a design draft corresponding to the interface to be checked, and the attribute information includes a size, a position, a type, and a style, a correspondence between each layer to be checked and each standard layer is determined based on the size, the position, and the type of each layer to be checked and each standard layer, an adjacent layer of each standard layer and a distance between each layer to be checked and each layer to be checked are determined according to the size and the position of each layer to be checked and each layer, and aiming at each layer to be checked and accepted, respectively comparing the pattern and the interval of the layer to be checked and accepted with the pattern and the interval of the corresponding standard layer based on the corresponding relation, and determining the checking and accepting result of each layer to be checked and accepted. The check and acceptance efficiency of the application program interface can be greatly improved because the patterns and the intervals of all the layers in the interface to be checked and the standard interface do not need to be manually measured, and the interface to be checked and accepted does not need to be manually compared with the interface corresponding to the design draft.
In a further embodiment of the present invention, there is also provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method steps of the acceptance method of the application program interface as described in any of the above embodiments.
It can be seen that in the scheme provided in the embodiment of the present invention, when a computer program product runs on a computer, attribute information of each layer to be checked and accepted in an interface to be checked and accepted and attribute information of each standard layer in a standard interface can be obtained, where the standard interface is an interface defined by a design draft corresponding to the interface to be checked and accepted, the attribute information includes a size, a position, a type, and a style, a corresponding relationship between each layer to be checked and each standard layer is determined based on the size, the position, and the type of each layer to be checked and accepted, a neighboring layer of each standard layer and a distance between each layer to be checked and each layer to, and aiming at each layer to be checked and accepted, respectively comparing the pattern and the interval of the layer to be checked and accepted with the pattern and the interval of the corresponding standard layer based on the corresponding relation, and determining the checking and accepting result of each layer to be checked and accepted. The check and acceptance efficiency of the application program interface can be greatly improved because the patterns and the intervals of all the layers in the interface to be checked and the standard interface do not need to be manually measured, and the interface to be checked and accepted does not need to be manually compared with the interface corresponding to the design draft.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be cached in a computer-readable cache medium or transmitted from one computer-readable cache medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable cache medium may be any available medium that can be accessed by a computer or a data caching device, such as a server, a data center, etc., that is integrated with one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the electronic device, the computer-readable storage medium, and the computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (13)

1. A method for acceptance of an application program interface, the method comprising:
acquiring attribute information of each layer to be checked and accepted in an interface to be checked and acquiring attribute information of each standard layer in a standard interface, wherein the standard interface is an interface defined by a design draft corresponding to the interface to be checked and accepted, and the attribute information comprises size, position, type and style;
determining the corresponding relation between each layer to be checked and each standard layer based on the size, the position and the type of each layer to be checked and accepted and the size, the position and the type of each standard layer;
determining adjacent layers of each standard layer and a space between each standard layer and the corresponding adjacent layer according to the size and the position of each standard layer;
determining adjacent layers of each layer to be checked and a space between each layer to be checked and the corresponding adjacent layers according to the corresponding relation and the size and the position of each layer to be checked;
and aiming at each layer to be checked and accepted, respectively comparing the pattern and the interval of the layer to be checked and accepted with the pattern and the interval of the corresponding standard layer based on the corresponding relation, and determining the checking and accepting result of each layer to be checked and accepted.
2. The method according to claim 1, wherein the step of determining the correspondence between each layer to be checked and each standard layer based on the size, position, and type of each layer to be checked and each standard layer comprises:
sequencing the layers to be checked according to the positions of the layers to be checked and accepted and a preset sequencing rule to obtain a sequencing result;
traversing each layer to be checked and accepted according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and accepted and each unmatched standard layer according to the types and the positions of each layer to be checked and accepted and each standard layer when one layer to be checked and accepted is traversed;
determining a standard layer matched with the currently traversed to-be-checked image layer based on the matching degree, recording the corresponding relation between the currently traversed to-be-checked image layer and the standard layer, and determining that the standard layer is matched;
and continuously traversing the next layer to be checked and accepted, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and accepted and each unmatched standard layer according to the types and the positions of the layers to be checked and accepted and the standard layers until all the layers to be checked and accepted are traversed, so as to obtain the corresponding relation between the layers to be checked and the standard layers.
3. The method of claim 2, wherein prior to the step of traversing the layers to be checked according to the sorting result, the method further comprises:
determining an adjacent layer of each standard layer according to the position of each standard layer;
the step of calculating the matching degree between the currently traversed to-be-checked image layer and each currently unmatched standard image layer according to the types and the positions of the to-be-checked image layers and the standard image layers comprises the following steps:
determining adjacent layers of the currently traversed layer to be checked according to the positions of the layers to be checked;
and respectively calculating the matching degree between the currently traversed layer to be checked and accepted and each currently unmatched standard layer based on the types of the currently traversed layer to be checked and the adjacent layer thereof and the types of each currently unmatched standard layer and the adjacent layer thereof.
4. The method according to claim 1, wherein the step of determining adjacent layers of each standard layer and a distance between each standard layer and the corresponding adjacent layer according to the size and the position of each standard layer comprises:
determining a layer row and/or a layer column to which each standard layer belongs according to the size and the position of each standard layer, and determining a layout relation of each standard layer in the standard interface based on the layer row and/or the layer column to which each standard layer belongs, wherein each standard layer in the layer rows has an intersection region with at least one other standard layer after being expanded in a transverse direction, and each standard layer in the layer column has an intersection region with at least one other standard layer after being expanded in a longitudinal direction;
and determining adjacent layers of each standard layer and the space between each standard layer and the corresponding adjacent layer according to the layout relation.
5. The method according to claim 4, wherein the step of determining the layer row and/or layer column to which each standard layer belongs according to the size and position of each standard layer, and determining the layout relationship of each standard layer in the standard interface based on the layer row and/or layer column to which each standard layer belongs includes:
determining the layer rows to which the standard layers belong according to the sizes and the positions of the standard layers;
traversing each undetermined layer row, calculating the distance between the currently traversed layer row and the determined layer row as well as the longitudinal boundary of the standard interface, and determining the layer row corresponding to the minimum distance as a target layer row;
traversing the target layer row, if the target layer row only comprises one standard layer, adding the identifier of the standard layer to a dependency relationship array, returning to each layer row which is not determined by the traversal, and calculating the distance between the currently traversed layer row and the determined layer row as well as the distance between the currently traversed layer row and the boundary of the standard interface until the traversal of all the layer rows is finished, wherein the dependency relationship array records the identifier of the standard layer included by the traversed layer row and is used for representing the layout relationship of each standard layer in the standard interface;
if the target layer row comprises a plurality of standard layers, determining a layer column to which each standard layer belongs according to the sizes and the positions of the plurality of standard layers;
traversing each undetermined graph layer column, calculating the distance between the currently traversed graph layer column and the determined graph layer column as well as the transverse boundary of the standard interface, and determining the graph layer column corresponding to the minimum distance as a target graph layer column;
traversing the target diagram layer column, if the target diagram layer column only comprises one standard layer, adding the identifier of the standard layer into the dependency relationship array, returning to each diagram layer column which is not determined by traversal, and calculating the distance between the currently traversed layer column and the determined layer column as well as the boundary of the standard interface until all the layer columns are traversed;
if the target layer column comprises a plurality of standard layers, returning to the step of determining the layer row to which each standard layer belongs according to the size and the position of each standard layer until all layer columns corresponding to the target layer row are traversed;
the step of determining the adjacent layer of each standard layer and the distance between each standard layer and the corresponding adjacent layer according to the layout relationship comprises:
sequentially traversing each identifier in the dependency relationship array, and determining the transverse and longitudinal distances between the standard layer corresponding to the currently traversed identifier and the determined layer when one identifier is traversed;
determining the layer with the smallest corresponding transverse and longitudinal distances as an adjacent layer of a standard layer corresponding to the currently traversed identifier, determining the smallest distance as the distance between the standard layer and the adjacent layer, and determining the standard layer as the determined layer;
and continuously traversing the next identifier, and returning to the step of determining the transverse and longitudinal distances between the standard layer corresponding to the currently traversed identifier and the determined layer until all identifiers are traversed.
6. The method according to claim 1, wherein the step of obtaining attribute information of each layer to be checked and accepted in the interface to be checked and obtaining attribute information of each standard layer in the standard interface comprises:
calling a preset view interface, and extracting attribute information of each layer to be checked and accepted in the interface to be checked and accepted;
analyzing each standard layer in the standard interface to obtain attribute information of each standard layer in the standard interface.
7. The method according to claim 1, wherein before the step of obtaining the attribute information of each layer to be checked and accepted in the interface to be checked and accepted, the method further comprises:
acquiring running condition parameters of an interface to be checked and received of an application program, and configuring a running environment based on the running condition parameters;
and starting the application program based on the running environment, and entering the interface to be checked.
8. The method according to any one of claims 1 to 6, wherein before the step of determining the correspondence between each layer to be checked and each standard layer based on the size, position and type of each layer to be checked and each standard layer, the method further comprises:
and performing layer processing on each to-be-checked image layer and each standard image layer by adopting at least one of the following modes:
determining a redundant layer according to the pattern and the size of each to-be-checked image layer and each standard image layer, and removing the redundant layer; or the like, or, alternatively,
aiming at an image layer to be checked and received and a standard image layer with the type of a text, adjusting the heights of the image layers with the same character size of the included characters to be the same; or the like, or, alternatively,
and combining a plurality of layers belonging to the same icon into one layer.
9. An apparatus for validating an application program interface, the apparatus comprising:
the attribute information acquisition module is used for acquiring attribute information of each layer to be checked in an interface to be checked and accepted and acquiring attribute information of each standard layer in a standard interface, wherein the standard interface is an interface defined by a design draft corresponding to the interface to be checked and accepted, and the attribute information comprises size, position, type and style;
the corresponding relation determining module is used for determining the corresponding relation between each layer to be checked and accepted and each standard layer based on the size, the position and the type of each layer to be checked and accepted and the size, the position and the type of each standard layer;
a first interval determining module, configured to determine, according to the size and the position of each standard layer, an adjacent layer of each standard layer and an interval between each standard layer and a corresponding adjacent layer;
the second distance determining module is used for determining adjacent layers of each layer to be checked and the distance between each layer to be checked and the corresponding adjacent layer according to the corresponding relation and the size and the position of each layer to be checked;
and the layer acceptance module is used for comparing the patterns and the intervals of the layers to be accepted with the patterns and the intervals of the corresponding standard layers respectively based on the corresponding relation aiming at each layer to be accepted, and determining the acceptance result of each layer to be accepted.
10. The apparatus of claim 9, wherein the correspondence determining module comprises:
the layer sequencing unit is used for sequencing the layers to be checked and accepted according to the positions of the layers to be checked and accepted and a preset sequencing rule to obtain a sequencing result;
the corresponding relation determining unit is used for traversing each layer to be checked and accepted according to the sorting result, and calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and the positions of each layer to be checked and accepted and each standard layer when one layer to be checked and accepted is traversed;
determining a standard layer matched with the currently traversed to-be-checked image layer based on the matching degree, recording the corresponding relation between the currently traversed to-be-checked image layer and the standard layer, and determining that the standard layer is matched;
and continuously traversing the next layer to be checked and accepted, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and accepted and each unmatched standard layer according to the types and the positions of the layers to be checked and accepted and the standard layers until all the layers to be checked and accepted are traversed, so as to obtain the corresponding relation between the layers to be checked and the standard layers.
11. The apparatus of claim 9, wherein the first spacing determination module comprises:
the layout relationship determining unit is configured to determine a layer row and/or a layer column to which each standard layer belongs according to the size and the position of each standard layer, and determine a layout relationship of each standard layer in the standard interface based on the layer row and/or the layer column to which each standard layer belongs, where each standard layer in the layer rows has an intersection region with at least one other standard layer after being expanded in a transverse direction, and each standard layer in the layer column has an intersection region with at least one other standard layer after being expanded in a longitudinal direction;
and the space determining unit is used for determining adjacent layers of each standard layer and the space between each standard layer and the corresponding adjacent layer according to the layout relation.
12. The apparatus of claim 11, wherein the layout relationship determination unit comprises:
the layer row dividing subunit is used for determining the layer rows to which the standard layers belong according to the sizes and the positions of the standard layers;
the target row determining subunit is configured to traverse each layer row that is not determined, calculate a distance between a currently traversed layer row and the determined layer row and a longitudinal boundary of the standard interface, and determine a layer row corresponding to the minimum distance as a target layer row;
a layer row traversal subunit, configured to traverse the target layer row, add an identifier of the standard layer to the dependency array if the target layer row only includes one standard layer, return to each layer row that is not determined by the traversal, and calculate a distance between a currently traversed layer row and a boundary between the determined layer row and the standard interface until all layer rows are traversed; if the target layer row comprises a plurality of standard layers, determining a layer column to which each standard layer belongs according to the sizes and positions of the plurality of standard layers, wherein the dependency relationship array records identifiers of the standard layers included in the traversed layer row and is used for representing the layout relationship of each standard layer in the standard interface;
the target column determining subunit is used for traversing each undetermined image layer column, calculating the distance between the currently traversed image layer column and the determined image layer column as well as the transverse boundary of the standard interface, and determining the image layer column corresponding to the minimum distance as a target image layer column;
a layer column traversal subunit, configured to traverse the target layer column, add, if the target layer column only includes one standard layer, an identifier of the standard layer to the dependency relationship array, return to each layer column that is not determined by the traversal, and calculate a distance between a currently traversed layer column and a boundary between the determined layer column and the standard interface until all layer columns are traversed; if the target layer column comprises a plurality of standard layers, returning to the step of determining the layer row to which each standard layer belongs according to the size and the position of each standard layer until all layer columns corresponding to the target layer row are traversed;
the pitch determination unit includes:
the identifier traversal subunit is used for sequentially traversing each identifier in the dependency relationship array, and determining the horizontal and vertical distances between the standard layer corresponding to the currently traversed identifier and the determined layer when one identifier is traversed; determining the layer with the smallest corresponding transverse and longitudinal distances as an adjacent layer of a standard layer corresponding to the currently traversed identifier, determining the smallest distance as the distance between the standard layer and the adjacent layer, and determining the standard layer as the determined layer; and continuously traversing the next identifier, and returning to the step of determining the transverse and longitudinal distances between the standard layer corresponding to the currently traversed identifier and the determined layer until all identifiers are traversed.
13. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 8 when executing a program stored in the memory.
CN202010760904.XA 2020-07-31 2020-07-31 Acceptance method and device of application program interface and electronic equipment Active CN111881049B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010760904.XA CN111881049B (en) 2020-07-31 2020-07-31 Acceptance method and device of application program interface and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010760904.XA CN111881049B (en) 2020-07-31 2020-07-31 Acceptance method and device of application program interface and electronic equipment

Publications (2)

Publication Number Publication Date
CN111881049A true CN111881049A (en) 2020-11-03
CN111881049B CN111881049B (en) 2024-03-08

Family

ID=73204954

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010760904.XA Active CN111881049B (en) 2020-07-31 2020-07-31 Acceptance method and device of application program interface and electronic equipment

Country Status (1)

Country Link
CN (1) CN111881049B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485707A (en) * 2021-07-26 2021-10-08 亿览在线网络技术(北京)有限公司 Method for automatically checking UI (user interface)
CN113778905A (en) * 2021-11-10 2021-12-10 腾讯科技(深圳)有限公司 UI design acceptance method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150095769A1 (en) * 2013-09-27 2015-04-02 Founder Apabi Technology Limited Layout Analysis Method And System
CN107015793A (en) * 2016-12-12 2017-08-04 阿里巴巴集团控股有限公司 Design original text adaptation method, apparatus and system
CN108763511A (en) * 2018-05-30 2018-11-06 腾讯科技(深圳)有限公司 Figure layer composition method, device, electronic equipment and storage medium in the page
CN111127543A (en) * 2019-12-23 2020-05-08 北京金山安全软件有限公司 Image processing method, image processing apparatus, electronic device, and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150095769A1 (en) * 2013-09-27 2015-04-02 Founder Apabi Technology Limited Layout Analysis Method And System
CN107015793A (en) * 2016-12-12 2017-08-04 阿里巴巴集团控股有限公司 Design original text adaptation method, apparatus and system
CN108763511A (en) * 2018-05-30 2018-11-06 腾讯科技(深圳)有限公司 Figure layer composition method, device, electronic equipment and storage medium in the page
CN111127543A (en) * 2019-12-23 2020-05-08 北京金山安全软件有限公司 Image processing method, image processing apparatus, electronic device, and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485707A (en) * 2021-07-26 2021-10-08 亿览在线网络技术(北京)有限公司 Method for automatically checking UI (user interface)
CN113485707B (en) * 2021-07-26 2024-06-28 亿览在线网络技术(北京)有限公司 Automatic checking method for UI (user interface)
CN113778905A (en) * 2021-11-10 2021-12-10 腾讯科技(深圳)有限公司 UI design acceptance method, device, equipment and storage medium
CN113778905B (en) * 2021-11-10 2022-02-08 腾讯科技(深圳)有限公司 UI design acceptance method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111881049B (en) 2024-03-08

Similar Documents

Publication Publication Date Title
CN109697414B (en) Text positioning method and device
CN111881049B (en) Acceptance method and device of application program interface and electronic equipment
CN109753641B (en) Method and device for changing object position, electronic equipment and storage medium
US20130194272A1 (en) Placing pixels according to attribute values in positions in a graphical visualization that correspond to geographic locations
CN104182962A (en) Picture definition evaluation method and device
CN109656652B (en) Webpage chart drawing method, device, computer equipment and storage medium
US10565560B2 (en) Alternative people charting for organizational charts
CN113420355B (en) Floor processing method and device and electronic equipment
CN110879780A (en) Page abnormity detection method and device, electronic equipment and readable storage medium
CN112307408A (en) Method and device for determining element information in page, electronic equipment and storage medium
CN111091572A (en) Image processing method and device, electronic equipment and storage medium
CN111857703B (en) Method and device for matching layers in interface and electronic equipment
CN108121648B (en) Interface error monitoring method
CN110442266B (en) Object recognition method, object recognition device, electronic equipment and storage medium
CN110908899A (en) Application program debugging method, mobile terminal and computer readable storage medium
CN111240622B (en) Drawing method and device
CN117056352A (en) Data display method, device, terminal equipment and readable storage medium
CN110688995B (en) Map query processing method, computer-readable storage medium and mobile terminal
CN115965646A (en) Region division method and device, computer equipment and computer readable storage medium
CN114998912A (en) Data extraction method and device, electronic equipment and storage medium
US20130094761A1 (en) Electronic device and method for creating measurement codes
CN110398681B (en) Double-strip-line inspection method and related device
CN111881050A (en) Method and device for clipping text layer and electronic equipment
CN114628011A (en) Human-computer interaction method of ultrasonic device, ultrasonic device and storage medium
CN112529923A (en) Control identification method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant