1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
<title>Test file</title>
5
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
<script src="../js/js/utils.js"></script>
7
<script src="../js/js/testplugin.js"></script>
11
<script type="text/xaml" id="xaml0">
12
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
13
Name="C0" Height="800" Width="800" Background="Green" >
17
<script type="text/xaml" id="xaml1">
18
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
19
Name="C1" Height="800" Width="800" Background="Green"
20
GotFocus="OnGotFocus" LostFocus="OnLostFocus" KeyDown="OnKeyDown" KeyUp="OnKeyUp" >
24
<script type="text/xaml" id="xaml2">
25
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
26
Name="C2" Height="800" Width="800" Background="Red" >
27
<Canvas GotFocus="Dummy" />
31
<script type="text/xaml" id="xaml3">
32
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
Name="C3" Height="800" Width="800" Background="Red" >
34
<Canvas LostFocus="Dummy" />
38
<script type="text/xaml" id="xaml4">
39
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
40
Name="C4" Height="800" Width="800" Background="Red" >
41
<Canvas KeyDown="Dummy" />
45
<script type="text/xaml" id="xaml5">
46
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
47
Name="C5" Height="800" Width="800" Background="Red" >
48
<Canvas KeyUp="Dummy" />
52
<script type="text/javascript">
55
// It's only possible to attach event handlers for GotFocus, LostFocus, KeyUp and KeyDown on the root canvas.
60
'<Canvas GotFocus="Dummy" />',
61
'<Canvas LostFocus="Dummy" />',
62
'<Canvas KeyDown="Dummy" />',
63
'<Canvas KeyUp="Dummy" />'
66
'<embed type="application/x-silverlight" width="20" height="20" id="TF0" Source="#xaml0" OnError="OnPluginError" OnLoad="OnPluginLoaded" background="Red"></embed>',
67
'<embed type="application/x-silverlight" width="20" height="20" id="TF1" Source="#xaml1" OnError="OnPluginError" OnLoad="OnPluginLoaded" background="Red"></embed>',
68
'<embed type="application/x-silverlight" width="20" height="20" id="TF2" Source="#xaml2" OnError="OnPluginError" OnLoad="OnPluginLoaded" background="Green"></embed>',
69
'<embed type="application/x-silverlight" width="20" height="20" id="TF3" Source="#xaml3" OnError="OnPluginError" OnLoad="OnPluginLoaded" background="Green"></embed>',
70
'<embed type="application/x-silverlight" width="20" height="20" id="TF2" Source="#xaml4" OnError="OnPluginError" OnLoad="OnPluginLoaded" background="Green"></embed>',
71
'<embed type="application/x-silverlight" width="20" height="20" id="TF3" Source="#xaml5" OnError="OnPluginError" OnLoad="OnPluginLoaded" background="Green"></embed>'
74
true, true, false, false, false, false
77
function DoCreateXamlTests ()
79
var plugin = document.getElementById ("TF0");
80
var top = plugin.content.findName ("C0");
83
TestLogger.LogDebug ("DoCreateXamlFragments, trying to load " + xamls.length + " fragments");
85
for (var i = 0; i < xamls.length; i++) {
89
obj = plugin.content.createFromXaml (xamls [i]);
92
TestLogger.LogError ("Couldn't create xaml fragment #" + i + ": " + e);
95
top.Children.Add (obj);
97
TestLogger.LogError ("Was able to add xaml fragment #" + i + " to top level canvas, this should have caused an exception.");
101
TestLogger.LogDebug ("Exception (as expected) while adding xaml fragment: " + e);
109
if (index >= embeds.length) {
110
TestLogger.LogResult (failed ? -1 : 1);
115
document.getElementById ("testdiv" + index).innerHTML = embeds [index];
119
function OnPluginError (sender, args)
121
TestLogger.LogDebug ("OnPluginError: " + ErrorEventArgsToOneLineString (args));
122
if (results [index]) {
124
TestLogger.LogError ("Xaml #" + index + " should not fail.");
129
function OnPluginLoaded (sender, args)
131
TestLogger.LogDebug ("OnPluginLoaded: " + sender);
132
if (!results [index]) {
134
TestLogger.LogError ("Xaml #" + index + " should fail.");
137
DoCreateXamlTests ();
144
setTimeout (NextTest, 500);
147
<div id="testdiv0"></div><div style="height:2px"></div>
148
<div id="testdiv1"></div><div style="height:2px"></div>
149
<div id="testdiv2"></div><div style="height:2px"></div>
150
<div id="testdiv3"></div><div style="height:2px"></div>
151
<div id="testdiv4"></div><div style="height:2px"></div>
152
<div id="testdiv5"></div><div style="height:2px"></div>
157
<embed id="_TestPlugin" width="0" height="0" type="application/x-jolttest"