@@ -658,6 +658,14 @@ function hlink(wb) {
658
658
assert . equal ( get_cell ( ws , "A7" ) . l . Tooltip , "foo bar baz" ) ;
659
659
}
660
660
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
+ }
661
669
662
670
describe ( 'parse features' , function ( ) {
663
671
describe ( 'sheet visibility' , function ( ) {
@@ -977,14 +985,6 @@ describe('parse features', function() {
977
985
} ) ;
978
986
979
987
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
- }
988
988
var wb1 , wb2 , wb3 , wb4 , wb5 , wbs ;
989
989
var bef = ( function ( ) {
990
990
wb1 = X . readFile ( paths . pmxls ) ;
@@ -1251,6 +1251,21 @@ describe('roundtrip features', function() {
1251
1251
} ) ;
1252
1252
} ) ;
1253
1253
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
+
1254
1269
describe ( 'should preserve sheet visibility' , function ( ) { [
1255
1270
[ 'xlml' , paths . svxml ] ,
1256
1271
[ 'xlsx' , paths . svxlsx ] ,
0 commit comments