@@ -3056,8 +3056,7 @@ This is a test too.`,
30563056 writeArray = [ ] ;
30573057 doc . __private__ . setCustomOutputDestination ( writeArray ) ;
30583058 doc . __private__ . putStream ( {
3059- data :
3060- "x\u009C+.)JMÌuI,I\u0004\u0000\u0016Ò\u0004\u0007" ,
3059+ data : "x\u009C+.)JMÌuI,I\u0004\u0000\u0016Ò\u0004\u0007" ,
30613060 alreadyAppliedFilters : [ "/FlateDecode" ]
30623061 } ) ;
30633062 expect ( bufferFromString ( writeArray . join ( "\n" ) ) ) . toEqual ( expected ) ;
@@ -3100,6 +3099,7 @@ This is a test too.`,
31003099 objId : 3 ,
31013100 contentsObjId : 4
31023101 } ) ;
3102+
31033103 expect ( writeArray ) . toEqual ( [
31043104 "3 0 obj" ,
31053105 "<</Type /Page" ,
@@ -3607,6 +3607,25 @@ This is a test too.`,
36073607 "%%EOF"
36083608 ] ) ;
36093609 } ) ;
3610+
3611+ it ( "jsPdf public function beginFormObject, endFormObject" , ( ) => {
3612+ var doc = jsPDF ( ) ;
3613+ var startContext = doc . internal . getCurrentPageInfo ( ) . pageContext ;
3614+ doc . beginFormObject ( 0 , 0 , 100 , 100 , new doc . internal . Matrix ( 1 , 0 , 0 , 1 , 0 , 0 ) ) ;
3615+ expect ( doc . internal . getCurrentPageInfo ( ) . pageContext ) . not . toEqual (
3616+ startContext
3617+ ) ;
3618+ doc . endFormObject ( "testFormObject" ) ;
3619+ expect ( doc . internal . getCurrentPageInfo ( ) . pageContext ) . toEqual ( startContext ) ;
3620+
3621+ // Adding a form object with the same id twice should keep stack intact
3622+ doc . beginFormObject ( 0 , 0 , 100 , 100 , new doc . internal . Matrix ( 1 , 0 , 0 , 1 , 0 , 0 ) ) ;
3623+ expect ( doc . internal . getCurrentPageInfo ( ) . pageContext ) . not . toEqual (
3624+ startContext
3625+ ) ;
3626+ doc . endFormObject ( "testFormObject" ) ;
3627+ expect ( doc . internal . getCurrentPageInfo ( ) . pageContext ) . toEqual ( startContext ) ;
3628+ } ) ;
36103629} ) ;
36113630
36123631function bufferFromString ( string ) {
0 commit comments