[PATCH weston 09/10] tests: Add internal test for the weston test screenshot capability

Pekka Paalanen ppaalanen at gmail.com
Tue May 12 01:53:58 PDT 2015


On Mon, 11 May 2015 15:24:28 +0300
Pekka Paalanen <ppaalanen at gmail.com> wrote:

> On Wed,  6 May 2015 17:44:28 -0700
> Bryce Harrington <bryce at osg.samsung.com> wrote:
> 
> > This also serves as a proof of concept of the screen capture
> > functionality and as a demo for snapshot-based rendering verification.
> > Implements screenshot saving clientside in the test itself.
> > 
> > This also demonstrates use of test-specific configuration files, in this
> > case to disable fadein animations and background images.
> > 
> > Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
> > ---
> >  Makefile.am                                |  19 +++-
> >  tests/internal-screenshot-test.c           | 151 +++++++++++++++++++++++++++++
> >  tests/internal-screenshot.ini              |   3 +
> >  tests/reference/internal-screenshot-00.png | Bin 0 -> 5149 bytes
> >  4 files changed, 172 insertions(+), 1 deletion(-)
> >  create mode 100644 tests/internal-screenshot-test.c
> >  create mode 100644 tests/internal-screenshot.ini
> >  create mode 100644 tests/reference/internal-screenshot-00.png

> > +char *server_parameters="--use-pixman --width=320 --height=240";
> > +
> > +TEST(internal_screenshot)
> > +{
> > +	struct client *client;
> > +	struct surface *screenshot = NULL;
> > +	struct rectangle clip;
> > +	const char *fname;
> > +	cairo_surface_t *reference;
> > +	cairo_status_t status;
> > +	bool match = false;
> > +	bool dump_all_images = true;
> > +
> > +	printf("Starting test\n");
> > +
> > +	/* Create the client */
> > +	client = create_client_and_test_surface(100, 100, 100, 100);
> > +	assert(client);
> > +	printf("Client created\n");
> > +
> > +	/* Create a surface to hold the screenshot */
> > +	screenshot = xzalloc(sizeof *screenshot);
> 
> I think you are leaking this. Could be allocated from stack just as
> well.
> 
> > +	assert(screenshot);
> > +	screenshot->wl_surface = wl_compositor_create_surface(client->wl_compositor);
> > +	assert(screenshot->wl_surface);
> > +	printf("Screenshot surface created\n");

Oh, and this wl_surface is not needed for anything. Right?
It's also leaked from what I can tell.


Thanks,
pq


More information about the wayland-devel mailing list