This repository was 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
Issue #799 Fix getting form name for form keys #803
Merged
ggalmazor
merged 2 commits into
getodk:master
from
ggalmazor:issue_799_fix_form_name_in_form_keys
Sep 10, 2019
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
30 changes: 30 additions & 0 deletions
30
test/java/org/opendatakit/briefcase/model/form/FormKeyTest.java
This file contains hidden or 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,30 @@ | ||
package org.opendatakit.briefcase.model.form; | ||
|
||
import static org.hamcrest.Matchers.is; | ||
import static org.junit.Assert.assertThat; | ||
import static org.opendatakit.briefcase.ui.pull.FormInstallerTest.getPath; | ||
import static org.opendatakit.briefcase.util.StringUtils.stripIllegalChars; | ||
|
||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import org.junit.Test; | ||
import org.opendatakit.briefcase.model.BriefcaseFormDefinition; | ||
import org.opendatakit.briefcase.model.FormStatus; | ||
import org.opendatakit.briefcase.util.BadFormDefinition; | ||
|
||
public class FormKeyTest { | ||
@Test | ||
public void regression_wrong_form_name_when_creating_keys_from_briefcase_form_defs() throws BadFormDefinition, URISyntaxException, IOException { | ||
String sanitizedName = stripIllegalChars("this-title-has-dashes"); | ||
Path briefcaseFolder = Files.createTempDirectory("briefcase"); | ||
Path formFile = briefcaseFolder.resolve("forms").resolve(sanitizedName).resolve(sanitizedName + ".xml"); | ||
Path sourceFormFile = getPath("title-with-dashes-form.xml"); | ||
Files.createDirectories(formFile.getParent()); | ||
Files.copy(sourceFormFile, formFile); | ||
FormKey key1 = FormKey.of("this-title-has-dashes", "this-id-has-dashes"); | ||
FormKey key2 = FormKey.from(new FormStatus(BriefcaseFormDefinition.resolveAgainstBriefcaseDefn(formFile.toFile(), false, briefcaseFolder.toFile()))); | ||
assertThat(key1, is(key2)); | ||
} | ||
} |
This file contains hidden or 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
This file contains hidden or 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,23 @@ | ||
<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml"> | ||
<h:head> | ||
<h:title>this-title-has-dashes</h:title> | ||
<model> | ||
<instance> | ||
<data id="this-id-has-dashes"> | ||
<some-field/> | ||
<meta> | ||
<instanceID/> | ||
</meta> | ||
</data> | ||
</instance> | ||
<bind nodeset="/data/some-field" type="string"/> | ||
<bind calculate="concat('uuid:', uuid())" nodeset="/data/meta/instanceID" readonly="true()" type="string"/> | ||
</model> | ||
</h:head> | ||
<h:body> | ||
<input ref="/data/some-field"> | ||
<label>Some field</label> | ||
</input> | ||
</h:body> | ||
</h:html> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s make the world a better place by not saying dash when we mean hyphen.
hyphen: -
en dash: –
em dash: —
your character: -. Yup, it’s a hyphen. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL that dashes are not hyphens :D