📜 ⬆️ ⬇️

We will help the person to compare pictures, or about Testing Localization of the application

Good day, ladies and gentlemen!

It will be about testing, more precisely, even about localization testing.
Although in general it can be applied to the task of facilitating the search for the difference in two images.


')


I finally decided to show people one of my ideas, there is a chance that someone could come in handy.

The task:
There is an application, its desktop interface is translated into many languages, you need to check that everything is translated, in all languages.
Already alarming, how can I check the correctness of localization without knowing the language?
(According to the conditions of reality - we cannot extort texts from the controls, i.e. it is impossible to verify that the necessary text is in the right control, and this is not correct, but what if there is a rake with fonts, or it does not fit onto the screen)

To simplify life, we make a script that receives screenshots of the application with all possible texts, in all languages ​​(in our case, under 200 screenshots per application).

At its output we have a folder with the name of the language and a bunch of screenshots.
Now we need to analyze.
In theory, it is expected that a person will look through this whole pile, and looking at strange inscriptions in a foreign language, will he evaluate everything is in order ...
This is a reality, but we will try to make the life of such a person easier.

Idea
There is one language quite familiar to a person in the language set, usually english, and usually the person knows the application in that language quite well.
Let's “compare” a known language with an “unknown”, then it is easier to understand what is expected in the picture.
So in the simplest case - we house in the “unknown” language - known
eg

There were screenshots
001-danish.png
002-danish.png
etc

We mix english
We get something like
001-danish.png
001-english.png
002-danish.png
002-english.png

Now a person can consistently compare pictures, and if necessary switching between them, “compare” while knowing the context - it is easier to understand that something is wrong.

In general, it is already easier.

idea development
There is still a trifle, it would be nice to see that you forgot to translate something, i.e. the text remains deflotny, usually it is english.
Just sticking between the languages ​​you can and miss.

But then the second idea was born, and let's help the person, let's highlight different areas in the picture. a person knows where to look, and catches the eye that they did not transfer.

What it looks like.




And here you can see that there is no translation from Album Artist, Composer and Discnumber


This “beauty” is done with the help of imagemagic
only using composite functions.

Here is the ruby ​​+ rmagic function script

def CompareImage_v2(file1,file2,outname1,outname2) f1 = Magick::Image.read(file1).first f2 = Magick::Image.read(file2).first difference = f1.composite(f2, Magick::CenterGravity, Magick::DifferenceCompositeOp) # Make a blurry copy. blurry = difference.blur_image(0.0,4.5) mask = blurry.threshold(Magick::QuantumRange*0.02) mask2 = mask.edge(1) mask2 = mask2.level_colors("black", "red", true) # change blob color result=f1.composite(mask, Magick::CenterGravity, Magick::DifferenceCompositeOp) result=result.composite(mask2, Magick::CenterGravity, Magick::DifferenceCompositeOp) result.write(outname1) { self.quality = $image_quality } result=f2.composite(mask, Magick::CenterGravity, Magick::DifferenceCompositeOp) result=result.composite(mask2, Magick::CenterGravity, Magick::DifferenceCompositeOp) result.write(outname2) { self.quality = $image_quality } GC.start #memory leak fix end 


In theory, it can be done on a pure console imagemagic - IMHO ruby ​​version suits me more than;)

Far from perfect
He solves a SPECIFIC task
The essential limitation is that the windows should be the same in all languages, the positions of everything in the window should be preserved, and only the text should differ.

Full script can be viewed
in $ in_folde are in folders like eng, fre, ger screenshots, output to $ out_folder.

Checking the cropping of the ends of the lines is also on the person’s conscience, but usually there is always a “.” At the end of the line, and as a last resort you can enter “fakelanguage” to search for such things.

Waiting for your moments and your ways to solve this problem.
ps If necessary, you can write a post how to put rmagic under Windows ...

Sincerely, Sergey Erokhin, Kharkov.

Source: https://habr.com/ru/post/140971/


All Articles