This repository has been archived by the owner on Apr 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #864 from lognaturel/ssm-randomize
- Loading branch information
Showing
5 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
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
25 changes: 25 additions & 0 deletions
25
test/java/org/opendatakit/briefcase/export/ExportToCsvExplodeRandomizedChoiceListTest.java
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,25 @@ | ||
package org.opendatakit.briefcase.export; | ||
|
||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class ExportToCsvExplodeRandomizedChoiceListTest { | ||
private ExportToCsvScenario scenario; | ||
|
||
@Before | ||
public void setUp() { | ||
scenario = ExportToCsvScenario.setUp("choice-lists-randomize"); | ||
} | ||
|
||
@After | ||
public void tearDown() { | ||
scenario.tearDown(); | ||
} | ||
|
||
@Test | ||
public void exportWithSplitSelectMultiple_hasStableColumnOrder() { | ||
scenario.runExportExplodedChoiceLists(); | ||
scenario.assertSameContent(); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
test/resources/org/opendatakit/briefcase/export/choice-lists-randomize-submission.xml
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,6 @@ | ||
<data id="choice-lists-randomize" instanceID="uuid:39f3dd36-161e-47cb-a1a4-395831d253a7" submissionDate="2020-04-26T08:58:20.525Z"> | ||
<select_multiple>a</select_multiple> | ||
<n0:meta xmlns:n0="http://openrosa.org/xforms"> | ||
<n0:instanceID>uuid:39f3dd36-161e-47cb-a1a4-395831d253a7</n0:instanceID> | ||
</n0:meta> | ||
</data> |
2 changes: 2 additions & 0 deletions
2
test/resources/org/opendatakit/briefcase/export/choice-lists-randomize.csv.expected
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,2 @@ | ||
SubmissionDate,select_multiple,select_multiple/a,select_multiple/b,select_multiple/c,select_multiple/d,select_multiple/e,meta-instanceID,KEY | ||
"Apr 26, 2020 8:58:20 AM",a,1,0,0,0,0,uuid:39f3dd36-161e-47cb-a1a4-395831d253a7,uuid:39f3dd36-161e-47cb-a1a4-395831d253a7 |
49 changes: 49 additions & 0 deletions
49
test/resources/org/opendatakit/briefcase/export/choice-lists-randomize.xml
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,49 @@ | ||
<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/2002/xforms"> | ||
<h:head> | ||
<h:title>Randomize choice list</h:title> | ||
<model> | ||
<instance> | ||
<data id="choice-lists-randomize"> | ||
<select_multiple/> | ||
<meta> | ||
<instanceID/> | ||
</meta> | ||
</data> | ||
</instance> | ||
<instance id="choices"> | ||
<root> | ||
<item> | ||
<name>a</name> | ||
<label>A</label> | ||
</item> | ||
<item> | ||
<name>b</name> | ||
<label>B</label> | ||
</item> | ||
<item> | ||
<name>c</name> | ||
<label>C</label> | ||
</item> | ||
<item> | ||
<name>d</name> | ||
<label>D</label> | ||
</item> | ||
<item> | ||
<name>e</name> | ||
<label>E</label> | ||
</item> | ||
</root> | ||
</instance> | ||
<bind nodeset="/data/select_multiple" type="string"/> | ||
<bind calculate="concat('uuid:', uuid())" nodeset="/data/meta/instanceID" readonly="true()" type="string"/> | ||
</model> | ||
</h:head> | ||
<h:body> | ||
<select ref="/data/select_multiple"> | ||
<itemset nodeset="randomize(instance('choices')/root/item)"> | ||
<value ref="name"/> | ||
<label ref="label"/> | ||
</itemset> | ||
</select> | ||
</h:body> | ||
</h:html> |