@@ -1824,4 +1824,71 @@ describe("Stamp Editor", () => {
18241824 ) ;
18251825 } ) ;
18261826 } ) ;
1827+
1828+ describe ( "Stamp (move between pages)" , ( ) => {
1829+ let pages ;
1830+
1831+ beforeEach ( async ( ) => {
1832+ pages = await loadAndWait (
1833+ "firefox_stamp.pdf" ,
1834+ getAnnotationSelector ( "24R" ) ,
1835+ "50"
1836+ ) ;
1837+ } ) ;
1838+
1839+ afterEach ( async ( ) => {
1840+ await closePages ( pages ) ;
1841+ } ) ;
1842+
1843+ it ( "must move a stamp annotation from page 1 to page 2" , async ( ) => {
1844+ await Promise . all (
1845+ pages . map ( async ( [ browserName , page ] ) => {
1846+ await waitForPageRendered ( page , 1 ) ;
1847+ await waitForPageRendered ( page , 2 ) ;
1848+ await waitForAnnotationEditorLayer ( page , 1 ) ;
1849+ await waitForAnnotationEditorLayer ( page , 2 ) ;
1850+
1851+ const modeChangedHandle = await waitForAnnotationModeChanged ( page ) ;
1852+
1853+ await page . click ( getAnnotationSelector ( "24R" ) , { count : 2 } ) ;
1854+ await awaitPromise ( modeChangedHandle ) ;
1855+
1856+ const editorSelector = getEditorSelector ( 0 ) ;
1857+ await waitForSelectedEditor ( page , editorSelector ) ;
1858+
1859+ await scrollIntoView (
1860+ page ,
1861+ `.page[data-page-number="2"] .annotationEditorLayer`
1862+ ) ;
1863+
1864+ const editorRect = await getRect ( page , editorSelector ) ;
1865+ const page2Rect = await getRect (
1866+ page ,
1867+ `.page[data-page-number="2"] .annotationEditorLayer`
1868+ ) ;
1869+
1870+ const deltaX =
1871+ page2Rect . x +
1872+ page2Rect . width / 2 -
1873+ ( editorRect . x + editorRect . width / 2 ) ;
1874+ const deltaY =
1875+ page2Rect . y +
1876+ page2Rect . height / 3 -
1877+ ( editorRect . y + editorRect . height / 2 ) ;
1878+
1879+ await dragAndDrop ( page , editorSelector , [ [ deltaX , deltaY ] ] , 10 ) ;
1880+
1881+ await page . waitForFunction (
1882+ sel => {
1883+ const editorDiv = document . querySelector ( sel ) ;
1884+ const pageDiv = editorDiv ?. closest ( ".page" ) ;
1885+ return pageDiv ?. getAttribute ( "data-page-number" ) === "2" ;
1886+ } ,
1887+ { } ,
1888+ editorSelector
1889+ ) ;
1890+ } )
1891+ ) ;
1892+ } ) ;
1893+ } ) ;
18271894} ) ;
0 commit comments