Java Code Examples for org.pentaho.di.ui.spoon.trans.TransGraph#doRightClickSelection()

The following examples show how to use org.pentaho.di.ui.spoon.trans.TransGraph#doRightClickSelection() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GraphTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Test
public void testRightClickStepSelection() {
  TransGraph graph = mock( TransGraph.class );

  StepMeta meta1 = mock( StepMeta.class );
  StepMeta meta2 = mock( StepMeta.class );
  StepMeta meta3 = mock( StepMeta.class );
  wireSelected( meta1, meta2, meta3 );

  List<StepMeta> selected = new ArrayList<>( 2 );
  meta2.setSelected( true );
  meta3.setSelected( true );
  selected.add( meta2 );
  selected.add( meta3 );

  doCallRealMethod().when( graph ).doRightClickSelection( meta1, selected );
  graph.doRightClickSelection( meta1, selected );

  assertTrue( meta1.isSelected() );
  assertEquals( meta1, selected.get( 0 ) );
  assertEquals( 1, selected.size() );
  assertFalse( meta2.isSelected() || meta3.isSelected() );
}
 
Example 2
Source File: GraphTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Test
public void testRightClickAlreadySelected() {
  TransGraph graph = mock( TransGraph.class );
  StepMeta meta1 = mock( StepMeta.class );
  StepMeta meta2 = mock( StepMeta.class );
  wireSelected( meta1, meta2 );
  List<StepMeta> selected = new ArrayList<>( 2 );
  meta1.setSelected( true );
  meta2.setSelected( true );
  selected.add( meta1 );
  selected.add( meta2 );

  doCallRealMethod().when( graph ).doRightClickSelection( meta1, selected );
  graph.doRightClickSelection( meta1, selected );

  assertEquals( 2, selected.size() );
  assertTrue( selected.contains( meta1 ) );
  assertTrue( selected.contains( meta2 ) );
  assertTrue( meta1.isSelected() && meta2.isSelected() );
}
 
Example 3
Source File: GraphTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void testRightClickNoSelection() {
  TransGraph graph = mock( TransGraph.class );
  StepMeta meta1 = mock( StepMeta.class );
  wireSelected( meta1 );
  List<StepMeta> selected = new ArrayList<>();

  doCallRealMethod().when( graph ).doRightClickSelection( meta1, selected );
  graph.doRightClickSelection( meta1, selected );

  assertEquals( 1, selected.size() );
  assertTrue( selected.contains( meta1 ) );
  assertTrue( meta1.isSelected() );
}