-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add PlayModeTest task * Update readme
- Loading branch information
Showing
8 changed files
with
212 additions
and
20 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
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
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
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
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
41 changes: 41 additions & 0 deletions
41
src/main/groovy/wooga/gradle/unity/utils/ProjectSettings.groovy
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,41 @@ | ||
/* | ||
* Copyright 2017 Wooga GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
|
||
|
||
package wooga.gradle.unity.utils | ||
|
||
import org.yaml.snakeyaml.Yaml | ||
|
||
class ProjectSettings { | ||
|
||
private def content | ||
|
||
ProjectSettings(File projectSettingsFile) { | ||
this(projectSettingsFile.text) | ||
} | ||
|
||
ProjectSettings(String templateContent) { | ||
|
||
Yaml parser = new Yaml() | ||
content = parser.load(templateContent) | ||
} | ||
|
||
boolean getPlayModeTestRunnerEnabled() { | ||
content['PlayerSettings'] && content['PlayerSettings']['playModeTestRunnerEnabled'] && content['PlayerSettings']['playModeTestRunnerEnabled'] == 1 | ||
} | ||
} |
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
71 changes: 71 additions & 0 deletions
71
src/test/groovy/wooga/gradle/unity/utils/ProjectSettingsSpec.groovy
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,71 @@ | ||
package wooga.gradle.unity.utils | ||
|
||
import spock.lang.Specification | ||
import spock.lang.Shared | ||
import spock.lang.Unroll | ||
|
||
class ProjectSettingsSpec extends Specification { | ||
|
||
static String TEMPLATE_CONTENT = """ | ||
PlayerSettings: | ||
wiiUDrcBufferDisabled: 0 | ||
wiiUProfilerLibPath: | ||
playModeTestRunnerEnabled: 0 | ||
actionOnDotNetUnhandledException: 1 | ||
""" | ||
|
||
static String TEMPLATE_CONTENT_ENABLED = """ | ||
PlayerSettings: | ||
wiiUDrcBufferDisabled: 0 | ||
wiiUProfilerLibPath: | ||
playModeTestRunnerEnabled: 1 | ||
actionOnDotNetUnhandledException: 1 | ||
""" | ||
|
||
@Shared | ||
File templateFile = File.createTempFile("ProjectSettings", ".asset") | ||
|
||
@Unroll | ||
def "initialize with #objectType"() { | ||
expect: | ||
new ProjectSettings(content) | ||
|
||
where: | ||
objectType | content | ||
"String" | TEMPLATE_CONTENT | ||
"File" | templateFile << TEMPLATE_CONTENT | ||
} | ||
|
||
@Unroll | ||
def "parse playModeTestRunnerDisabled with #objectType"() { | ||
when: | ||
def settings =new ProjectSettings(content) | ||
|
||
then: | ||
!settings.playModeTestRunnerEnabled | ||
|
||
where: | ||
objectType | content | ||
"String" | TEMPLATE_CONTENT | ||
"File" | templateFile << TEMPLATE_CONTENT | ||
} | ||
|
||
@Unroll | ||
def "parse playModeTestRunnerEnabled with #objectType"() { | ||
when: | ||
def settings =new ProjectSettings(content) | ||
|
||
then: | ||
settings.playModeTestRunnerEnabled | ||
|
||
where: | ||
objectType | content | ||
"String" | TEMPLATE_CONTENT_ENABLED | ||
"File" | templateFile << TEMPLATE_CONTENT_ENABLED | ||
} | ||
|
||
} |