chromium/third_party/pdfium/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp

// Copyright 2017 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <math.h>

#include <algorithm>

#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_extension.h"
#include "fxjs/fxv8.h"
#include "fxjs/xfa/cfxjse_engine.h"
#include "fxjs/xfa/cfxjse_isolatetracker.h"
#include "fxjs/xfa/cfxjse_value.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/scoped_set_tz.h"
#include "testing/xfa_js_embedder_test.h"
#include "xfa/fxfa/cxfa_eventparam.h"

class CFXJSEFormCalcContextEmbedderTest : public XFAJSEmbedderTest {};

// TODO(dsinclair): Comment out tests are broken and need to be fixed.

TEST_F(CFXJSEFormCalcContextEmbedderTest, TranslateEmpty) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, TranslateNumber) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Numeric) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Strings) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Booleans) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Abs) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Avg) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Ceil) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Count) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Floor) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Max) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Min) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Mod) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Round) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Sum) {}

// TEST_F(CFXJSEFormCalcContextEmbedderTest, DISABLED_Date) {
//   ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
//
//   TODO(dsinclair): Make compatible with windows.
//   time_t seconds = time(nullptr);
//   int days = seconds / (60 * 60 * 24);

//   EXPECT_TRUE(Execute("Date()"));

//   v8::Local<v8::Value> value = GetValue();
//   EXPECT_TRUE(value->IsNumber());
//   EXPECT_EQ(days, value->ToInteger());
// }

TEST_F(CFXJSEFormCalcContextEmbedderTest, Date2Num) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, DateFmt) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, IsoDate2Num) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, DISABLED_IsoTime2Num) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, LocalDateFmt) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, DISABLED_LocalTimeFmt) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Num2Date) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, DISABLED_Num2GMTime) {}

// TODO(dsinclair): Broken on Mac ...
TEST_F(CFXJSEFormCalcContextEmbedderTest, DISABLED_Num2Time) {}

// TEST_F(CFXJSEFormCalcContextEmbedderTest, DISABLED_Time) {
//   ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
//   TODO(dsinclair): Make compatible with windows.
//   struct timeval tp;
//   gettimeofday(&tp, nullptr);

//   EXPECT_TRUE(Execute("Time()"));

//   v8::Local<v8::Value> value = GetValue();
//   EXPECT_TRUE(value->IsInteger());
//   EXPECT_EQ(tp.tv_sec * 1000L + tp.tv_usec / 1000, value->ToInteger())
//       << "Program: Time()";
// }

TEST_F(CFXJSEFormCalcContextEmbedderTest, Time2Num) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Time2NumWithTZ) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, TimeFmt) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Apr) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, CTerm) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, FV) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, IPmt) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, NPV) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Pmt) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, PPmt) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, PV) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Rate) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Term) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Choose) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Exists) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, HasValue) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Oneof) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Within) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Eval) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, DISABLED_Null) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Ref) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, UnitType) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, UnitValue) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, At) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Concat) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Decode) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Encode) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, DISABLED_Format) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Left) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Len) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Lower) {}

// This is testing for an OOB read, so will likely only fail under ASAN.
TEST_F(CFXJSEFormCalcContextEmbedderTest, Bug854623) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Ltrim) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, DISABLED_Parse) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Replace) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Right) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Rtrim) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Space) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Str) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Stuff) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Substr) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Uuid) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Upper) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, WordNum) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Get) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Post) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, Put) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, InvalidFunctions) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, MethodCall) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, GetXFAEventChange) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, SetXFAEventChange) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, SetXFAEventFullTextFails) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, EventChangeSelection) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, XFAEventCancelAction) {}

TEST_F(CFXJSEFormCalcContextEmbedderTest, ComplexTextChangeEvent) {}

// Should not crash.
TEST_F(CFXJSEFormCalcContextEmbedderTest, Bug1223) {}