public void GetSQLResourceTest() { string expected = "Test Resource"; string actual = Database_Accessor.GetSQLResource("PhotoWeaselDatabase.SQL.TestResource.txt"); Assert.AreEqual(expected, actual); }
public void GetSQLResourceFailTest() { Database_Accessor.GetSQLResource("IDoNotExist"); }
IEnumerator Init() { //set T1 for timing Init; t1 = Time.time; // Disable screen dimming Screen.sleepTimeout = SleepTimeout.NeverSleep; UIB_PlatformManager.Init(); try { UAP_AccessibilityManager.PauseAccessibility(true); } catch (Exception e) { if (e.GetType() == typeof(NullReferenceException)) { } } //this player pref should get set at app launch so that it resets the timecode in the audio-desc; PlayerPrefs.SetInt("desc_timecode", 0); try { percentText = GameObject.Find("DownloadPercent").GetComponent <TextMeshProUGUI>(); } catch (Exception e) { Debug.Log("Failed to find GameObject: " + e); yield break; } try { db_Manager = GameObject.Find("DB_Manager").GetComponent <HLD.Database_Accessor>(); } catch (Exception e) { Debug.Log("No database manager" + e); yield break; } db_Manager.Init(); try { blankPage = GameObject.Find("BlankPage"); } catch (Exception e) { Debug.Log("No blankpage " + e); yield break; } try { aspectManager = GameObject.FindGameObjectWithTag("MainCanvas"); } catch (Exception e) { Debug.Log("no aspect ratio manager " + e); yield break; } try { AccessibilityInstructions = GameObject.Find("AccessibleInstructions_Button"); } catch (Exception e) { Debug.Log("no instructions " + e); yield break; } //this coroutine checks the local files and starts any necessary downloads StartCoroutine("CheckLocalFiles"); //this coroutine continously checks if we have wifi and downloads are happening //it updates the download icon accordingly StartCoroutine("CheckWifiAndDownloads"); //this coroutine updates download percentage over time StartCoroutine("UpdateDownloadPercent"); //this coroutine waits until we have checked for all the files //then it begins loading asset bundles in the background //it must be started after pages have initialized StartCoroutine("ManageAssetBundleFiles"); //setup checks for accessibility on android - which is wierd; #if UNITY_ANDROID && !UNITY_EDITOR Debug.Log("checking accessibility " + UAP_AccessibilityManager.GetAndroidAccessibility()); if (UAP_AccessibilityManager.GetAndroidAccessibility()) { Debug.Log("Accessibility ON"); UAP_AccessibilityManager.EnableAccessibility(true); } else { Debug.Log("Accessibility OFF"); UAP_AccessibilityManager.EnableAccessibility(false); } #endif //Set the main page container //Can't remember why i did this UIB_PageContainer MainContainer = null; foreach (UIB_PageContainer PageContainer in GetComponentsInChildren <UIB_PageContainer>()) { MainContainer = PageContainer; MainContainer.Init(); } //set scroll rects to top foreach (Scrollbar sb in GetComponentsInChildren <Scrollbar>()) { sb.value = 1; } //turn aspect ratio fitters on //causes all pages to share origin with canvas and be correct dimensions foreach (AspectRatioFitter arf in GetComponentsInChildren <AspectRatioFitter>()) { arf.aspectRatio = (UIB_AspectRatioManager.ScreenWidth) / (UIB_AspectRatioManager.ScreenHeight); arf.aspectMode = AspectRatioFitter.AspectMode.FitInParent; arf.enabled = true; } //initialize each button foreach (UI_Builder.UIB_Button ab in GetComponentsInChildren <UI_Builder.UIB_Button>()) { //before initializing buttons, we may change some names based on player_prefs if (ab.name == "Displayed-Code_Button") { CheckAndUpdateLinks("Displayed-Info_Page"); } if (ab.name == "OnDisplay-Code_Button") { CheckAndUpdateLinks("OnDisplay-Info_Page"); } if (ab.name == "Unfinished-Code_Button") { CheckAndUpdateLinks("Unfinished-Info_Page"); } if (ab.name == "SoloFlight-Code_Button") { CheckAndUpdateLinks("SoloFlight-Info_Page"); } ab.Init(); } //initialize objects in the object pools //todo:tag this for eventual replacement with better pages/buttons ObjPoolManager.Init(); ObjPoolManager.RefreshPool(); //initialize each page foreach (UIB_IPage p in GetComponentsInChildren <UIB_IPage>()) { p.Init(); } //initialize companty dancers page //TODO: might not need this foreach (CompanyDancers_Page p in GetComponentsInChildren <CompanyDancers_Page>()) { p.Init(); } foreach (UIB_Page p in GetComponentsInChildren <UIB_Page>()) { //TODO:Fix this bad bad shit if (p.gameObject.name == "Landing_Page") { yield return(p.MoveScreenOut(true)); } else { p.StartCoroutine("MoveScreenOut", true); } } //initialize each scrolling menu foreach (UIB_ScrollingMenu uibSM in GetComponentsInChildren <UIB_ScrollingMenu>()) { uibSM.Init(); } //setup the first screen var firstScreen = GameObject.Find("Landing_Page"); yield return(firstScreen.GetComponent <UIB_Page>().StartCoroutine("MoveScreenIn", true)); if (UAP_AccessibilityManager.IsEnabled()) { //unpause accessibility manger to read first button UAP_AccessibilityManager.PauseAccessibility(false); if (UAP_AccessibilityManager.IsActive()) { // AccessibilityInstructions.SetActive(true); } else { } //select the first button with UAP var first = GameObject.Find("DISPLAYED-Code_Button"); UAP_AccessibilityManager.SelectElement(first, true);; } //remove the cover MainContainer.DisableCover(); //if we finish initializing faster than expected, take a moment to finish the video t2 = Time.time; var elapsed = t2 - t1; if (InitializeTime > elapsed) { yield return(new WaitForSeconds(InitializeTime - elapsed)); } else if (Mathf.Approximately(InitializeTime, float.Epsilon)) { Debug.Log("took " + elapsed + "s to initialize"); } else { Debug.LogWarning("Took longer to initialize than expected"); } yield break; }