Bug 534817 - screenshots do not change
Summary: screenshots do not change
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.8   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.8   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression, triaged
Depends on:
Blocks: 535123
  Show dependency tree
 
Reported: 2018-05-17 09:36 EDT by Vaclav Kadlcik CLA
Modified: 2018-06-13 07:19 EDT (History)
9 users (show)

See Also:
daniel_megert: pmc_approved+
akurtakov: review+
niraj.modi: review+


Attachments
Reproducing project (1.35 KB, application/gzip)
2018-05-17 09:36 EDT, Vaclav Kadlcik CLA
no flags Details
screenshots after the fix (1.14 MB, application/zip)
2018-05-21 05:25 EDT, Sravan Kumar Lakkimsetti CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vaclav Kadlcik CLA 2018-05-17 09:36:19 EDT
Created attachment 274084 [details]
Reproducing project

Something changed between Platform builds 4.8M6 and 4.8M7 that
broke taking screenshots in SWTBot tests. Specifically, all
screenshots are the same (binary copies) as the first one taken.
It looks like org.eclipse.swt.graphics.GC.copyArea(...) works
OK just on a first call but then produces the same content
(maybe cached?) no matter what's happening on the screen.

I can reproduce it on Fedora 27 and Red Hat Enterprise Linux
7.5 (x86_64) with platform builds 4.8M7 and I20180516-2000.

How to reproduce:

 1. Unpack eclipse-platform-4.8M7-linux-gtk-x86_64.tar.gz

 2. Install SWTBot and PDE:

    ./eclipse/eclipse -noSplash \
      -application org.eclipse.equinox.p2.director \
      -repository http://download.eclipse.org/releases/photon,http://download.eclipse.org/eclipse/updates/4.8,http://download.eclipse.org/technology/swtbot/snapshots \
      -i org.eclipse.swtbot.feature.group,org.eclipse.swtbot.eclipse.feature.group,org.eclipse.swtbot.eclipse.test.junit.feature.group,org.eclipse.swtbot.generator.feature.feature.group,org.eclipse.swtbot.ide.feature.group,org.eclipse.pde.feature.group

 3. Run Eclipse: ./eclipse/eclipse &

 4. Create a SWTBot project (SWTBot Test Plug-in) that makes
    a few changes on the screen and takes a few screenshots.
    (I'm attaching such a project.)

 5. Run the project as a SWTBot Test

 6. Look at the produced screenshot files - they are binary
    identical
Comment 1 Andrey Loskutov CLA 2018-05-17 10:07:24 EDT
Can you please add -vmargs -Dorg.eclipse.swt.internal.gtk.cairoContextReuse=false to your Eclipse with SWTBot and check if this fixes the problem?

Also can you please point to the code which is creating screenshots?

See bug 531667.
Comment 2 Vaclav Kadlcik CLA 2018-05-17 10:37:52 EDT
(In reply to Andrey Loskutov from comment #1)

Thanks for your reply!

> Can you please add -vmargs
> -Dorg.eclipse.swt.internal.gtk.cairoContextReuse=false to your Eclipse with
> SWTBot and check if this fixes the problem?

No, this does not help...

> 
> Also can you please point to the code which is creating screenshots?

The reproducer I attached calls SWTBot's SWTUtils.captureScreenshot()
which is effectively implemented by captureScreenshotInternal()
here:

http://git.eclipse.org/c/swtbot/org.eclipse.swtbot.git/tree/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/SWTUtils.java#n444
Comment 3 Eric Williams CLA 2018-05-18 10:52:06 EDT
I'll investigate this for RC2.
Comment 4 Eric Williams CLA 2018-05-18 15:24:34 EDT
The commit that introduced this bug is: https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=6a595ca4d2accb36c336a08183008671ad23a9f3
Comment 5 Sravan Kumar Lakkimsetti CLA 2018-05-21 03:05:18 EDT
(In reply to Eric Williams from comment #4)
> The commit that introduced this bug is:
> https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=6a595ca4d2accb36c336a08183008671ad23a9f3

There is another way to fix the original issue. I will create a patch by EOD today can you please test it? 

Also one question I have is how does SWTBot works with Wayland and GTK3?
Comment 6 Eclipse Genie CLA 2018-05-21 04:25:30 EDT
New Gerrit change created: https://git.eclipse.org/r/123018
Comment 7 Sravan Kumar Lakkimsetti CLA 2018-05-21 04:31:20 EDT
(In reply to Eclipse Genie from comment #6)
> New Gerrit change created: https://git.eclipse.org/r/123018

Alex and Eric,

Can you please review this patch?
Comment 8 Sravan Kumar Lakkimsetti CLA 2018-05-21 05:25:33 EDT
Created attachment 274112 [details]
screenshots after the fix

Here is the zip file containing the screen shots I got with the attached fix
Comment 10 Sravan Kumar Lakkimsetti CLA 2018-05-21 07:50:40 EDT
(In reply to Eclipse Genie from comment #9)
> Gerrit change https://git.eclipse.org/r/123018 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=809b38a9c2e5537b4a532a4680f7fc06d8c7dbb2

Merged to master
Comment 11 Vaclav Kadlcik CLA 2018-05-22 02:24:11 EDT
eclipse-platform-I20180521-2000-linux-gtk-x86_64 works for me,
thank you guys for fixing this!
Comment 12 Eric Williams CLA 2018-05-22 09:54:05 EDT
(In reply to Sravan Kumar Lakkimsetti from comment #5)
> Also one question I have is how does SWTBot works with Wayland and GTK3?

The screenshot functionality is totally non-working, as Wayland doesn't allow other applications to access each other's pixels/buffer. So this issue is X11 specific.
Comment 13 Sravan Kumar Lakkimsetti CLA 2018-05-24 05:35:02 EDT
Based on Comment 11 Marking this as verified
Comment 14 Eclipse Genie CLA 2018-06-07 16:24:01 EDT
New Gerrit change created: https://git.eclipse.org/r/124221
Comment 15 Eclipse Genie CLA 2018-06-07 16:24:25 EDT
New Gerrit change created: https://git.eclipse.org/r/124222
Comment 18 Sravan Kumar Lakkimsetti CLA 2018-06-08 02:01:26 EDT
Reverted this fix to identify a better solution for black bands problem
Comment 19 Dani Megert CLA 2018-06-08 05:57:23 EDT
(In reply to Sravan Kumar Lakkimsetti from comment #18)
> Reverted this fix to identify a better solution for black bands problem

We will try to find a fix after RC4.
Comment 20 Sravan Kumar Lakkimsetti CLA 2018-06-08 07:17:08 EDT
Created a new patch fixing this bug and 535123. Please verify this patch works

https://git.eclipse.org/r/124241
Comment 21 Sravan Kumar Lakkimsetti CLA 2018-06-11 04:25:35 EDT
Merged to R4_8_maintenance with 
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=d34b12b98ea8c4e4cb1f2b84b13801e4db914e55
Comment 22 Vaclav Kadlcik CLA 2018-06-13 07:19:28 EDT
Checked in S-4.8RC4a-201806110500, works for me.