Commit d041404b authored by Alexander.Trofimov's avatar Alexander.Trofimov

delete formula test document, use empty

fix unit tests
parent e673ec15
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
function getTestWorkbook() {
return "XLSY;v1;4495;BQGAAgAAAoYHAAADDQsAAAQgCwAAAIYRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAwAAAACAQAAAAUDCAAAAAAAAAAAABRAAFgAAAABFgAAAAAGCgAAABsEOARBBEIEMgABBAIAAAACGwAAAAMWAAAAAgQCAAAAAwQCAAAABQUAAAAAADgkQAQEAAAAQQAxAAsKAAAAAQXNzMzMzMwsQAkAAAAAADgAAAABFgAAAAAGCgAAABsEOARBBEIEMwABBAMAAAAEBAAAAEEAMQALCgAAAAEFzczMzMzMLEAJAAAAAAUAAAAAAAAAAA==";
}
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
document.write('<script type="text/javascript" src="' + item.substring('../'.length) + '"><\/script>'); document.write('<script type="text/javascript" src="' + item.substring('../'.length) + '"><\/script>');
}); });
</script> </script>
<script type="text/javascript" src="FormulaTestEditor.js"></script> <script type="text/javascript" src="../document/empty-workbook.js"></script>
<script type="text/javascript" src="FormulaTests.js"></script> <script type="text/javascript" src="FormulaTests.js"></script>
</head> </head>
<body> <body>
......
...@@ -424,9 +424,7 @@ $( function () { ...@@ -424,9 +424,7 @@ $( function () {
var fSortAscending = AscCommon.fSortAscending; var fSortAscending = AscCommon.fSortAscending;
var g_oIdCounter = AscCommon.g_oIdCounter; var g_oIdCounter = AscCommon.g_oIdCounter;
var oParser, wb, ws, dif = 1e-9, var oParser, wb, ws, dif = 1e-9, sData = AscCommonExcel.getEmptyWorkbook(), tmp;
data = getTestWorkbook(),
sData = data + "", tmp;
if ( AscCommon.c_oSerFormat.Signature === sData.substring( 0, AscCommon.c_oSerFormat.Signature.length ) ) { if ( AscCommon.c_oSerFormat.Signature === sData.substring( 0, AscCommon.c_oSerFormat.Signature.length ) ) {
wb = new AscCommonExcel.Workbook( new AscCommonExcel.asc_CHandlersList(), {wb:{getWorksheet:function(){}}} ); wb = new AscCommonExcel.Workbook( new AscCommonExcel.asc_CHandlersList(), {wb:{getWorksheet:function(){}}} );
AscCommon.History.init(wb); AscCommon.History.init(wb);
...@@ -443,7 +441,6 @@ $( function () { ...@@ -443,7 +441,6 @@ $( function () {
AscCommonExcel.g_oUndoRedoComment = new AscCommonExcel.UndoRedoComment(wb); AscCommonExcel.g_oUndoRedoComment = new AscCommonExcel.UndoRedoComment(wb);
AscCommonExcel.g_oUndoRedoAutoFilters = new AscCommonExcel.UndoRedoAutoFilters(wb); AscCommonExcel.g_oUndoRedoAutoFilters = new AscCommonExcel.UndoRedoAutoFilters(wb);
AscCommonExcel.g_DefNameWorksheet = new AscCommonExcel.Worksheet(wb, -1); AscCommonExcel.g_DefNameWorksheet = new AscCommonExcel.Worksheet(wb, -1);
// g_oUndoRedoGraphicObjects = new UndoRedoGraphicObjects(wb);
g_oIdCounter.Set_Load(false); g_oIdCounter.Set_Load(false);
var oBinaryFileReader = new AscCommonExcel.BinaryFileReader(); var oBinaryFileReader = new AscCommonExcel.BinaryFileReader();
...@@ -2057,15 +2054,10 @@ $( function () { ...@@ -2057,15 +2054,10 @@ $( function () {
test( "Test: rename sheet #1", function () { test( "Test: rename sheet #1", function () {
wb.dependencyFormulas.unlockRecal(); wb.dependencyFormulas.unlockRecal();
ws = wb.getWorksheet( 0 ); ws.getRange2( "S95" ).setValue( "2" );
ws.getRange2( "S95" ).setValue( "2" ); ws.getRange2( "S100" ).setValue( "=" + wb.getWorksheet( 0 ).getName() + "!S95" );
ws = wb.getWorksheet( 1 ); ws.setName( "SheetTmp" );
ws.getRange2( "S100" ).setValue( "=" + wb.getWorksheet( 0 ).getName() + "!S95" ); strictEqual( ws.getCell2( "S100" ).getFormula(), ws.getName() + "!S95" );
strictEqual( ws.getCell2( "S100" ).getValueWithFormat(), "2" );
wb.getWorksheet( 0 ).setName( "ЛистTEMP" );
strictEqual( ws.getCell2( "S100" ).getFormula(), wb.getWorksheet( 0 ).getName() + "!S95" );
wb.dependencyFormulas.lockRecal(); wb.dependencyFormulas.lockRecal();
} ); } );
...@@ -2212,7 +2204,7 @@ $( function () { ...@@ -2212,7 +2204,7 @@ $( function () {
oParser = new parserFormula( "SHEETS()", "A2", ws ); oParser = new parserFormula( "SHEETS()", "A2", ws );
ok( oParser.parse() ); ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), 3 ); strictEqual( oParser.calculate().getValue(), 1 );
} ); } );
test( "Test: \"TRIM\"", function () { test( "Test: \"TRIM\"", function () {
...@@ -4167,12 +4159,9 @@ $( function () { ...@@ -4167,12 +4159,9 @@ $( function () {
}); });
test( "Test: \"DEVSQ\"", function () { test( "Test: \"DEVSQ\"", function () {
ws.getRange2( "A1" ).setValue( "5.6" );
var ws1 = wb.getWorksheet( 1 ); ws.getRange2( "A2" ).setValue( "8.2" );
ws.getRange2( "A3" ).setValue( "9.2" );
ws1.getRange2( "A1" ).setValue( "5.6" );
ws1.getRange2( "A2" ).setValue( "8.2" );
ws1.getRange2( "A3" ).setValue( "9.2" );
oParser = new parserFormula( "DEVSQ(5.6,8.2,9.2)", "A1", ws ); oParser = new parserFormula( "DEVSQ(5.6,8.2,9.2)", "A1", ws );
ok( oParser.parse() ); ok( oParser.parse() );
...@@ -4186,7 +4175,7 @@ $( function () { ...@@ -4186,7 +4175,7 @@ $( function () {
ok( oParser.parse() ); ok( oParser.parse() );
strictEqual( difBetween( oParser.calculate().getValue(), 3.379999999999999 ), true ); strictEqual( difBetween( oParser.calculate().getValue(), 3.379999999999999 ), true );
oParser = new parserFormula( "DEVSQ(Лист2!A1:A3)", "A1", ws ); oParser = new parserFormula( "DEVSQ(" + ws.getName() + "!A1:A3)", "A1", ws );
ok( oParser.parse() ); ok( oParser.parse() );
strictEqual( difBetween( oParser.calculate().getValue(), 6.906666666666665 ), true ); strictEqual( difBetween( oParser.calculate().getValue(), 6.906666666666665 ), true );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment