pdf_signature/docs/use_cases.md

4.1 KiB

Use cases

Use cases are derived from FRs.md (user stories) and meta-arch.md. Each Feature name matches the corresponding user story; scenarios focus on observable behavior without restating story details.

Feature: PDF browser

	Scenario: Open a PDF and navigate pages
		Given a PDF document is available
		When the user opens the document
		Then the first page is displayed
		And the user can move to the next or previous page

	Scenario: Jump to a specific page
		Given a multi-page PDF is open
		When the user selects a specific page number
		Then that page is displayed

	Scenario: Select a page for signing
		Given a PDF is open
		When the user marks the current page for signing
		Then the page is set as the signature target
Feature: load signature picture

	Scenario: Import a signature image
		Given a PDF page is selected for signing
		When the user chooses a signature image file
		Then the image is loaded and shown as a signature asset

	Scenario Outline: Handle invalid or unsupported files
		Given the user selects "<file>"
		When the app attempts to load the image
		Then the user is notified of the issue
		And the image is not added to the document

		Examples:
			| file            |
			| corrupted.png   |
			| signature.bmp   |
			| empty.jpg       |
Feature: geometrically adjust signature picture

	Scenario: Resize and move the signature within page bounds
		Given a signature image is placed on the page
		When the user drags handles to resize and drags to reposition
		Then the size and position update in real time
		And the signature remains within the page area

	Scenario: Lock aspect ratio while resizing
		Given a signature image is selected
		When the user enables aspect ratio lock and resizes
		Then the image scales proportionally
Feature: graphically adjust signature picture

	Scenario: Remove background
		Given a signature image is selected
		When the user enables background removal
		Then near-white background becomes transparent in the preview
		And the user can apply the change

	Scenario: Adjust contrast and brightness
		Given a signature image is selected
		When the user changes contrast and brightness controls
		Then the preview updates immediately
		And the user can apply or reset adjustments
Feature: draw signature

	Scenario: Draw with mouse or touch and place on page
		Given an empty signature canvas
		When the user draws strokes and confirms
		Then a signature image is created
		And it is placed on the selected page

	Scenario: Clear and redraw
		Given a drawn signature exists in the canvas
		When the user clears the canvas
		Then the canvas becomes blank

	Scenario: Undo the last stroke
		Given multiple strokes were drawn
		When the user chooses undo
		Then the last stroke is removed
Feature: save signed PDF

	Scenario: Export the signed document to a new file
		Given a PDF is open and contains at least one placed signature
		When the user saves/exports the document
		Then a new PDF file is saved at specified full path, location and file name
		And the signatures appear on the corresponding page in the output
        And keep other unchanged content(pages) intact in the output

	Scenario: Vector-accurate stamping into PDF page coordinates
		Given a signature is placed with a position and size relative to the page
		When the user saves/exports the document
		Then the signature is stamped at the exact PDF page coordinates and size
		And the stamp remains crisp at any zoom level (not rasterized by the screen)
		And other page content remains vector and unaltered

	Scenario: Prevent saving when nothing is placed
		Given a PDF is open with no signatures placed
		When the user attempts to save
		Then the user is notified there is nothing to save

    Scenario: Loading sign when exporting/saving files
		Given a signature is placed with a position and size relative to the page
		When the user starts exporting the document
        And the export process is not yet finished
		Then the user is notified that the export is still in progress
        And the user cannot edit the document