Skip to content

Commit

Permalink
Fixes for imgDirectory and initial watcher onContextCreate call
Browse files Browse the repository at this point in the history
  • Loading branch information
Hotzkow committed Sep 2, 2019
1 parent e75a27e commit 09c7171
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ object ExplorationAPI {
* Consequently the list of selectors is empty by default and if no watcher is specified the features listed in
* [defaultReporter] are going to be used.
*/
suspend fun<M:AbstractModel<S,W>, S: State<W>,W: Widget> explore(
@JvmOverloads suspend fun<M:AbstractModel<S,W>, S: State<W>,W: Widget> explore(
cfg: ConfigurationWrapper,
strategies: List<AExplorationStrategy>,
selectors: List<AStrategySelector> = emptyList(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class ExplorationContext<M,S,W> @JvmOverloads constructor(val cfg: Configuration
init {
debugOutput = model.config[debugMode] // disable debug outputs if not in debug mode
measurePerformance = model.config[debugMode]
watcher.forEach { w -> if(w is ModelFeature) w.onAppExplorationStarted(this) }
if (model.config[enableCoverage]){
val coverageDir = Paths.get(cfg[ConfigProperties.Output.outputDir].path).toAbsolutePath().resolve(cfg[coverageDir]).toAbsolutePath()
val resourceDir = Paths.get(cfg[ConfigProperties.Output.outputDir].path).toAbsolutePath().resolve(EnvironmentConstants.dir_name_temp_extracted_resources).toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,23 @@ import java.awt.Color
import java.awt.Font
import java.awt.Graphics
import java.io.File
import java.nio.file.Path
import javax.imageio.ImageIO

val log: Logger = getLogger("ImageUtils")
suspend fun showTargetsInImg(eContext: ExplorationContext<*,*,*>, toBeHighlighted: List<Widget>, imgFile: File, autoGenScreen: Boolean = true) {
suspend fun showTargetsInImg(
eContext: ExplorationContext<*,*,*>,
toBeHighlighted: List<Widget>,
imgFile: File, autoGenScreen: Boolean = true,
imgSrcDir: Path = eContext.model.config.imgDst
) {
withContext(Dispatchers.IO) {
val trace = eContext.explorationTrace
// wait until file was pulled from device (done in ExploreCommand)
eContext.imgTransfer.coroutineContext[Job]?.children?.forEach { it.join() }

val filePath = if(autoGenScreen)
eContext.model.config.imgDst.resolve("${trace.last()?.actionId}.jpg").toString()
imgSrcDir.resolve("${trace.last()?.actionId}.jpg").toString()
// the ExtendedTrace did not yet finish to move/ copy the file to the new location
//trace.dstImgDir.resolve("${trace.interactions}.jpg").toString()
else ""
Expand Down

0 comments on commit 09c7171

Please sign in to comment.