Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[swtbot-dev] Painting with GC tests

Hi,

I'm using SWTBot to test my SWT/JFace application.
I have a functionality to paint background of a tree item in different colors depending on notification I get 
from server. For each item I can get two types of notifications which both should be visible to user.
So I just paint Rectangles using GC in a different color and size behind TreeItem.
event.gc.setBackground(...);
event.gc.fillRectangle(...);
As a result I can have wide yellow line behind TreeItem and a bit narrower green one.

My current solution for tests is to find TreeItem with SWTBot copy his area to Image, pick Pixel
from ImageData and take RGB from Palette.
Is there any better solution ?

Also I recognised that yellow RGB I put in background when I fill rectangle is slightly different from the one I get in tests
from the image (but it still yellow though) 

Denis


Back to the top