Package com.eclipsesource.tabris.device

Examples of com.eclipsesource.tabris.device.ClientDevice


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

    ClientDevice device = client.getService( ClientDevice.class );

    assertNotNull( device );
  }
View Full Code Here


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

    ClientDevice device = client.getService( ClientDevice.class );

    assertSame( device, client.getService( ClientDevice.class ) );
  }
View Full Code Here

    when( app.getVersion() ).thenReturn( "appVersion" );
    when( client.getService( App.class ) ).thenReturn( app );
  }

  private void mockDevice( Client client ) {
    ClientDevice device = mock( ClientDevice.class );
    when( device.getLocale() ).thenReturn( Locale.CANADA );
    when( device.getModel() ).thenReturn( "model" );
    when( device.getOSVersion() ).thenReturn( "osVersion" );
    when( device.getPlatform() ).thenReturn( Platform.ANDROID );
    when( device.getVendor() ).thenReturn( "vendor" );
    doReturn( Integer.valueOf( 23 ) ).when( device ).getTimezoneOffset();
    doReturn( Float.valueOf( 23F ) ).when( device ).getScaleFactor();
    when( client.getService( ClientDevice.class ) ).thenReturn( device );
  }
View Full Code Here

  @Test
  public void testGetPlatformIsAndroid() {
    TabrisRequest request = environment.getRequest();
    request.setHeader( Constants.USER_AGENT, "com.eclipsesource.tabris.android" );
    ClientDevice device = new ClientDeviceImpl();

    Platform platform = device.getPlatform();

    assertSame( Platform.ANDROID, platform );
  }
View Full Code Here

  @Test
  public void testGetPlatformIsIOS() {
    TabrisRequest request = environment.getRequest();
    request.setHeader( Constants.USER_AGENT, "com.eclipsesource.tabris.ios" );
    ClientDevice device = new ClientDeviceImpl();

    Platform platform = device.getPlatform();

    assertSame( Platform.IOS, platform );
  }
View Full Code Here

  @Test
  public void testGetPlatformIsSWT() {
    TabrisRequest request = environment.getRequest();
    request.setHeader( Constants.USER_AGENT, "com.eclipsesource.tabris.swt" );
    ClientDevice device = new ClientDeviceImpl();

    Platform platform = device.getPlatform();

    assertSame( Platform.SWT, platform );
  }
View Full Code Here

  @Test
  public void testGetPlatformIsWebByDefault() {
    TabrisRequest request = environment.getRequest();
    request.setHeader( Constants.USER_AGENT, "Mozilla/bla" );
    ClientDevice device = new ClientDeviceImpl();

    Platform platform = device.getPlatform();

    assertSame( Platform.WEB, platform );
  }
View Full Code Here

    assertTrue( deviceImpl.hasCapability( Capability.PHONE ) );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testAddListenerFailsWithNull() {
    ClientDevice device = new ClientDeviceImpl();

    device.addClientDeviceListener( null );
  }
View Full Code Here

    device.addClientDeviceListener( null );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testRemoveListenerFailsWithNull() {
    ClientDevice device = new ClientDeviceImpl();

    device.removeClientDeviceListener( null );
  }
View Full Code Here

  private void createContentArea( Composite parent, Mail mail ) {
    final Composite composite = new Composite( parent, SWT.NONE );
    GridLayout layout = ExampleUtil.createGridLayout();
    composite.setLayout( layout );
    ClientDevice clientDevice = RWT.getClient().getService( ClientDevice.class );
    if( clientDevice.getPlatform() != Platform.ANDROID ) {
      createCloseButtonToolbar( composite );
    }
    createMailHeaderArea( composite, mail );
    createMailContentArea( composite, mail );
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.device.ClientDevice

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.