Package limelight.os.win32

Source Code of limelight.os.win32.Win32OSTest

//- Copyright © 2008-2011 8th Light, Inc. All Rights Reserved.
//- Limelight and all included source files are distributed under terms of the MIT License.

package limelight.os.win32;

import junit.framework.TestCase;
import limelight.model.api.MockStudio;
import limelight.Context;
import limelight.util.StringUtil;
import limelight.os.MockRuntimeExecution;

public class Win32OSTest extends TestCase
{
  private Win32OS os;

  public void setUp() throws Exception
  {
    os = new Win32OS();
  }

  public void testDataRootDir() throws Exception
  {
    assertEquals(System.getProperty("user.home") + "\\Application Data\\Limelight", os.dataRoot());
  }

  public void testConfigureSystemProperties() throws Exception
  {
    System.setProperty("jruby.shell", "blah");
    System.setProperty("jruby.script", "blah");

    os.configureSystemProperties();

    assertEquals("cmd.exe", System.getProperty("jruby.shell"));
    assertEquals("jruby.bat org.jruby.Main", System.getProperty("jruby.script"));
  }

  public void testOpenProduction() throws Exception
  {
    MockStudio studio = new MockStudio();
    Context.instance().studio = studio;

    os.openProduction("blah");

    assertEquals("blah", studio.openedProduction);
  }

  public void testOpenURL() throws Exception
  {
    MockRuntimeExecution mockSystemExecution = new MockRuntimeExecution();
    os.setRuntime(mockSystemExecution);

    os.launch("http://www.google.com");

    assertEquals("cmd.exe /C start http://www.google.com", StringUtil.join(mockSystemExecution.command, " "));
  }
}
TOP

Related Classes of limelight.os.win32.Win32OSTest

TOP
Copyright © 2018 www.massapi.com. 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.