Stuck attempting to run/develop a manual unit test
Craig Cavanaugh
craig.cavanaugh at gmail.com
Sat Apr 4 00:05:15 UTC 2020
Jeanette,
Thank you! Much appreciated and a much better approach than a manual test.
Well on my way now!
Thanks,
Craig
On Fri, Apr 3, 2020 at 7:48 AM Jeanette Winzenburg <fastegal at swingempire.de>
wrote:
>
> Hi Craig,
>
> no manual test needed - you can implement a normal (unit) test with
> the help or VirtualFlowTestUtils: grab the flow, get its first/last
> visible cell and check whether their range includes to cell we want to
> see, something like:
>
> @Test
> public void testScrollInSkin() {
> int index = 50;
> comboBox.getSelectionModel().select(index);
> comboBox.show();
> VirtualFlow<IndexedCell<?>> virtualFlow = getFlow();
> int first = virtualFlow.getFirstVisibleCell().getIndex();
> int last = virtualFlow.getLastVisibleCell().getIndex();
> assertTrue(" visible range [" + first + ", " + last + "] must
> include " + index,
> first <= index && index <= last);
> }
>
> protected VirtualFlow<IndexedCell<?>> getFlow() {
> VirtualFlow<IndexedCell<?>> virtualFlow =
> (VirtualFlow<IndexedCell<?>>)
> VirtualFlowTestUtils.getVirtualFlow(comboBox);
> return virtualFlow;
> }
>
> Have a look at the tests in test.xx.controls to understand how to
> setup the test context. And have fun :)
>
> Zitat von Craig Cavanaugh <craig.cavanaugh at gmail.com>:
>
> > I am trying to create a manual unit test for RFR: 8129123 and I'm using
> the
> > existing ButtonMnemonicPositionTest.java as a template to make sure
> > everything is working correctly.
> >
> > I'm using an Ubuntu 18.04.4 build environment using the default 11.0.6
> > openjdk.
> > openjfx is successfully compiling and passing tests following the wiki
> > instructions
> >
> > I'm able to compile ButtonMnemonicPositionTest successfully as shown
> below.
> > javac -classpath .:/home/craig/IdeaProjects/jfx/build/sdk/lib/*
> > ButtonMnemonicPositionTest.java
> >
> > But attempts to run are failing despite a successful compile:
> > java -classpath .:/home/craig/IdeaProjects/jfx/build/sdk/lib/*
> > ButtonMnemonicPositionTest
> > Error: JavaFX runtime components are missing, and are required to run
> this
> > application
> >
> > I've also tried running using the modular-sdk after a Gradle build and no
> > luck either after finding a recommendation on the list that the module
> > approach should be used for testing.
> >
> > java --module-path /home/craig/IdeaProjects/jfx/build/modular-sdk/modules
> > --add-modules=javafx.controls ButtonMnemonicPositionTest
> > Error occurred during initialization of boot layer
> > java.lang.module.FindException: Module javafx.controls not found
> >
> > I've been search through the list archive and haven't found a solution.
> > I'm sure I'm doing something wrong.
> >
> > Some help please!
> >
> > Regards,
> > Craig
>
>
>
>
More information about the openjfx-dev
mailing list