Beispiel #1
0
        public void TestODH()
        {
            TestableDOH odh = new TestableDOH();

            SciterWindow wnd = new SciterWindow();

            wnd.CreateMainWindow(1500, 800);
            wnd.Title = "Wtf";
            bool res = wnd.LoadHtml(@"
<html>
<style>
	body { wtf: 123; }
</style>

<script type='text/tiscript'>
</script>
</html>
");

            Assert.IsTrue(res);

            PInvokeWindows.MSG msg;
            while (PInvokeWindows.GetMessage(out msg, IntPtr.Zero, 0, 0) != 0)
            {
                wnd.Show();
                PInvokeWindows.TranslateMessage(ref msg);
                PInvokeWindows.DispatchMessage(ref msg);
            }

            Assert.IsTrue(odh.msgs.Count == 1);
        }
        protected override HandleRef BuildWindowCore(HandleRef hwndParent)
        {
            _wnd = new SciterWindow();
            _wnd.CreateChildWindow(hwndParent.Handle);
            _wnd.LoadHtml("<style>html { background: silver; }</style> <h1>Hello world!</h1>");

            return(new HandleRef(this, _wnd._hwnd));
        }
Beispiel #3
0
        public void TestThings()
        {
            SciterWindow window =
                new SciterWindow()
                .CreateMainWindow(640, 480)
                .SetTitle("Wtf");

            _ = new TestableSciterHost(window);
            window.LoadHtml("<html></html>");

            var sv = window.EvalScript("Utils.readStreamToEnd");

            Assert.IsTrue(!sv.IsUndefined);
        }
Beispiel #4
0
        public void TestThings()
        {
            SciterWindow wnd = new SciterWindow();

            wnd.CreateMainWindow(1500, 800);
            wnd.Title = "Wtf";

            SciterHost host = new SciterHost(wnd);

            wnd.LoadHtml("<html></html>");

            var sv = wnd.EvalScript("Utils.readStreamToEnd");

            Assert.IsTrue(!sv.IsUndefined);
        }
        public void Setup()
        {
            _sciterWindow =
                new SciterWindow()
                .CreateMainWindow(320, 240)
                //.CenterTopLevelWindow()
                .SetTitle(nameof(SciterGraphicsTests));

            var pageData = "<html><head><style>" +
                           "html {" +
                           //"background: black;" +
                           //"behavior: draw-content;" +
                           "}" +
                           "</style></head></html>";

            _sciterWindow.LoadHtml(pageData);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            // TODO: think Andrew corrected child window creation

            PInvokeWindows.OleInitialize(IntPtr.Zero);

            // Create the window
            var wnd = new SciterWindow();

            //wnd.CreateMainWindowNative(1500, 800);
            wnd.CreateMainWindow(1500, 800);
            //wnd.EnableDwmClientArea();

            SciterWindow wnd_popup = new SciterWindow();

            wnd_popup.CreatePopupAlphaWindow(400, 400, wnd._hwnd);

            //wnd.CenterTopLevelWindow();
            //wnd.AfterWindowCreate();
            //wnd.Title = "Sciter Bootstrap";

            // Prepares SciterHost and then load the page
            var host = new Host();

            host.SetupWindow(wnd);
            host.AttachEvh(new HostEvh());
            host.SetupPage("index.html");

            // get the page <body>
            var se_body = wnd.RootElement.SelectFirst("body");

            // append a <h1> header to it
            se_body.TransformHTML("<h1>Wow, this header was created natively!</h1>", SciterXDom.SET_ELEMENT_HTML.SIH_INSERT_AT_START);

            // set <h1> color to blue
            se_body[0].SetStyle("color", "#00F");


            // Show window and Run message loop
            wnd.Show();
            wnd_popup.LoadHtml("<html><body><style>html { background: red; }</style></body></html>");
            wnd_popup.Show();
            PInvokeUtils.RunMsgLoop();
        }
Beispiel #7
0
        protected override HandleRef BuildWindowCore(HandleRef hwndParent)
        {
            _wnd = new SciterWindow();
            _wnd.CreateChildWindow(hwndParent.Handle);

            // Create the SciterHost to handle window-level events
            _host = new Host(_wnd);

            // Load the HTML
            _wnd.LoadHtml(@"
<script type='text/tiscript'>
	$(h1).text = view.Host_Msg();
</script>

<h1 style='color: blue' />
");

            return(new HandleRef(this, _wnd._hwnd));
        }
Beispiel #8
0
        public void Setup()
        {
            _sciterWindow =
                new SciterWindow()
                .CreateMainWindow(320, 240)
                //.CenterWindow()
                .SetTitle(nameof(SciterGraphicsTests));

            var pageData = "<html><head><style>" +
                           "html {" +
                           //"background: black;" +
                           //"behavior: draw-content;" +
                           "}" +
                           "</style></head></html>";


            _sciterWindow.LoadHtml(pageData);

            _mockBehaviorResolver = new Mock <INamedBehaviorResolver>();

            _mockBehaviorResolver
            .Setup(resolver => resolver.ContainsKey(It.IsAny <string>()))
            .Returns(true);
        }