Skip to content

Commit

Permalink
PPF-449: fix linting and coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
chinapandaman committed Jan 19, 2024
1 parent 91a54c8 commit 0d863ea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions PyPDFForm/core/font.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def register_font(font_name: str, ttf_stream: bytes) -> bool:
def auto_detect_font(widget: dict) -> str:
"""Returns the font of the text field if it is one of the standard fonts."""

# pylint: disable=R0912
result = DEFAULT_FONT

text_appearance = None
Expand Down
3 changes: 2 additions & 1 deletion PyPDFForm/widgets/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
class TextWidget(Widget):
"""Text field widget to create."""

USER_PARAMS = [("width", "width"), ("height", "height"), ("max_length", "maxlen"), ("font", "fontName"),
USER_PARAMS = [("width", "width"), ("height", "height"),
("max_length", "maxlen"), ("font", "fontName"),
("font_size", "fontSize"), ("font_color", "textColor")]
COLOR_PARAMS = ["font_color"]
NONE_DEFAULTS = ["max_length"]
Expand Down
12 changes: 12 additions & 0 deletions tests/test_create_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
from PyPDFForm import PdfWrapper


def test_create_radio_not_working(template_stream):
obj = PdfWrapper(template_stream)
stream = obj.stream
assert obj.create_widget(
"radio",
"foo",
1,
100,
100,
).stream == stream


def test_create_checkbox_default(template_stream, pdf_samples, request):
expected_path = os.path.join(pdf_samples, "widget", "create_checkbox_default.pdf")
with open(expected_path, "rb+") as f:
Expand Down

0 comments on commit 0d863ea

Please sign in to comment.