The reason I posted this question was because I have some complex
scaling interactions:

- a background star field composed of opengl points; the individual
points should always stay in the same relative window position, and
not grow or shrink
- a foreground star field composed of sprites and labels; zoom/pan/
window re-size operations for the foreground star field which only
changes the *positions* of stars/labels relative to all the *other*
foregrounds stars/labels
- zoom/pan/window resize operations for the foreground star field
should *not* affect the sizes of any of the stars or labels, eg they
are sized the same across *all* zoom levels
- a HUD which stays constant across all zoom levels, with the
exception that some HUD elements are anchored to window positions
(think "bottom left portion of window") and thus need to move when the
window re-sizes

I have this all working, but it is "delicate". I've made changes in
the past which introduce errors but are not immediately visible
without manually testing all permutations of options. For instance,
zoom/pan work correctly, but upon window resize I might notice that
the star sprites and labels incorrectly re-size.

So ideally I'd have a unit test ("functional test", or "acceptance
test" as per Jonathan Hartley's comment?) to exercise zoom, pan, and
window re-size. Doing these tests manually would quickly get tedious.

On Apr 1, 12:32 pm, Casey Duncan <[email protected]> wrote:
> Yes, although I'm not sure what you mean exactly by "graphics
> elements". Typically I try to divide duties so that I can test things
> like positioning separately from the drawing itself.
>
> Testing the positioning is just standard unit testing then (they're
> just objects with attributes like anything else). Testing the drawing
> just involves passing in a minimal "mock" gl (as in pyglet.gl) and
> then asserting that the correct drawing commands were executed. I
> don't typically do this for specific games, but really just for game
> engine type stuff which is highly generalized.
>
> Also why would resizing the window change an elements coordinates? I
> would think resizing the window would just change the projection or
> the viewport size. But maybe I'm missing something.
>
> -CaseyOn Fri, Apr 1, 2011 at 7:40 AM, greenmoss <[email protected]> wrote:
> > All,
>
> > Does anyone here use unit tests for your graphics elements? For
> > example, I would like to test "resize the window, and ensure that
> > element foo has coordinates x,y". Is this possible?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "pyglet-users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/pyglet-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to