Fix black screen error of ElmSharp.Test 69/109669/1
authorWonYoung Choi <wy80.choi@samsung.com>
Wed, 11 Jan 2017 06:26:01 +0000 (15:26 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Wed, 11 Jan 2017 06:26:01 +0000 (15:26 +0900)
When ElmSharp.Test runs with AppFW, first screen was black because
Elementary.ThemeOverlay() was not called.

Change-Id: I725a3ad97f1b1bf10ee43472e7817491de49346f

ElmSharp.Test/TestRunner.cs

index b359d20..b59f07f 100644 (file)
@@ -27,11 +27,13 @@ namespace ElmSharp.Test
     public class TestRunner : CoreUIApplication
     {
         private Window _firstPageWindow;
+        private static bool s_terminated;
 
         public static string ResourceDir { get; private set; }
 
         public TestRunner()
         {
+            s_terminated = false;
         }
 
         protected override void OnCreate()
@@ -43,13 +45,16 @@ namespace ElmSharp.Test
             base.OnCreate();
         }
 
+        protected override void OnTerminate()
+        {
+            s_terminated = true;
+            base.OnTerminate();
+        }
+
         public void RunStandalone(string[] args)
         {
             ResourceDir = Path.Combine(Path.GetDirectoryName(typeof(TestRunner).GetTypeInfo().Assembly.Location), "res");
 
-            Elementary.Initialize();
-            Elementary.ThemeOverlay();
-
             EcoreSynchronizationContext.Initialize();
 
             var testCases = GetTestCases();
@@ -193,11 +198,17 @@ namespace ElmSharp.Test
 
         static void Main(string[] args)
         {
+            Elementary.Initialize();
+            Elementary.ThemeOverlay();
+
             TestRunner testRunner = new TestRunner();
             testRunner.Run(args);
 
             // if running with appfw is failed, below line will be executed.
-            testRunner.RunStandalone(args);
+            if (!s_terminated)
+            {
+                testRunner.RunStandalone(args);
+            }
         }
     }
 }