@@ -658,6 +658,14 @@ function hlink(wb) {
658658 assert . equal ( get_cell ( ws , "A7" ) . l . Tooltip , "foo bar baz" ) ;
659659}
660660
661+ function check_margin ( margins , exp ) {
662+ assert . equal ( margins . left , exp [ 0 ] ) ;
663+ assert . equal ( margins . right , exp [ 1 ] ) ;
664+ assert . equal ( margins . top , exp [ 2 ] ) ;
665+ assert . equal ( margins . bottom , exp [ 3 ] ) ;
666+ assert . equal ( margins . header , exp [ 4 ] ) ;
667+ assert . equal ( margins . footer , exp [ 5 ] ) ;
668+ }
661669
662670describe ( 'parse features' , function ( ) {
663671 describe ( 'sheet visibility' , function ( ) {
@@ -977,14 +985,6 @@ describe('parse features', function() {
977985 } ) ;
978986
979987 describe ( 'page margins' , function ( ) {
980- function check_margin ( margins , exp ) {
981- assert . equal ( margins . left , exp [ 0 ] ) ;
982- assert . equal ( margins . right , exp [ 1 ] ) ;
983- assert . equal ( margins . top , exp [ 2 ] ) ;
984- assert . equal ( margins . bottom , exp [ 3 ] ) ;
985- assert . equal ( margins . header , exp [ 4 ] ) ;
986- assert . equal ( margins . footer , exp [ 5 ] ) ;
987- }
988988 var wb1 , wb2 , wb3 , wb4 , wb5 , wbs ;
989989 var bef = ( function ( ) {
990990 wb1 = X . readFile ( paths . pmxls ) ;
@@ -1251,6 +1251,21 @@ describe('roundtrip features', function() {
12511251 } ) ;
12521252 } ) ;
12531253
1254+ describe ( 'should preserve page margins' , function ( ) { [
1255+ //['xlml', paths.pmxml],
1256+ [ 'xlsx' , paths . pmxlsx ] ,
1257+ [ 'xlsb' , paths . pmxlsb ]
1258+ ] . forEach ( function ( w ) { it ( w [ 0 ] , function ( ) {
1259+ var wb1 = X . readFile ( w [ 1 ] ) ;
1260+ var wb2 = X . read ( X . write ( wb1 , { bookType :w [ 0 ] , type :"binary" } ) , { type :"binary" } ) ;
1261+ check_margin ( wb2 . Sheets [ "Normal" ] [ "!margins" ] , [ 0.7 , 0.7 , 0.75 , 0.75 , 0.3 , 0.3 ] ) ;
1262+ check_margin ( wb2 . Sheets [ "Wide" ] [ "!margins" ] , [ 1 , 1 , 1 , 1 , 0.5 , 0.5 ] ) ;
1263+ check_margin ( wb2 . Sheets [ "Wide" ] [ "!margins" ] , [ 1 , 1 , 1 , 1 , 0.5 , 0.5 ] ) ;
1264+ check_margin ( wb2 . Sheets [ "Narrow" ] [ "!margins" ] , [ 0.25 , 0.25 , 0.75 , 0.75 , 0.3 , 0.3 ] ) ;
1265+ check_margin ( wb2 . Sheets [ "Custom 1 Inch Centered" ] [ "!margins" ] , [ 1 , 1 , 1 , 1 , 0.3 , 0.3 ] ) ;
1266+ check_margin ( wb2 . Sheets [ "1 Inch HF" ] [ "!margins" ] , [ 0.7 , 0.7 , 0.75 , 0.75 , 1 , 1 ] ) ;
1267+ } ) ; } ) ; } ) ;
1268+
12541269 describe ( 'should preserve sheet visibility' , function ( ) { [
12551270 [ 'xlml' , paths . svxml ] ,
12561271 [ 'xlsx' , paths . svxlsx ] ,
0 commit comments