-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workingDir: If creating files is not possible in this directory (for …
…example requires admin permissions) this is set to userDir.
- Loading branch information
1 parent
f2ac228
commit 4ea155f
Showing
3 changed files
with
78 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.osiris.desku.bugs; | ||
|
||
import com.osiris.desku.App; | ||
import com.osiris.desku.TApp; | ||
import com.osiris.desku.ui.Component; | ||
import com.osiris.desku.ui.UI; | ||
import com.osiris.desku.ui.display.Text; | ||
import com.osiris.desku.ui.layout.Vertical; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class AdminWorkingDir { | ||
|
||
@Test | ||
void test() throws Throwable { | ||
System.setProperty("user.dir", "C:\\Program Files"); | ||
TApp.testAndAwaitResult((asyncResult) -> { | ||
String txtDefValue = "Hello!"; | ||
Text txt = new Text(txtDefValue); | ||
|
||
assertEquals(App.workingDir, App.userDir); | ||
|
||
return new Vertical() | ||
.add(txt) | ||
.later(__ -> { | ||
try{ | ||
while(UI.get().isLoading()) Thread.yield(); // Wait to ensure not the internal value is directly returned | ||
// but instead the value is returned from the frontend HTML value attribute of the component. | ||
} catch (Throwable e) { | ||
asyncResult.refEx.set(e); | ||
} finally { | ||
asyncResult.isDone.set(true); | ||
} | ||
}); | ||
}); | ||
|
||
} | ||
} |