Package com.opera.core.systems.preferences

Examples of com.opera.core.systems.preferences.OperaFilePreferences


    return destination;
  }

  @Test
  public void preferenceWithNoValueIsNull() throws IOException {
    OperaPreferences prefs = new OperaFilePreferences(
        resourceCopy(resources.locate("profile/opera_no_value_pref.ini")));

    assertNull(prefs.get("Test", "PrefWithNoValue").getValue());

  }
View Full Code Here


  }

  @Test
  public void preferenceWithValueIsRecognized() throws IOException {
    OperaPreferences prefs = new OperaFilePreferences(
        resourceCopy(resources.locate("profile/opera_no_value_pref.ini")));

    assertEquals(true, prefs.get("Test", "PrefWithValue").getValue());
  }
View Full Code Here

    assertEquals(true, prefs.get("Test", "PrefWithValue").getValue());
  }

  @Test
  public void preferenceWithBackslashIsRecognized() throws IOException {
    OperaPreferences prefs = new OperaFilePreferences(
        resourceCopy(resources.locate("profile/opera_backslashes.ini")));

    assertEquals("C:\\tmp\\user.css", prefs.get("Test", "Local CSS File").getValue());
  }
View Full Code Here

      Files.copy(resources.locate("profile/opera.ini"), iniFile);
    } catch (IOException e) {
      fail("Unable to copy preference fixture: " + e.getMessage());
    }

    preferences = new OperaFilePreferences(iniFile);
    profile = new OperaProfile(profileDirectory);
    prefCountBefore = preferences.size();
  }
View Full Code Here

    assertEquals(46, preferences.size());
  }

  @Test(expected = WebDriverException.class)
  public void testConstructionWithInvalidFile() {
    new OperaFilePreferences(new File("/path/does/not/exist"));
  }
View Full Code Here

  @Test
  public void testSetWithString() {
    preferences.set("Developer Tools", "Proxy Host", "1.2.3.4");

    OperaPreferences verifier = new OperaFilePreferences(iniFile);
    assertEquals("Developer Tools", verifier.get("Developer Tools", "Proxy Host").getSection());
    assertEquals("Proxy Host", verifier.get("Developer Tools", "Proxy Host").getKey());
    assertEquals("1.2.3.4", verifier.get("Developer Tools", "Proxy Host").getValue());
  }
View Full Code Here

  @Test
  public void testSetWithBoolean() {
    preferences.set("Developer Tools", "Proxy Auto Connect", true);

    OperaPreferences verifier = new OperaFilePreferences(iniFile);
    assertEquals("Developer Tools", verifier.get("Developer Tools", "Proxy Auto Connect")
        .getSection());
    assertEquals("Proxy Auto Connect", verifier.get("Developer Tools", "Proxy Auto Connect")
        .getKey());
    assertEquals(true, verifier.get("Developer Tools", "Proxy Auto Connect").getValue());
  }
View Full Code Here

  @Test
  public void testSetWithInteger() {
    preferences.set("Developer Tools", "Proxy Port", 1234);

    OperaPreferences verifier = new OperaFilePreferences(iniFile);
    assertEquals("Developer Tools", verifier.get("Developer Tools", "Proxy Port").getSection());
    assertEquals("Proxy Port", verifier.get("Developer Tools", "Proxy Port").getKey());
    assertEquals(1234, verifier.get("Developer Tools", "Proxy Port").getValue());
  }
View Full Code Here

  @Test
  public void testSetWithUnknownPreference() {
    preferences.set(new OperaGenericPreferences.GenericPreference("foo", "bar", "baz"));

    OperaPreferences verifier = new OperaFilePreferences(iniFile);
    assertNotSame(prefCountBefore, preferences.size());
    assertNotSame(prefCountBefore, verifier.size());

    assertEquals("foo", verifier.get("foo", "bar").getSection());
    assertEquals("bar", verifier.get("foo", "bar").getKey());
    assertEquals("baz", verifier.get("foo", "bar").getValue());
  }
View Full Code Here

  @Test
  public void testSetWithKnownPreference() {
    preferences.set(new OperaGenericPreferences.GenericPreference("Developer Tools", "Proxy Host",
                                                                  "1.2.3.4"));

    OperaPreferences verifier = new OperaFilePreferences(iniFile);
    assertEquals(prefCountBefore, verifier.size());
    assertEquals("Developer Tools", verifier.get("Developer Tools", "Proxy Host").getSection());
    assertEquals("Proxy Host", verifier.get("Developer Tools", "Proxy Host").getKey());
    assertEquals("1.2.3.4", verifier.get("Developer Tools", "Proxy Host").getValue());
  }
View Full Code Here

TOP

Related Classes of com.opera.core.systems.preferences.OperaFilePreferences

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.