[OpenLayers-Dev] Testing
Michael Ryan
mr at mry4n.net
Thu May 23 10:33:00 PDT 2013
Thanks for all the help, Andreas.
I'm pretty sure I can figure the contrib stuff out.
At the moment, I'm hitting a wall with why a very simple test works if I just run the featureclick.html page, but not when I run the test function:
https://github.com/m1k3ry4n/openlayers/blob/master/tests/Events/featureclick.html
When I run the html page the logevt array has length 2. In the test, it's length 0. Yet I'm running the exact same code.
I know this is taking a while and I may be missing the 2.13 deadline, but I'll keep plugging away at this til I get it right.
-Mike
On May 22, 2013, at 10:02 PM, Andreas Hocevar <ahocevar at opengeo.org> wrote:
> Hey Michael,
>
> you should find all information on how to submit code here: http://trac.osgeo.org/openlayers/wiki/HowToContribute. You will want to create a pull request, as explained here: http://trac.osgeo.org/openlayers/wiki/CreatingPatches.
>
> I hope this helps.
>
> Andreas.
>
>
> On Wed, May 22, 2013 at 9:34 AM, Michael Ryan <mr at mry4n.net> wrote:
> Thank you Andreas for clearing up that I should assign events like so:
>
> events = map.events
>
> The other part of this is that you have specify that the event you are triggering is a left-click.
>
> By tracing the code you see that you need to set the "which" attribute to 1 in the object passed to triggerEvent(), otherwise onClick in featureclick.js ignores the event.
>
> So, this is what my code should have looked like:
>
> events = map.events;
> events.triggerEvent( 'mousedown', {xy: new OpenLayers.Pixel(0,0), which: 1}, map);
> events.triggerEvent('mouseup', {xy: new OpenLayers.Pixel(0,0), which: 1}, map);
>
> I'm assuming I can get tests written today. Although, I'm not exactly clear how to submit them. If anyone wants to clue me in to that procedure I'd appreciate it.
>
> -Mike
>
> On May 21, 2013, at 5:21 PM, Michael Ryan <mr at mry4n.net> wrote:
>
>> While I've understood I need to use trigger() somehow, I have been unsuccessful in implementing it.
>>
>> I was using test for buttonclick as a reference: https://github.com/openlayers/openlayers/blob/master/tests/Events/buttonclick.html
>>
>> I would have assumed that within the context of the featurclick example
>> https://github.com/openlayers/openlayers/pull/174/files
>>
>> I could have used something like
>>
>> events = OpenLayers.Events(map, document.getElementById("map"));
>> events.triggerEvent({type: 'mousedown', xy: new OpenLayers.Pixel(0,0)}, map);
>> events.triggerEvent({type: 'mouseup', xy: new OpenLayers.Pixel(0,0)}, map);
>>
>> But, apparently, that's wrong.
>>
>> Am I trying to do something that isn't possible? I'm assuming I'm just implementing it wrong. Any thoughts?
>>
>> -Mike
>>
>> On May 20, 2013, at 5:04 PM, Michael Ryan <mr at mry4n.net> wrote:
>>
>>> I'll answer my question about triggering a buttonclick by saying, it looks like you use trigger() which takes coordinates as an argument as in this test: https://github.com/drewwells/openlayers/blob/master/tests/Control/Measure.html
>>
>
>
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>
>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20130523/0a427d24/attachment.html>
More information about the Dev
mailing list