Skip to content

Commit

Permalink
Rename printoptions package to print
Browse files Browse the repository at this point in the history
  • Loading branch information
raju249 committed Jan 18, 2021
1 parent fc8578e commit c80bddf
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 70 deletions.
2 changes: 1 addition & 1 deletion java/client/src/org/openqa/selenium/PrintsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// under the License.
package org.openqa.selenium;

import org.openqa.selenium.printoptions.PrintOptions;
import org.openqa.selenium.print.PrintOptions;

public interface PrintsPage {
Pdf print(PrintOptions printOptions) throws WebDriverException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ java_library(
"//java/client/test/org/openqa/selenium:__subpackages__",
"//java/client/test/org/openqa/selenium/build:__pkg__",
"//java/client/test/org/openqa/selenium/testing/drivers:__pkg__",
"//java/client/src/org/openqa/selenium:__subpackages__",
],
deps = [
"//java/client/src/org/openqa/selenium:core",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.printoptions.print;
package org.openqa.selenium.print;

import org.openqa.selenium.internal.Require;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.printoptions.print;
package org.openqa.selenium.print;

import java.util.HashMap;
import java.util.Map;

public class PageSize {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.printoptions;


import org.openqa.selenium.internal.Require;
import org.openqa.selenium.printoptions.print.PageMargin;
import org.openqa.selenium.printoptions.print.PageSize;
package org.openqa.selenium.print;

public class PrintOptions {

Expand All @@ -32,16 +27,16 @@ public enum Orientation {
private double scale = 1.0;
private boolean background = false;
private boolean shrinkToFit = true;
private org.openqa.selenium.printoptions.print.PageSize pageSize = new org.openqa.selenium.printoptions.print.PageSize();
private org.openqa.selenium.printoptions.print.PageMargin pageMargin = new org.openqa.selenium.printoptions.print.PageMargin();
private PageSize pageSize = new PageSize();
private PageMargin pageMargin = new PageMargin();
private String[] pageRanges;

public Orientation getOrientation() {
return this.orientation;
}

public void setOrientation(Orientation orientation) {
this.orientation = Require.nonNull("orientation", orientation);
this.orientation = orientation;
}

public String[] getPageRanges() {
Expand All @@ -52,49 +47,46 @@ public void setPageRanges(String[] ranges) {
this.pageRanges = ranges;
}

public boolean getBackground() {
return this.background;
}

public void setBackground(boolean background) {
this.background = Require.nonNull("background", background);
this.background = background;
}

public double getScale() {
return this.scale;
public boolean getBackground() {
return this.background;
}

public void setScale(double scale) {
Require.nonNull("scale", scale);

if (scale < 0.1 || scale > 2) {
throw new IllegalArgumentException("Scale value should be between 0.1 and 2");
}

this.scale = scale;
}

public double getScale() {
return this.scale;
}

public boolean getShrinkToFit() {
return this.shrinkToFit;
}

public void setShrinkToFit(boolean value) {
this.shrinkToFit = Require.nonNull("value", value);
this.shrinkToFit = value;
}

public PageSize getPageSize() {
return this.pageSize;
public void setPageSize(PageSize pageSize) {
this.pageSize = pageSize;
}

public void setPageSize(PageSize pageSize) {
this.pageSize = Require.nonNull("pageSize", pageSize);
public void setPageMargin(PageMargin margin) {
this.pageMargin = margin;
}

public PageMargin getPageMargin() {
return this.pageMargin;
public PageSize getPageSize() {
return this.pageSize;
}

public void setPageMargin(PageMargin margin) {
this.pageMargin = Require.nonNull("margin", margin);
public PageMargin getPageMargin() {
return this.pageMargin;
}
}
17 changes: 0 additions & 17 deletions java/client/src/org/openqa/selenium/printoptions/BUILD.bazel

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.openqa.selenium.Point;
import org.openqa.selenium.WindowType;
import org.openqa.selenium.interactions.Sequence;
import org.openqa.selenium.printoptions.PrintOptions;
import org.openqa.selenium.print.PrintOptions;

import java.time.Duration;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
import org.openqa.selenium.logging.LoggingPreferences;
import org.openqa.selenium.logging.Logs;
import org.openqa.selenium.logging.NeedsLocalLogs;
import org.openqa.selenium.printoptions.PrintOptions;
import org.openqa.selenium.print.PageMargin;
import org.openqa.selenium.print.PrintOptions;
import org.openqa.selenium.remote.internal.WebElementToJsonConverter;
import org.openqa.selenium.virtualauthenticator.Credential;
import org.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator;
Expand Down
1 change: 0 additions & 1 deletion java/client/test/org/openqa/selenium/chrome/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ java_selenium_test_suite(
],
deps = [
"//java/client/src/org/openqa/selenium/chrome",
"//java/client/src/org/openqa/selenium/printoptions",
"//java/client/src/org/openqa/selenium/remote",
"//java/client/src/org/openqa/selenium/support",
"//java/client/test/org/openqa/selenium/build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.junit.Before;

import org.openqa.selenium.Pdf;
import org.openqa.selenium.printoptions.print.PageSize;
import org.openqa.selenium.printoptions.PrintOptions;
import org.openqa.selenium.print.PageSize;
import org.openqa.selenium.print.PrintOptions;
import org.openqa.selenium.testing.JUnit4TestBase;

public class FireFoxPrintCommandTest extends JUnit4TestBase {
Expand All @@ -49,7 +49,7 @@ public void canPrintPage() {
PrintOptions printOptions = new PrintOptions();

Pdf pdf = localDriver.print(printOptions);
assertThat(pdf.getBase64String().contains(MAGIC_STRING)).isTrue();
assertThat(pdf.getContent().contains(MAGIC_STRING)).isTrue();
}

@Test
Expand All @@ -58,7 +58,7 @@ public void canPrintwoPages() {
printOptions.setPageRanges(new String[]{"1-2"});

Pdf pdf = localDriver.print(printOptions);
assertThat(pdf.getBase64String().contains(MAGIC_STRING)).isTrue();
assertThat(pdf.getContent().contains(MAGIC_STRING)).isTrue();
}

@Test
Expand All @@ -72,6 +72,6 @@ public void canPrintWithValidParams() {
printOptions.setPageSize(pageSize);

Pdf pdf = localDriver.print(printOptions);
assertThat(pdf.getBase64String().contains(MAGIC_STRING)).isTrue();
assertThat(pdf.getContent().contains(MAGIC_STRING)).isTrue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ java_test_suite(
size = "small",
srcs = glob(["*Test.java", "print/*Test.java"]),
deps = [
"//java/client/src/org/openqa/selenium/printoptions",
"//java/client/test/org/openqa/selenium/testing:test-base",
"//java/client/test/org/openqa/selenium/testing:annotations",
"//java/client/src/org/openqa/selenium/printoptions/print",
"//java/client/src/org/openqa/selenium/print:print",
artifact("org.assertj:assertj-core"),
artifact("junit:junit"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.printoptions.print;
package org.openqa.selenium.print;

import org.junit.Test;
import org.junit.experimental.categories.Category;
import static org.assertj.core.api.Assertions.assertThat;

import org.openqa.selenium.printoptions.print.PageMargin;
import org.openqa.selenium.print.PageMargin;
import org.openqa.selenium.testing.UnitTests;


Expand All @@ -36,7 +36,7 @@ public class PageMarginTest {

@Test
public void setsDefaultMarginValues() {
org.openqa.selenium.printoptions.print.PageMargin pageMargin = new org.openqa.selenium.printoptions.print.PageMargin();
PageMargin pageMargin = new PageMargin();

assertThat(pageMargin.getTop()).isEqualTo(TOP);
assertThat(pageMargin.getBottom()).isEqualTo(BOTTOM);
Expand All @@ -46,7 +46,7 @@ public void setsDefaultMarginValues() {

@Test
public void setsVauesAsPassed() {
org.openqa.selenium.printoptions.print.PageMargin pageMargin = new PageMargin();
PageMargin pageMargin = new PageMargin();
pageMargin.setBottom(2.0);
pageMargin.setTop(3.0);
pageMargin.setLeft(1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.printoptions.print;
package org.openqa.selenium.print;

import org.junit.Test;
import org.junit.experimental.categories.Category;
import static org.assertj.core.api.Assertions.assertThat;

import org.openqa.selenium.printoptions.print.PageSize;
import org.openqa.selenium.print.PageSize;
import org.openqa.selenium.testing.UnitTests;


Expand All @@ -34,15 +34,15 @@ public class PageSizeTest {

@Test
public void setsDefaultHeightWidth() {
org.openqa.selenium.printoptions.print.PageSize pageSize = new org.openqa.selenium.printoptions.print.PageSize();
PageSize pageSize = new PageSize();

assertThat(pageSize.getHeight()).isEqualTo(HEIGHT);
assertThat(pageSize.getWidth()).isEqualTo(WIDTH);
}

@Test
public void setsValuesAsPassed() {
org.openqa.selenium.printoptions.print.PageSize pageSize = new PageSize();
PageSize pageSize = new PageSize();
pageSize.setHeight(11.0);
pageSize.setWidth(12.0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.printoptions;
package org.openqa.selenium.print;

import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand Down

0 comments on commit c80bddf

Please sign in to comment.