Package com.eclipsesource.tabris.print

Examples of com.eclipsesource.tabris.print.Printer


  @Test
  public void testHasPrintService() {
    TabrisClient client = new TabrisClientImpl();

    Printer print = client.getService( Printer.class );

    assertNotNull( print );
  }
View Full Code Here


  @Test
  public void testPrintServiceIsSingleton() {
    TabrisClient client = new TabrisClientImpl();

    Printer print1 = client.getService( Printer.class );
    Printer print2 = client.getService( Printer.class );

    assertSame( print1, print2 );
  }
View Full Code Here

  }

  @Test
  public void testSendsPrintWithPrintCall() {
    RemoteObject remoteObject = environment.getServiceObject();
    Printer print = new PrinterImpl();

    print.print( "http://localhost/file.pdf", createOptions() );

    ArgumentCaptor<JsonObject> captor = ArgumentCaptor.forClass( JsonObject.class );
    verify( remoteObject ).call( eq( "print" ), captor.capture() );
    assertEquals( "http://localhost/file.pdf", captor.getValue().get( "url" ).asString() );
    assertEquals( "A Printer ID", captor.getValue().get( "printer" ).asString() );
View Full Code Here

    assertEquals( "color", captor.getValue().get( "outputType" ).asString() );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testPrintFailsWithNullOptions() {
    Printer print = new PrinterImpl();

    print.print( "foo", null );
  }
View Full Code Here

    print.print( "foo", null );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testPrintFailsWithNullUrl() {
    Printer print = new PrinterImpl();

    print.print( null, new PrintOptions() );
  }
View Full Code Here

    print.print( null, new PrintOptions() );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testPrintFailsWithEmptyUrl() {
    Printer print = new PrinterImpl();

    print.print( "", new PrintOptions() );
  }
View Full Code Here

    print.print( "", new PrintOptions() );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testAddListenerFailsWithNullListener() {
    Printer print = new PrinterImpl();

    print.addPrintListener( null );
  }
View Full Code Here

    print.addPrintListener( null );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testRemoveListenerFailsWithNullListener() {
    Printer print= new PrinterImpl();

    print.removePrintListener( null );
  }
View Full Code Here

    printAction.setText( "Print" );
    printAction.setEnabled( false );
    printAction.addSelectionListener( new SelectionAdapter() {
      @Override
      public void widgetSelected( SelectionEvent e ) {
        Printer printer = RWT.getClient().getService( Printer.class );
        if( printer != null ) {
          Image image = imageLabel.getImage();
          String url = swtImageAsPNGResourceURL( image );
          printer.print( url, new PrintOptions() );
        }
      }
    } );
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.print.Printer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.