@@ -660,6 +660,14 @@ function hlink(wb) {
660660 assert . equal ( get_cell ( ws , "A7" ) . l . Tooltip , "foo bar baz" ) ;
661661}
662662
663+ function check_margin ( margins , exp ) {
664+ assert . equal ( margins . left , exp [ 0 ] ) ;
665+ assert . equal ( margins . right , exp [ 1 ] ) ;
666+ assert . equal ( margins . top , exp [ 2 ] ) ;
667+ assert . equal ( margins . bottom , exp [ 3 ] ) ;
668+ assert . equal ( margins . header , exp [ 4 ] ) ;
669+ assert . equal ( margins . footer , exp [ 5 ] ) ;
670+ }
663671
664672describe ( 'parse features' , function ( ) {
665673 describe ( 'sheet visibility' , function ( ) {
@@ -979,14 +987,6 @@ describe('parse features', function() {
979987 } ) ;
980988
981989 describe ( 'page margins' , function ( ) {
982- function check_margin ( margins , exp ) {
983- assert . equal ( margins . left , exp [ 0 ] ) ;
984- assert . equal ( margins . right , exp [ 1 ] ) ;
985- assert . equal ( margins . top , exp [ 2 ] ) ;
986- assert . equal ( margins . bottom , exp [ 3 ] ) ;
987- assert . equal ( margins . header , exp [ 4 ] ) ;
988- assert . equal ( margins . footer , exp [ 5 ] ) ;
989- }
990990 var wb1 , wb2 , wb3 , wb4 , wb5 , wbs ;
991991 var bef = ( function ( ) {
992992 wb1 = X . readFile ( paths . pmxls ) ;
@@ -1253,6 +1253,21 @@ describe('roundtrip features', function() {
12531253 } ) ;
12541254 } ) ;
12551255
1256+ describe ( 'should preserve page margins' , function ( ) { [
1257+ //['xlml', paths.pmxml],
1258+ [ 'xlsx' , paths . pmxlsx ] ,
1259+ [ 'xlsb' , paths . pmxlsb ]
1260+ ] . forEach ( function ( w ) { it ( w [ 0 ] , function ( ) {
1261+ var wb1 = X . readFile ( w [ 1 ] ) ;
1262+ var wb2 = X . read ( X . write ( wb1 , { bookType :w [ 0 ] , type :"binary" } ) , { type :"binary" } ) ;
1263+ check_margin ( wb2 . Sheets [ "Normal" ] [ "!margins" ] , [ 0.7 , 0.7 , 0.75 , 0.75 , 0.3 , 0.3 ] ) ;
1264+ check_margin ( wb2 . Sheets [ "Wide" ] [ "!margins" ] , [ 1 , 1 , 1 , 1 , 0.5 , 0.5 ] ) ;
1265+ check_margin ( wb2 . Sheets [ "Wide" ] [ "!margins" ] , [ 1 , 1 , 1 , 1 , 0.5 , 0.5 ] ) ;
1266+ check_margin ( wb2 . Sheets [ "Narrow" ] [ "!margins" ] , [ 0.25 , 0.25 , 0.75 , 0.75 , 0.3 , 0.3 ] ) ;
1267+ check_margin ( wb2 . Sheets [ "Custom 1 Inch Centered" ] [ "!margins" ] , [ 1 , 1 , 1 , 1 , 0.3 , 0.3 ] ) ;
1268+ check_margin ( wb2 . Sheets [ "1 Inch HF" ] [ "!margins" ] , [ 0.7 , 0.7 , 0.75 , 0.75 , 1 , 1 ] ) ;
1269+ } ) ; } ) ; } ) ;
1270+
12561271 describe ( 'should preserve sheet visibility' , function ( ) { [
12571272 [ 'xlml' , paths . svxml ] ,
12581273 [ 'xlsx' , paths . svxlsx ] ,
0 commit comments