Package com.opera.core.systems.preferences

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


  @Test
  public void testMerge() {
    int prefCountBefore = preferences.size();

    OperaPreferences newPrefs = new OperaGenericPreferences();
    newPrefs.set("Developer Tools", "Proxy Host", "1.2.3.4");
    newPrefs.set("Developer Tools", "Proxy Port", 1234);
    newPrefs.set("Developer Tools", "Proxy Auto Connect", true);

    preferences.merge(newPrefs);

    assertEquals("1.2.3.4", preferences.get("Developer Tools", "Proxy Host").getValue());
    assertEquals(1234, preferences.get("Developer Tools", "Proxy Port").getValue());
View Full Code Here


    assertEquals("BAZ", preferences.get("Developer Tools", "Proxy Host").getValue());
  }

  @Test
  public void testMerge() {
    OperaPreferences newPrefs = new OperaGenericPreferences();
    newPrefs.set("Developer Tools", "Proxy Host", "1.2.3.4");
    newPrefs.set("Developer Tools", "Proxy Port", 1234);
    newPrefs.set("Developer Tools", "Proxy Auto Connect", true);

    preferences.merge(newPrefs);

    assertEquals("1.2.3.4", preferences.get("Developer Tools", "Proxy Host").getValue());
    assertEquals(1234, preferences.get("Developer Tools", "Proxy Port").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

  // If we have an existing OperaGenericPreferences object this will not write the preferences to
  // disk, so in this test we will check whether OperaProfile.setPreferences() does that for us.
  @Test
  public void testPreferencesAreSetWithGenericPreferenceObject() {
    OperaPreferences preferences = new OperaGenericPreferences();
    profile.preferences().set("Personal Info", "Country", "Norway");
    profile.setPreferences(preferences);

    OperaSettings settings = new OperaSettings(profile);
    driver = new TestDriverBuilder().using(settings).get();
View Full Code Here

    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

    new OperaFilePreferences(new File("/path/does/not/exist"));
  }

  @Test
  public void testMerge() {
    OperaPreferences newPrefs = new OperaGenericPreferences();
    newPrefs.set("Developer Tools", "Proxy Host", "1.2.3.4");
    newPrefs.set("Developer Tools", "Proxy Port", 1234);
    newPrefs.set("Developer Tools", "Proxy Auto Connect", true);

    preferences.merge(newPrefs);

    assertEquals("1.2.3.4", preferences.get("Developer Tools", "Proxy Host").getValue());
    assertEquals(1234, preferences.get("Developer Tools", "Proxy Port").getValue());
View Full Code Here

TOP

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

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.