Permalink
Browse files

Merge pull request #185 from rdmueller/b#121b

fix #184
  • Loading branch information...
rdmueller committed Aug 31, 2018
2 parents 4565f5e + c138101 commit 8b1888e083a9df72f5b575156935417752de7684
@@ -0,0 +1,60 @@
package docToolchain
import org.gradle.testkit.runner.GradleRunner
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Stepwise
import spock.lang.Unroll
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
@Stepwise
class ExportExcelSpec extends Specification {
def gradleCommand
@Shared
def filenameList = []
@Shared
def filecontentList = []
void setupSpec() {
// 'get all files from the testdata folder'
new File('./src/test/testData/excel/Sample.xlsx/.').eachFile { file ->
filenameList << file.name
filecontentList << file.text
.trim()
.replaceAll("\r","")
// the output depends on the locale!
.replaceAll("([0-9])[,]([0-9])",'$1.$2')
}
println filenameList
}
void 'test export of Excel file'() {
when: 'the gradle task is invoked'
def result = GradleRunner.create()
.withProjectDir(new File('.'))
.withArguments(['exportExcel', '--info'])
.build()
then: 'the task has been successfully executed'
result.task(":exportExcel").outcome == SUCCESS
}
@Unroll
void 'test exported files: #filename'() {
when: 'the test before exported the excel file'
then: 'the export file have been created'
new File('./src/docs/excel/Sample.xlsx/'+filename).exists() == true
and: 'its content ends with our sample file'
new File('./src/docs/excel/Sample.xlsx/'+filename)
.text.trim()
.replaceAll("\r","")
// the output depends on the locale!
.replaceAll("([0-9])[,]([0-9])",'$1.$2')
.endsWith(filecontent)
where: 'iterate the expected files'
filename << filenameList
filecontent << filecontentList
}
}
@@ -0,0 +1,48 @@
[options="header",cols="25,25,25,25"]
|===
2+.>| ColSpan
{set:cellbgcolor:#595959}
.>| a
{set:cellbgcolor!}
.>| j
.>| 1
3+.>| 2
{set:cellbgcolor:#ffc000}
.>| 3
{set:cellbgcolor!}
.>| 4
.>| f
.>| 7
.>| 5
2+.>| 6
{set:cellbgcolor:#00b0f0}
.>| 8
{set:cellbgcolor!}
.>| a
.2+^.^| b
{set:cellbgcolor:#ffff00}
.>| c
{set:cellbgcolor!}
.>| d
.>| e
2.2+^.^| g
{set:cellbgcolor:#92d050}
.>| i
{set:cellbgcolor!}
.>| j
|===
@@ -0,0 +1,7 @@
"ColSpan","","a","j"
"1","2","",""
"3","4","f","7"
"5","6","","8"
"a","b","c","d"
"e","","g",""
"i","j","",""
@@ -0,0 +1,25 @@
[options="header",cols="25,25,25,25"]
|===
|
.>| test
|
.>| test2
|
|
|
|
|
.>| test3
|
|
|
|
.>| test4
|
|===
@@ -0,0 +1,5 @@
"","test","","test2"
"","","",""
"","test3","",""
"","","test4",""
@@ -0,0 +1,13 @@
[options="header",cols="25,25,25,25"]
|===
.>| 1
.>| 2
.>| 3
.>| 2x3
.>| 1,00
.>| 2,00 €
.>| 300%
.>| 6
|===
@@ -0,0 +1,2 @@
"1","2","3","2x3"
"1,00","2,00 €","300%","6"
@@ -0,0 +1,56 @@
[options="header",cols="36,9,18,18,18"]
|===
| A
| B
| C
| =B
| D
| Wert A
| WertV
| WertC +
WertD
| WertV
| Test "test"
| a wide cell
{set:cellbgcolor:#ffc000}
| narrow
{set:cellbgcolor!}
| default
{set:cellbgcolor:#4dbebb}
| test *bold*
{set:cellbgcolor!}
| 6/1/17
| left
|
|
| test {vbar} test
| 6/2/17
>| right
|
|
{set:cellbgcolor:#92d050}
|
{set:cellbgcolor!}
| 6/3/17
^| center
|
|
|
| 6/13/17
| 1 +
2 +
3
|
| top
.^| middle
{set:cellbgcolor:#00b0f0}
.>| bottom
{set:cellbgcolor!}
|===
@@ -0,0 +1,10 @@
"A","B","C","=B","D"
"Wert A","WertV","WertC
WertD","WertV","Test ""test"""
"a wide cell","narrow","default","test *bold*","6/1/17"
"left","","","test | test","6/2/17"
"right","","","","6/3/17"
"center","","","","6/13/17"
"1
2
3","","top","middle","bottom"
@@ -0,0 +1,11 @@
This folder contains exported workbooks from Excel.
Please note that these are generated files but reside in the `src`-folder in order to be versioned.
This is to make sure that they can be used from environments other than windows.
# Warning!
**The contents of this folder will be overwritten with each re-export!**
use `gradle exportExcel` to re-export files

0 comments on commit 8b1888e

Please sign in to comment.