ocis icon indicating copy to clipboard operation
ocis copied to clipboard

[QA] Extend tests coverage for preview

Open amrita-shrestha opened this issue 1 year ago • 6 comments

Description

Need to research about the query used in preview api and add tests coverage Preview image contains the query

scalingup:0
preview:1 
a:-1
processor:fit 
c:19ed023952b05d5006ae58541e2f8dc0
x:640
y:640

There is no test coverage for

  • preview
    • 0
    • 1
  • processor
    • fit
    • look for other types and add
    • with different widths and heights when the processor is not set, check whether it is the same or not
      • recheck whether this tests scenario is checking image strictly or not
        Scenario Outline: it should update the preview content if the file content is updated (content with UTF chars)
  • scalingup
  • what a query denote

amrita-shrestha avatar Aug 30 '24 11:08 amrita-shrestha

Some related discussions: https://github.com/owncloud/ocis/pull/6770#discussion_r1284301800

AFAIK, the server makes use of preview, x, y and processor query params only.

https://github.com/owncloud/ocis/blob/160f77c6ac7a777ec410be2c4add8824e99357f4/services/webdav/pkg/dav/requests/thumbnail.go#L72-L89

saw-jan avatar Sep 17 '24 08:09 saw-jan

available options for processor https://github.com/owncloud/ocis/blob/160f77c6ac7a777ec410be2c4add8824e99357f4/services/thumbnails/pkg/thumbnail/processor.go#L33-L42

saw-jan avatar Sep 17 '24 08:09 saw-jan

@saw-jan @amrita-shrestha

As per my research so far, following are the findings:

  1. all processor types:
    • fit
    • fill
    • resize
    • thumbnail
  2. a is for aspect ratio
  3. only preview, x, y and processor query params are REQUIRED in the url. image Source: https://owncloud.dev/services/thumbnails/

prashant-gurung899 avatar Sep 17 '24 08:09 prashant-gurung899

  • preview
    • 0
    • 1

Idk if we need test for this. because route to ?preview=0 doesn't exist. request to ?preview=0 means we are requesting a file not a preview. Maybe one scenario should be sufficient if we want to add test.

saw-jan avatar Sep 17 '24 09:09 saw-jan

Source: https://owncloud.dev/services/thumbnails/

Also, I wonder if the docs related to query params are up-to-date

saw-jan avatar Sep 17 '24 09:09 saw-jan

Scenario Outline: it should update the preview content if the file content is updated (content with UTF chars)

The above mentioned scenario is fine as of now. The preview is asserted with the binary string. For preview = 0 case, i have written tests in PR: https://github.com/owncloud/ocis/pull/10093 I will be writing tests for available processors in next PR.

@amrita-shrestha @saw-jan

prashant-gurung899 avatar Sep 18 '24 08:09 prashant-gurung899

  • preview
    • 0
    • 1
  • processor
    • fit
    • look for other types and add

Closing this issue as: Test coverage for preview set to 0 is covered in PR: https://github.com/owncloud/ocis/pull/10093 and for tests with different processors, it is covered in this PR: https://github.com/owncloud/ocis/pull/10134

prashant-gurung899 avatar Sep 26 '24 04:09 prashant-gurung899

For scalingup param, see belwo. this probably means scalingup param is not supported https://github.com/owncloud/ocis/blob/8a522b921927199f799d6404f064ce543115d277/services/thumbnails/pkg/thumbnail/resolutions.go#L59

saw-jan avatar Dec 31 '24 10:12 saw-jan