This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: LSDV-5560: Fix plus and minus hotkeys (#1561)
* fix: LSDV-5560: Fix plus and minus hotkeys * test: LSDV-5560: Add test for zoom hotkeys * Refactor Co-authored-by: hlomzik <hlomzik@gmail.com> * Add comments Co-authored-by: hlomzik <hlomzik@gmail.com> * Update testing lib --------- Co-authored-by: hlomzik <hlomzik@gmail.com>
- Loading branch information
Showing
5 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export const simpleConfig = ` | ||
<View> | ||
<Image name="img" value="$image"/> | ||
<RectangleLabels name="tag" toName="img"> | ||
<Label value="Label 1" background="purple"/> | ||
</RectangleLabels> | ||
</View> | ||
`; | ||
|
||
export const simpleImageData = { | ||
image: 'https://htx-misc.s3.amazonaws.com/opensource/label-studio/examples/images/nick-owuor-astro-nic-visuals-wDifg5xc9Z4-unsplash.jpg', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/functional/specs/image_segmentation/tools/zoom.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { ImageView, LabelStudio } from '@heartexlabs/ls-test/helpers/LSF'; | ||
import { simpleConfig, simpleImageData } from 'data/image_segmentation/tools/zoom'; | ||
|
||
describe('Zoom tool', () => { | ||
it('should zoom on hotkey', () => { | ||
LabelStudio.params() | ||
.config(simpleConfig) | ||
.data(simpleImageData) | ||
.withResult([]) | ||
.init(); | ||
|
||
ImageView.waitForImage(); | ||
|
||
const sizes = ImageView.image.then((img) => { | ||
return { | ||
width: parseFloat(img.css('width')), | ||
height: parseFloat(img.css('height')), | ||
}; | ||
}); | ||
|
||
for (let i = 0; i < 10; i++) { | ||
ImageView.zoomInWithHotkey(); | ||
} | ||
|
||
ImageView.image.then((img) => { | ||
sizes.then((sizes) => { | ||
expect(parseFloat(img.css('width'))).to.be.greaterThan(sizes.width); | ||
expect(parseFloat(img.css('height'))).to.be.greaterThan(sizes.height); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters