-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Following #4669: add test for Excel import date/time conversion
- Loading branch information
Erik Bruchez
committed
Sep 16, 2020
1 parent
99aa025
commit 34f055d
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/FormRunnerImportTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (C) 2020 Orbeon, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it under the terms of the | ||
* GNU Lesser General Public License as published by the Free Software Foundation; either version | ||
* 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Lesser General Public License for more details. | ||
* | ||
* The full text of the license is available at http://www.gnu.org/copyleft/lesser.html | ||
*/ | ||
package org.orbeon.oxf.fr | ||
|
||
import org.scalatest.funspec.AnyFunSpec | ||
|
||
|
||
class FormRunnerImportTest extends AnyFunSpec { | ||
|
||
describe("Excel storage format") { | ||
|
||
val Expected = List( | ||
("1", "date", "1900-01-01"), | ||
("44089", "date", "2020-09-15"), | ||
("44089.625", "datetime", "2020-09-15T15:00:00"), | ||
("0", "time", "00:00:00"), | ||
("0.5", "time", "12:00:00"), | ||
("0.625", "time", "15:00:00"), | ||
) | ||
|
||
for ((storage, formatTypeString, iso) <- Expected) | ||
it(s"must convert from `$storage` to `$iso`") { | ||
assert(iso == FormRunnerImport.convertDateTime(storage, formatTypeString, use1904windowing = false)) | ||
} | ||
} | ||
} |