Label::click() does not generate a mouseUp() call


I want to generate a click() on a Label component programmatically, for UI testing. Apart from the fact that I should not be doing this for UI testing and I should be recording the data instead which at the moment I cannot as we do not have a clean MVC implementation yet, is there any reason why generating a fake click this way fails to call mouseUp()

The alternative seems to be, to convert the Label center Point to global co-ordinates(screen co-ordinates?) using Component::localPointToGlobal() and generate a Windows Message using Windows APIs. But I would rather stay platform agnostic with Juce.

Currently this seems to do the trick if the Component is visible:

INPUT input;
input.type = INPUT_MOUSE;
input.mi.mouseData = 0;
input.mi.time = 0;
input.mi.dx = x*(65536 / GetSystemMetrics(SM_CXSCREEN)); //x being coord in pixels
input.mi.dy = y*(65536 / GetSystemMetrics(SM_CYSCREEN)); //y being coord in pixels

SendInput(1, &input, sizeof(input));

SendInput(1, &input, sizeof(input));

SendInput(1, &input, sizeof(input));


If the component has been already scrolled away such that its not visible currently then there is a mis-click.

Is there any way to force a Component to become visible? For example if its a Label at the top of a ViewPort and the ViewPort has been scrolled too much such that the Label is not currently visible.
Then calling something like Label::makeVisible() scrolls the ViewPort to make the label visible?