How to use pc method in wpt

Best JavaScript code snippet using wpt

pcSample.js

Source:pcSample.js Github

copy

Full Screen

1define(function(require) {2 //grid3 require("w!$UI/demo/pcSample/grid/additionalRow.w");4 require("w!$UI/demo/pcSample/grid/bigData.w");5 require("w!$UI/demo/pcSample/grid/contentFormatting.w");6 require("w!$UI/demo/pcSample/grid/controlScrollbar.w");7 require("w!$UI/demo/pcSample/grid/customStyle.w");8 require("w!$UI/demo/pcSample/grid/dataSummarization.w");9 require("w!$UI/demo/pcSample/grid/doubleSelection.w");10 require("w!$UI/demo/pcSample/grid/doubleSelectionTransverse.w");11 require("w!$UI/demo/pcSample/grid/doubleSelectionVetical.w");12 require("w!$UI/demo/pcSample/grid/dynamicOperation.w");13 require("w!$UI/demo/pcSample/grid/dynamicSelect.w");14 require("w!$UI/demo/pcSample/grid/dynamicURL.w");15 require("w!$UI/demo/pcSample/grid/frozenColumn.w");16 require("w!$UI/demo/pcSample/grid/grouping-widthAdaptive.w");17 require("w!$UI/demo/pcSample/grid/grouping.w");18 require("w!$UI/demo/pcSample/grid/headerFilter.w");19 require("w!$UI/demo/pcSample/grid/grid/hideXscrollbar.w");20 require("w!$UI/demo/pcSample/grid/masterDetail-operate.w");21 require("w!$UI/demo/pcSample/grid/masterDetail.w");22 require("w!$UI/demo/pcSample/grid/mutiHeaders.w");23 require("w!$UI/demo/pcSample/grid/pagingMemory.w");24 require("w!$UI/demo/pcSample/grid/popupGrid.w");25 require("w!$UI/demo/pcSample/grid/rowRendering.w");26 require("w!$UI/demo/pcSample/grid/switchingGrid.w");27 require("w!$UI/demo/pcSample/grid/toolbarControl.w");28 require("w!$UI/demo/pcSample/grid/treeGrid-onceloading.w");29 require("w!$UI/demo/pcSample/grid/treeGrid-personalSetting.w");30 require("w!$UI/demo/pcSample/grid/treeGrid.w");31 //forms32 require("w!$UI/demo/pcSample/forms/asynchEdit.w");33 require("w!$UI/demo/pcSample/forms/asynchronous.w");34 require("w!$UI/demo/pcSample/forms/synchEdit.w");35 require("w!$UI/demo/pcSample/forms/Synchronous.w");36 require("w!$UI/demo/pcSample/forms/dynamicForm.w");37 require("w!$UI/demo/pcSample/forms/formDisable.w");38 require("w!$UI/demo/pcSample/forms/formElement.w");39 require("w!$UI/demo/pcSample/forms/formLayout.w");40 require("w!$UI/demo/pcSample/forms/formMode.w");41 require("w!$UI/demo/pcSample/forms/formSplit.w");42 require("w!$UI/demo/pcSample/forms/formTest.w");43 require("w!$UI/demo/pcSample/forms/responseLayout.w");44 //text45 require("w!$UI/demo/pcSample/text/articleList.w");46 require("w!$UI/demo/pcSample/text/changeColor.w");47 require("w!$UI/demo/pcSample/text/cutout.w");48 require("w!$UI/demo/pcSample/text/listeningTextChange.w");49 require("w!$UI/demo/pcSample/text/roll.w");50 //table51 require("w!$UI/demo/pcSample/table/basic/basic.w");52 require("w!$UI/demo/pcSample/table/basic/basictwo.w");53 require("w!$UI/demo/pcSample/table/basic/basicthree.w");54 require("w!$UI/demo/pcSample/table/basic/basicfour.w");55 require("w!$UI/demo/pcSample/table/basic/basicfive.w");56 require("w!$UI/demo/pcSample/table/basic/basicsix.w");57 require("w!$UI/demo/pcSample/table/basic/basicseven.w");58 require("w!$UI/demo/pcSample/table/basic/basiceight.w");59 require("w!$UI/demo/pcSample/table/basic/basicnine.w");60 require("w!$UI/demo/pcSample/table/basic/basicten.w");61 require("w!$UI/demo/pcSample/table/basic/basiceleven.w");62 require("w!$UI/demo/pcSample/table/basic/basictwelve.w");63 require("w!$UI/demo/pcSample/table/basic/basicthirteen.w");64 require("w!$UI/demo/pcSample/table/basic/basicfourteen.w");65 require("w!$UI/demo/pcSample/table/basic/basicfifteen.w");66 require("w!$UI/demo/pcSample/table/basic/basicsixteen.w");67 require("w!$UI/demo/pcSample/table/tableTemplate/tableTemplate.w");68 require("w!$UI/demo/pcSample/table/scrollX/scrollX.w");69 require("w!$UI/demo/pcSample/table/widowsDialog/windowsDialog.w");70 require("w!$UI/demo/pcSample/table/dynamicCreate/dynamicCreate.w");71 require("w!$UI/demo/pcSample/table/informationHint/informationHint.w");72 require("w!$UI/demo/pcSample/table/fatherAndSon/nestedTable.w");73 require("w!$UI/demo/pcSample/table/");74 require("w!$UI/demo/pcSample/table/");75 require("w!$UI/demo/pcSample/table/");76 require("w!$UI/demo/pcSample/table/");77 //form-element78 require("w!$UI/demo/pcSample/form-element/button.w");79 require("w!$UI/demo/pcSample/form-element/radio.w");80 require("w!$UI/demo/pcSample/form-element/checkBox.w");81 require("w!$UI/demo/pcSample/form-element/checkBox.w");82 require("w!$UI/demo/pcSample/form-element/select.w");83 require("w!$UI/demo/pcSample/form-element/fileUploadDown.w");84 require("w!$UI/demo/pcSample/form-element/fileUploadDown.w");85 require("w!$UI/demo/pcSample/form-element/filterConditionOne.w");86 require("w!$UI/demo/pcSample/form-element/filterConditionTwo.w");87 require("w!$UI/demo/pcSample/form-element/filterConditionThree.w");88 require("w!$UI/demo/pcSample/form-element/filterConditionFour.w");89 require("w!$UI/demo/pcSample/form-element/filterConditionFive.w");90 require("w!$UI/demo/pcSample/form-element/filterConditionSix.w");91 require("w!$UI/demo/pcSample/form-element/filterConditionSeven.w");92 require("w!$UI/demo/pcSample/form-element/filterConditionEight.w");93 require("w!$UI/demo/pcSample/form-element/starComment.w");94 require("w!$UI/demo/pcSample/form-element/text-box.w");95 require("w!$UI/demo/pcSample/form-element/textarea.w");96 //navigator97 require("w!$UI/demo/pcSample/navigator/basic-2.w");98 require("w!$UI/demo/pcSample/navigator/basic-flow.w");99 require("w!$UI/demo/pcSample/navigator/basic-staticFlow.w");100 require("w!$UI/demo/pcSample/navigator/Basic.w");101 require("w!$UI/demo/pcSample/navigator/digitalPaging.w");102 require("w!$UI/demo/pcSample/navigator/drawer.w");103 require("w!$UI/demo/pcSample/navigator/dynamicTAB.w");104 require("w!$UI/demo/pcSample/navigator/gridLine.w");105 require("w!$UI/demo/pcSample/navigator/iconKit.w");106 require("w!$UI/demo/pcSample/navigator/iconNav.w");107 require("w!$UI/demo/pcSample/navigator/popupMenu.w");108 require("w!$UI/demo/pcSample/navigator/toolbar.w");109 //layout110 require("w!$UI/demo/pcSample/layout/cross_navigation_flow.w");111 require("w!$UI/demo/pcSample/layout/cross_navigation_slide.w");112 require("w!$UI/demo/pcSample/layout/cross_navigation_tab.w");113 require("w!$UI/demo/pcSample/layout/cross_navigation1.w");114 require("w!$UI/demo/pcSample/layout/cross_vertical.w");115 require("w!$UI/demo/pcSample/layout/dic_maintenance.w");116 require("w!$UI/demo/pcSample/layout/dictionary_maintenance.w");117 require("w!$UI/demo/pcSample/layout/hint_user_card.w");118 require("w!$UI/demo/pcSample/layout/homepage_information_tab1.w");119 require("w!$UI/demo/pcSample/layout/homepage_information_tab2.w");120 require("w!$UI/demo/pcSample/layout/homepage_Sudoku.w");121 require("w!$UI/demo/pcSample/layout/local_rolling.w");122 require("w!$UI/demo/pcSample/layout/resource_distribute_role.w");123 require("w!$UI/demo/pcSample/layout/resource_distribute_user.w");124 require("w!$UI/demo/pcSample/layout/role_manage.w");125 require("w!$UI/demo/pcSample/layout/user_manage.w");126 require("w!$UI/demo/pcSample/layout/table_Echarts.w");127 require("w!$UI/demo/pcSample/layout/vertical_navigation_group.w");128 require("w!$UI/demo/pcSample/layout/vertical_navigation_link.w");129 require("w!$UI/demo/pcSample/layout/vertical_navigation_list.w");130 require("w!$UI/demo/pcSample/layout/vertical_navigation_slide.w");131 require("w!$UI/demo/pcSample/layout/vertical_tipwizard.w");132 133 return {134 "$children" : [{135 "$children" : [{136 "$name" : "item",137 "$text" : "",138 "display" : "solid",139 "label" : "表格跨列附加行",140 "psmCount" : "1",141 "url" : "$UI/demo/pcSample/grid/additionalRow.w"142 },{143 "$name" : "item",144 "$text" : "",145 "display" : "solid",146 "label" : "大数据测试",147 "psmCount" : "1",148 "url" : "$UI/demo/pcSample/grid/bigData.w"149 },{150 "$name" : "item",151 "$text" : "",152 "display" : "solid",153 "label" : "内容格式化",154 "psmCount" : "1",155 "url" : "$UI/demo/pcSample/grid/contentFormatting.w"156 },{157 "$name" : "item",158 "$text" : "",159 "display" : "solid",160 "label" : "控制滚动条",161 "psmCount" : "1",162 "url" : "$UI/demo/pcSample/grid/controlScrollbar.w"163 },{164 "$name" : "item",165 "$text" : "",166 "display" : "solid",167 "label" : "个性化样式",168 "psmCount" : "1",169 "url" : "$UI/demo/pcSample/grid/customStyle.w"170 }, {171 "$name" : "item",172 "$text" : "",173 "display" : "solid",174 "label" : "数据汇总",175 "psmCount" : "1",176 "url" : "$UI/demo/pcSample/grid/dataSummarization.w"177 },{178 "$name" : "item",179 "$text" : "",180 "display" : "solid",181 "label" : "双向选择器",182 "psmCount" : "1",183 "url" : "$UI/demo/pcSample/grid/doubleSelection.w"184 },{185 "$name" : "item",186 "$text" : "",187 "display" : "solid",188 "label" : "双向选择器(横向铺满)",189 "psmCount" : "1",190 "url" : "$UI/demo/pcSample/grid/doubleSelectionTransverse.w"191 }, {192 "$name" : "item",193 "$text" : "",194 "display" : "solid",195 "label" : "双向选择器(纵向铺满)",196 "psmCount" : "1",197 "url" : "$UI/demo/pcSample/grid/doubleSelectionVetical.w"198 }, {199 "$name" : "item",200 "$text" : "",201 "display" : "solid",202 "label" : "动态表格操作",203 "psmCount" : "1",204 "url" : "$UI/demo/pcSample/grid/dynamicOperation.w"205 }, {206 "$name" : "item",207 "$text" : "",208 "display" : "solid",209 "label" : "动态选择",210 "psmCount" : "1",211 "url" : "$UI/demo/pcSample/grid/dynamicSelect.w"212 }, {213 "$name" : "item",214 "$text" : "",215 "display" : "solid",216 "label" : "动态设置URL",217 "psmCount" : "1",218 "url" : "$UI/demo/pcSample/grid/dynamicURL.w"219 }, {220 "$name" : "item",221 "$text" : "",222 "display" : "solid",223 "label" : "冻结列",224 "psmCount" : "1",225 "url" : "$UI/demo/pcSample/grid/frozenColumn.w"226 }, {227 "$name" : "item",228 "$text" : "",229 "display" : "solid",230 "label" : "分组表格(宽度自适应)",231 "psmCount" : "1",232 "url" : "$UI/demo/pcSample/grid/grouping-widthAdaptive.w"233 }, {234 "$name" : "item",235 "$text" : "",236 "display" : "solid",237 "label" : "分组表格",238 "psmCount" : "1",239 "url" : "$UI/demo/pcSample/grid/grouping.w"240 } ,{241 "$name" : "item",242 "$text" : "",243 "display" : "solid",244 "label" : "表头过滤",245 "psmCount" : "1",246 "url" : "$UI/demo/pcSample/grid/headerFilter.w"247 },{248 "$name" : "item",249 "$text" : "",250 "display" : "solid",251 "label" : "不显示横向滚动条",252 "psmCount" : "1",253 "url" : "$UI/demo/pcSample/grid/hideXscrollbar.w"254 },{255 "$name" : "item",256 "$text" : "",257 "display" : "solid",258 "label" : "主从表格操作",259 "psmCount" : "1",260 "url" : "$UI/demo/pcSample/grid/masterDetail-operate.w"261 },{262 "$name" : "item",263 "$text" : "",264 "display" : "solid",265 "label" : "主从表格",266 "psmCount" : "1",267 "url" : "$UI/demo/pcSample/grid/masterDetail.w"268 },{269 "$name" : "item",270 "$text" : "",271 "display" : "solid",272 "label" : "多表头支持",273 "psmCount" : "1",274 "url" : "$UI/demo/pcSample/grid/mutiHeaders.w"275 },{276 "$name" : "item",277 "$text" : "",278 "display" : "solid",279 "label" : "选择项分页记忆",280 "psmCount" : "1",281 "url" : "$UI/demo/pcSample/grid/pagingMemory.w"282 },{283 "$name" : "item",284 "$text" : "",285 "display" : "solid",286 "label" : "弹窗中的表格",287 "psmCount" : "1",288 "url" : "$UI/demo/pcSample/grid/popupGrid.w"289 },{290 "$name" : "item",291 "$text" : "",292 "display" : "solid",293 "label" : "行列渲染",294 "psmCount" : "1",295 "url" : "$UI/demo/pcSample/grid/rowRendering.w"296 },{297 "$name" : "item",298 "$text" : "",299 "display" : "solid",300 "label" : "动态切换表格",301 "psmCount" : "1",302 "url" : "$UI/demo/pcSample/grid/switchingGrid.w"303 },{304 "$name" : "item",305 "$text" : "",306 "display" : "solid",307 "label" : "工具栏控制",308 "psmCount" : "1",309 "url" : "$UI/demo/pcSample/grid/toolbarControl.w"310 },{311 "$name" : "item",312 "$text" : "",313 "display" : "solid",314 "label" : "树形表格(一次加载)",315 "psmCount" : "1",316 "url" : "$UI/demo/pcSample/grid/treeGrid-onceloading.w"317 },{318 "$name" : "item",319 "$text" : "",320 "display" : "solid",321 "label" : "树形表格(个性化设置)",322 "psmCount" : "1",323 "url" : "$UI/demo/pcSample/grid/treeGrid-personalSetting.w"324 },{325 "$name" : "item",326 "$text" : "",327 "display" : "solid",328 "label" : "树形表格",329 "psmCount" : "1",330 "url" : "$UI/demo/pcSample/grid/treeGrid.w"331 }], 332 "$name" : "item",333 "$text" : "",334 "display" : "solid",335 "label" : "grid"336 }, {337 "$children" : [{338 "$name" : "item",339 "$text" : "",340 "display" : "solid",341 "label" : "异步编辑",342 "psmCount" : "1",343 "url" : "$UI/demo/pcSample/forms/asynchEdit.w"344 }, {345 "$name" : "item",346 "$text" : "",347 "display" : "solid",348 "label" : "异步提交",349 "psmCount" : "1",350 "url" : "$UI/demo/pcSample/forms/asynchronous.w"351 }, {352 "$name" : "item",353 "$text" : "",354 "display" : "solid",355 "label" : "同步编辑",356 "psmCount" : "1",357 "url" : "$UI/demo/pcSample/forms/synchEdit.w"358 }, {359 "$name" : "item",360 "$text" : "",361 "display" : "solid",362 "label" : "同步提交",363 "psmCount" : "1",364 "url" : "$UI/demo/pcSample/forms/Synchronous.w"365 /* scrollView在外卖等例子中已经体现366 }, {367 "$name" : "item",368 "$text" : "",369 "label" : "scrollView",370 "psmCount" : "1",371 "url" : "$UI/system/components/justep/scrollView/demo/list/demo.w"372 */373 }, {374 "$name" : "item",375 "$text" : "",376 "display" : "solid",377 "label" : "动态创建表订单并赋值",378 "psmCount" : "1",379 "url" : "$UI/demo/pcSample/forms/dynamicForm.w"380 }, {381 "$name" : "item",382 "$text" : "",383 "display" : "solid",384 "label" : "表单禁用",385 "psmCount" : "1",386 "url" : "$UI/demo/pcSample/forms/formDisable.w"387 }, {388 "$name" : "item",389 "$text" : "",390 "display" : "solid",391 "label" : "表单元素",392 "psmCount" : "1",393 "url" : "$UI/demo/pcSample/forms/formElement.w"394 }, {395 "$name" : "item",396 "$text" : "",397 "display" : "solid",398 "label" : "表单使用",399 "psmCount" : "1",400 "url" : "$UI/demo/pcSample/forms/formLayout.w"401 },{402 "$name" : "item",403 "$text" : "",404 "display" : "solid",405 "label" : "表单模型",406 "psmCount" : "1",407 "url" : "$UI/demo/pcSample/forms/formMode.w"408 },{409 "$name" : "item",410 "$text" : "",411 "display" : "solid",412 "label" : "表单拆分",413 "psmCount" : "1",414 "url" : "$UI/demo/pcSample/forms/formSplit.w"415 }, {416 "$name" : "item",417 "$text" : "",418 "label" : "表单验证",419 "psmCount" : "1",420 "url" : "$UI/demo/pcSample/forms/formTest.w"421 }, {422 "$name" : "item",423 "$text" : "",424 "display" : "solid",425 "label" : "表单响应式布局",426 "psmCount" : "1",427 "url" : "$UI/demo/pcSample/forms/responseLayout.w"428 }],429 "$name" : "item",430 "$text" : "",431 "label" : "forms"432 } ,{433 "$children":[{434 "$name" : "item",435 "$text" : "",436 "label" : "图标展示",437 "psmCount" : "1",438 "url" : "$UI/demo/pcSample/text/articleList.w"439 },{440 "$name" : "item",441 "$text" : "",442 "label" : "动态显示字体颜色",443 "psmCount" : "1",444 "url" : "$UI/demo/pcSample/text/changeColor.w"445 },{446 "$name" : "item",447 "$text" : "",448 "label" : "文本截取",449 "psmCount" : "1",450 "url" : "$UI/demo/pcSample/text/cutout.w"451 },{452 "$name" : "item",453 "$text" : "",454 "label" : "监听文本输入",455 "psmCount" : "1",456 "url" : "$UI/demo/pcSample/text/listeningTextChange.w"457 },{458 "$name" : "item",459 "$text" : "",460 "label" : "滚动文字",461 "psmCount" : "1",462 "url" : "$UI/demo/pcSample/text/roll.w"463 }],464 "$name" : "item",465 "$text" : "",466 "label" : "text"467 },{468 "$children" : [{469 "$name" : "item",470 "$text" : "",471 "label" : "列表-无样式列表",472 "psmCount" : "1",473 "url" : "$UI/demo/pcSample/table/basic/basic.w"474 },{475 "$name" : "item",476 "$text" : "",477 "label" : "列表-基本示例",478 "psmCount" : "1",479 "url" : "$UI/demo/pcSample/table/basic/basictwo.w"480 },{481 "$name" : "item",482 "$text" : "",483 "label" : "列表-多行点击变色",484 "psmCount" : "1",485 "url" : "$UI/demo/pcSample/table/basic/basicthree.w"486 },{487 "$name" : "item",488 "$text" : "",489 "label" : "列表-radio模式",490 "psmCount" : "1",491 "url" : "$UI/demo/pcSample/table/basic/basicfour.w"492 },{493 "$name" : "item",494 "$text" : "",495 "label" : "列表-checkbox模式",496 "psmCount" : "1",497 "url" : "$UI/demo/pcSample/table/basic/basicfive.w"498 },{499 "$name" : "item",500 "$text" : "",501 "label" : "列表-点击行选中checkbox模式",502 "psmCount" : "1",503 "url" : "$UI/demo/pcSample/table/basic/basicsix.w"504 },{505 "$name" : "item",506 "$text" : "",507 "label" : "列表-排序模式",508 "psmCount" : "1",509 "url" : "$UI/demo/pcSample/table/basic/basicseven.w"510 },{511 "$name" : "item",512 "$text" : "",513 "label" : "列表-根据某字段设置行样式",514 "psmCount" : "1",515 "url" : "$UI/demo/pcSample/table/basic/basiceight.w"516 },{517 "$name" : "item",518 "$text" : "",519 "label" : "列表-根据字段设置文字颜色",520 "psmCount" : "1",521 "url" : "$UI/demo/pcSample/table/basic/basicnine.w"522 },{523 "$name" : "item",524 "$text" : "",525 "label" : "列表-设置属性值控制表格样式",526 "psmCount" : "1",527 "url" : "$UI/demo/pcSample/table/basic/basicten.w"528 },{529 "$name" : "item",530 "$text" : "",531 "label" : "列表-文字折行",532 "psmCount" : "1",533 "url" : "$UI/demo/pcSample/table/basic/basiceleven.w"534 },{535 "$name" : "item",536 "$text" : "",537 "label" : "表单-无样式表单",538 "psmCount" : "1",539 "url" : "$UI/demo/pcSample/table/basic/basictwelve.w"540 },{541 "$name" : "item",542 "$text" : "",543 "label" : "表单-可收缩的表单",544 "psmCount" : "1",545 "url" : "$UI/demo/pcSample/table/basic/basicthirteen.w"546 },{547 "$name" : "item",548 "$text" : "",549 "label" : "表单-formRow5Btn2表单",550 "psmCount" : "1",551 "url" : "$UI/demo/pcSample/table/basic/basicfourteen.w"552 },{553 "$name" : "item",554 "$text" : "",555 "label" : "表单-table表单",556 "psmCount" : "1",557 "url" : "$UI/demo/pcSample/table/basic/basicfifteen.w"558 },{559 "$name" : "item",560 "$text" : "",561 "label" : "表单-view模式表单",562 "psmCount" : "1",563 "url" : "$UI/demo/pcSample/table/basic/basicsixteen.w"564 },{565 "$name" : "item",566 "$text" : "",567 "label" : "基本表格模板",568 "psmCount" : "1",569 "url" : "$UI/demo/pcSample/table/tableTemplate/tableTemplate.w"570 },{571 "$name" : "item",572 "$text" : "",573 "label" : "含横向滚动条",574 "psmCount" : "1",575 "url" : "$UI/demo/pcSample/table/scrollX/scrollX.w"576 },{577 "$name" : "item",578 "$text" : "",579 "label" : "弹窗中的表格",580 "psmCount" : "1",581 "url" : "$UI/demo/pcSample/table/widowsDialog/windowsDialog.w"582 },{583 "$name" : "item",584 "$text" : "",585 "label" : "表格动态操作",586 "psmCount" : "1",587 "url" : "$UI/demo/pcSample/table/dynamicCreate/dynamicCreate.w"588 },{589 "$name" : "item",590 "$text" : "",591 "label" : "单元格信息提示",592 "psmCount" : "1",593 "url" : "$UI/demo/pcSample/table/informationHint/informationHint.w"594 },{595 "$name" : "item",596 "$text" : "",597 "label" : "父子表格",598 "psmCount" : "1",599 "url" : "$UI/demo/pcSample/table/fatherAndSon/nestedTable.w"600 }],601 "$name" : "item",602 "$text" : "",603 "label" : "table"604 },{605 "$children" : [{606 "$name" : "item",607 "$text" : "",608 "label" : "基本按钮",609 "psmCount" : "1",610 "url" : "$UI/demo/pcSample/form-element/button.w"611 },{612 "$name" : "item",613 "$text" : "",614 "label" : "单选按钮",615 "psmCount" : "1",616 "url" : "$UI/demo/pcSample/form-element/radio.w"617 },{618 "$name" : "item",619 "$text" : "",620 "label" : "多选按钮",621 "psmCount" : "1",622 "url" : "$UI/demo/pcSample/form-element/checkBox.w"623 },{624 "$name" : "item",625 "$text" : "",626 "label" : "多选按钮",627 "psmCount" : "1",628 "url" : "$UI/demo/pcSample/form-element/checkBox.w"629 },{630 "$name" : "item",631 "$text" : "",632 "label" : "单选下拉框",633 "psmCount" : "1",634 "url" : "$UI/demo/pcSample/form-element/select.w"635 },{636 "$name" : "item",637 "$text" : "",638 "label" : "文件上传下载",639 "psmCount" : "1",640 "url" : "$UI/demo/pcSample/form-element/fileUploadDown.w"641 },{642 "$name" : "item",643 "$text" : "",644 "label" : "文件条件上传",645 "psmCount" : "1",646 "url" : "$UI/demo/pcSample/form-element/fileUploadDown.w"647 },{648 "$name" : "item",649 "$text" : "",650 "label" : "条件过滤器1",651 "psmCount" : "1",652 "url" : "$UI/demo/pcSample/form-element/filterConditionOne.w"653 },{654 "$name" : "item",655 "$text" : "",656 "label" : "条件过滤器2",657 "psmCount" : "1",658 "url" : "$UI/demo/pcSample/form-element/filterConditionTwo.w"659 },{660 "$name" : "item",661 "$text" : "",662 "label" : "条件过滤器3",663 "psmCount" : "1",664 "url" : "$UI/demo/pcSample/form-element/filterConditionThree.w"665 },{666 "$name" : "item",667 "$text" : "",668 "label" : "条件过滤器4",669 "psmCount" : "1",670 "url" : "$UI/demo/pcSample/form-element/filterConditionFour.w"671 },{672 "$name" : "item",673 "$text" : "",674 "label" : "条件过滤器5",675 "psmCount" : "1",676 "url" : "$UI/demo/pcSample/form-element/filterConditionFive.w"677 },{678 "$name" : "item",679 "$text" : "",680 "label" : "条件过滤器6",681 "psmCount" : "1",682 "url" : "$UI/demo/pcSample/form-element/filterConditionSix.w"683 },{684 "$name" : "item",685 "$text" : "",686 "label" : "条件过滤器7",687 "psmCount" : "1",688 "url" : "$UI/demo/pcSample/form-element/filterConditionSeven.w"689 },{690 "$name" : "item",691 "$text" : "",692 "label" : "条件过滤器8",693 "psmCount" : "1",694 "url" : "$UI/demo/pcSample/form-element/filterConditionEight.w"695 },{696 "$name" : "item",697 "$text" : "",698 "label" : "评星等级",699 "psmCount" : "1",700 "url" : "$UI/demo/pcSample/form-element/starComment.w"701 },{702 "$name" : "item",703 "$text" : "",704 "label" : "文本框",705 "psmCount" : "1",706 "url" : "$UI/demo/pcSample/form-element/text-box.w"707 },{708 "$name" : "item",709 "$text" : "",710 "label" : "文本域",711 "psmCount" : "1",712 "url" : "$UI/demo/pcSample/form-element/textarea.w"713 }],714 "$name" : "item",715 "$text" : "",716 "label" : "form-element"717 },{718 "$children" : [{719 "$name" : "item",720 "$text" : "",721 "label" : "基本选项卡-流程",722 "psmCount" : "1",723 "url" : "$UI/demo/pcSample/navigator/basic-2.w"724 },{725 "$name" : "item",726 "$text" : "",727 "label" : "基本选项卡-样式2",728 "psmCount" : "1",729 "url" : "$UI/demo/pcSample/navigator/basic-flow.w"730 },{731 "$name" : "item",732 "$text" : "",733 "label" : "静态流程导航",734 "psmCount" : "1",735 "url" : "$UI/demo/pcSample/navigator/basic-staticFlow.w"736 },{737 "$name" : "item",738 "$text" : "",739 "label" : "基本选项卡",740 "psmCount" : "1",741 "url" : "$UI/demo/pcSample/navigator/Basic.w"742 },{743 "$name" : "item",744 "$text" : "",745 "label" : "数字分页控件",746 "psmCount" : "1",747 "url" : "$UI/demo/pcSample/navigator/digitalPaging.w"748 },{749 "$name" : "item",750 "$text" : "",751 "label" : "抽屉容器",752 "psmCount" : "1",753 "url" : "$UI/demo/pcSample/navigator/drawer.w"754 },{755 "$name" : "item",756 "$text" : "",757 "label" : "动态选项卡",758 "psmCount" : "1",759 "url" : "$UI/demo/pcSample/navigator/dynamicTAB.w"760 },{761 "$name" : "item",762 "$text" : "",763 "label" : "分隔条组件",764 "psmCount" : "1",765 "url" : "$UI/demo/pcSample/navigator/gridLine.w"766 },{767 "$name" : "item",768 "$text" : "",769 "label" : "图标工具箱",770 "psmCount" : "1",771 "url" : "$UI/demo/pcSample/navigator/iconKit.w"772 },{773 "$name" : "item",774 "$text" : "",775 "label" : "图标导航",776 "psmCount" : "1",777 "url" : "$UI/demo/pcSample/navigator/iconNav.w"778 },{779 "$name" : "item",780 "$text" : "",781 "label" : "弹出菜单",782 "psmCount" : "1",783 "url" : "$UI/demo/pcSample/navigator/popupMenu.w"784 },{785 "$name" : "item",786 "$text" : "",787 "label" : "图标工具栏",788 "psmCount" : "1",789 "url" : "$UI/demo/pcSample/navigator/toolbar.w"790 }],791 "$name" : "item",792 "$text" : "",793 "label" : "navigator"794 },{795 "$children" : [{796 "$name" : "item",797 "$text" : "",798 "label" : "横向导航(静态流程)",799 "psmCount" : "1",800 "url" : "$UI/demo/pcSample/layout/cross_navigation_flow.w"801 },{802 "$name" : "item",803 "$text" : "",804 "label" : "横向导航(滑动)",805 "psmCount" : "1",806 "url" : "$UI/demo/pcSample/layout/cross_navigation_slide.w"807 },{808 "$name" : "item",809 "$text" : "",810 "label" : "横向导航(tab含表格)",811 "psmCount" : "1",812 "url" : "$UI/demo/pcSample/layout/cross_navigation_tab.w"813 },{814 "$name" : "item",815 "$text" : "",816 "label" : "横向导航",817 "psmCount" : "1",818 "url" : "$UI/demo/pcSample/layout/cross_navigation1.w"819 },{820 "$name" : "item",821 "$text" : "",822 "label" : "横纵向导航",823 "psmCount" : "1",824 "url" : "$UI/demo/pcSample/layout/cross_vertical.w"825 },{826 "$name" : "item",827 "$text" : "",828 "label" : "数据维护",829 "psmCount" : "1",830 "url" : "$UI/demo/pcSample/layout/dic_maintenance.w"831 },{832 "$name" : "item",833 "$text" : "",834 "label" : "字典表维护",835 "psmCount" : "1",836 "url" : "$UI/demo/pcSample/layout/dictionary_maintenance.w"837 },{838 "$name" : "item",839 "$text" : "",840 "label" : "提示模板(用户卡片)",841 "psmCount" : "1",842 "url" : "$UI/demo/pcSample/layout/hint_user_card.w"843 },{844 "$name" : "item",845 "$text" : "",846 "label" : "主页模板(信息栏目一)",847 "psmCount" : "1",848 "url" : "$UI/demo/pcSample/layout/homepage_information_tab1.w"849 },{850 "$name" : "item",851 "$text" : "",852 "label" : "主页模板(信息栏目二)",853 "psmCount" : "1",854 "url" : "$UI/demo/pcSample/layout/homepage_information_tab2.w"855 },{856 "$name" : "item",857 "$text" : "",858 "label" : "主页模板(九宫格)",859 "psmCount" : "1",860 "url" : "$UI/demo/pcSample/layout/homepage_Sudoku.w"861 },{862 "$name" : "item",863 "$text" : "",864 "label" : "多iframe(局部滚动)",865 "psmCount" : "1",866 "url" : "$UI/demo/pcSample/layout/local_rolling.w"867 },{868 "$name" : "item",869 "$text" : "",870 "label" : "资源分配(按角色)",871 "psmCount" : "1",872 "url" : "$UI/demo/pcSample/layout/resource_distribute_role.w"873 },{874 "$name" : "item",875 "$text" : "",876 "label" : "资源分配(按用户)",877 "psmCount" : "1",878 "url" : "$UI/demo/pcSample/layout/resource_distribute_user.w"879 },{880 "$name" : "item",881 "$text" : "",882 "label" : "角色管理",883 "psmCount" : "1",884 "url" : "$UI/demo/pcSample/layout/role_manage.w"885 },{886 "$name" : "item",887 "$text" : "",888 "label" : "用户管理",889 "psmCount" : "1",890 "url" : "$UI/demo/pcSample/layout/user_manage.w"891 },{892 "$name" : "item",893 "$text" : "",894 "label" : "图表与表格",895 "psmCount" : "1",896 "url" : "$UI/demo/pcSample/layout/table_Echarts.w"897 },{898 "$name" : "item",899 "$text" : "",900 "label" : "纵向导航(分组列表)",901 "psmCount" : "1",902 "url" : "$UI/demo/pcSample/layout/vertical_navigation_group.w"903 },{904 "$name" : "item",905 "$text" : "",906 "label" : "纵向导航(链接)",907 "psmCount" : "1",908 "url" : "$UI/demo/pcSample/layout/vertical_navigation_link.w"909 },{910 "$name" : "item",911 "$text" : "",912 "label" : "纵向导航(列表)",913 "psmCount" : "1",914 "url" : "$UI/demo/pcSample/layout/vertical_navigation_list.w"915 },{916 "$name" : "item",917 "$text" : "",918 "label" : "纵向导航(滑动)",919 "psmCount" : "1",920 "url" : "$UI/demo/pcSample/layout/vertical_navigation_slide.w"921 },{922 "$name" : "item",923 "$text" : "",924 "label" : "快捷操作向导",925 "psmCount" : "1",926 "url" : "$UI/demo/pcSample/layout/vertical_tipwizard.w"927 }],928 "$name" : "item",929 "$text" : "",930 "label" : "layout"931 }],932 "$name" : "root",933 "$text" : ""934 }; ...

Full Screen

Full Screen

templates.js

Source:templates.js Github

copy

Full Screen

1/**2 * Default list of commands to execute for a PeerConnection test.3 */4const STABLE = "stable";5const HAVE_LOCAL_OFFER = "have-local-offer";6const HAVE_REMOTE_OFFER = "have-remote-offer";7const CLOSED = "closed";8const ICE_NEW = "new";9const GATH_NEW = "new";10const GATH_GATH = "gathering";11const GATH_COMPLETE = "complete"12function deltaSeconds(date1, date2) {13 return (date2.getTime() - date1.getTime())/1000;14}15function dumpSdp(test) {16 if (typeof test._local_offer !== 'undefined') {17 dump("ERROR: SDP offer: " + test._local_offer.sdp.replace(/[\r]/g, ''));18 }19 if (typeof test._remote_answer !== 'undefined') {20 dump("ERROR: SDP answer: " + test._remote_answer.sdp.replace(/[\r]/g, ''));21 }22 if ((test.pcLocal) && (typeof test.pcLocal._local_ice_candidates !== 'undefined')) {23 dump("pcLocal._local_ice_candidates: " + JSON.stringify(test.pcLocal._local_ice_candidates) + "\n");24 dump("pcLocal._remote_ice_candidates: " + JSON.stringify(test.pcLocal._remote_ice_candidates) + "\n");25 dump("pcLocal._ice_candidates_to_add: " + JSON.stringify(test.pcLocal._ice_candidates_to_add) + "\n");26 }27 if ((test.pcRemote) && (typeof test.pcRemote._local_ice_candidates !== 'undefined')) {28 dump("pcRemote._local_ice_candidates: " + JSON.stringify(test.pcRemote._local_ice_candidates) + "\n");29 dump("pcRemote._remote_ice_candidates: " + JSON.stringify(test.pcRemote._remote_ice_candidates) + "\n");30 dump("pcRemote._ice_candidates_to_add: " + JSON.stringify(test.pcRemote._ice_candidates_to_add) + "\n");31 }32 if ((test.pcLocal) && (typeof test.pcLocal.iceConnectionLog !== 'undefined')) {33 dump("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog + "\n");34 }35 if ((test.pcRemote) && (typeof test.pcRemote.iceConnectionLog !== 'undefined')) {36 dump("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog + "\n");37 }38 if ((test.pcLocal) && (test.pcRemote) &&39 (typeof test.pcLocal.setRemoteDescDate !== 'undefined') &&40 (typeof test.pcRemote.setLocalDescDate !== 'undefined')) {41 var delta = deltaSeconds(test.pcLocal.setRemoteDescDate, test.pcRemote.setLocalDescDate);42 dump("Delay between pcLocal.setRemote <-> pcRemote.setLocal: " + delta + "\n");43 }44 if ((test.pcLocal) && (test.pcRemote) &&45 (typeof test.pcLocal.setRemoteDescDate !== 'undefined') &&46 (typeof test.pcLocal.setRemoteDescStableEventDate !== 'undefined')) {47 var delta = deltaSeconds(test.pcLocal.setRemoteDescDate, test.pcLocal.setRemoteDescStableEventDate);48 dump("Delay between pcLocal.setRemote <-> pcLocal.signalingStateStable: " + delta + "\n");49 }50 if ((test.pcLocal) && (test.pcRemote) &&51 (typeof test.pcRemote.setLocalDescDate !== 'undefined') &&52 (typeof test.pcRemote.setLocalDescStableEventDate !== 'undefined')) {53 var delta = deltaSeconds(test.pcRemote.setLocalDescDate, test.pcRemote.setLocalDescStableEventDate);54 dump("Delay between pcRemote.setLocal <-> pcRemote.signalingStateStable: " + delta + "\n");55 }56}57function waitForIceConnected(test, pc) {58 if (!pc.iceCheckingRestartExpected) {59 if (pc.isIceConnected()) {60 info(pc + ": ICE connection state log: " + pc.iceConnectionLog);61 ok(true, pc + ": ICE is in connected state");62 return Promise.resolve();63 }64 if (!pc.isIceConnectionPending()) {65 dumpSdp(test);66 var details = pc + ": ICE is already in bad state: " + pc.iceConnectionState;67 ok(false, details);68 return Promise.reject(new Error(details));69 }70 }71 return pc.waitForIceConnected()72 .then(() => {73 info(pc + ": ICE connection state log: " + pc.iceConnectionLog);74 ok(pc.isIceConnected(), pc + ": ICE switched to 'connected' state");75 });76}77// We need to verify that at least one candidate has been (or will be) gathered.78function waitForAnIceCandidate(pc) {79 return new Promise(resolve => {80 if (!pc.localRequiresTrickleIce ||81 pc._local_ice_candidates.length > 0) {82 resolve();83 } else {84 // In some circumstances, especially when both PCs are on the same85 // browser, even though we are connected, the connection can be86 // established without receiving a single candidate from one or other87 // peer. So we wait for at least one...88 pc._pc.addEventListener('icecandidate', resolve);89 }90 }).then(() => {91 ok(pc._local_ice_candidates.length > 0,92 pc + " received local trickle ICE candidates");93 isnot(pc._pc.iceGatheringState, GATH_NEW,94 pc + " ICE gathering state is not 'new'");95 });96}97function checkTrackStats(pc, rtpSenderOrReceiver, outbound) {98 var track = rtpSenderOrReceiver.track;99 var audio = (track.kind == "audio");100 var msg = pc + " stats " + (outbound ? "outbound " : "inbound ") +101 (audio ? "audio" : "video") + " rtp track id " + track.id;102 return pc.getStats(track).then(stats => {103 ok(pc.hasStat(stats, {104 type: outbound ? "outboundrtp" : "inboundrtp",105 isRemote: false,106 mediaType: audio ? "audio" : "video"107 }), msg + " - found expected stats");108 ok(!pc.hasStat(stats, {109 type: outbound ? "inboundrtp" : "outboundrtp",110 isRemote: false111 }), msg + " - did not find extra stats with wrong direction");112 ok(!pc.hasStat(stats, {113 mediaType: audio ? "video" : "audio"114 }), msg + " - did not find extra stats with wrong media type");115 });116}117var checkAllTrackStats = pc => {118 return Promise.all([].concat(119 pc._pc.getSenders().map(sender => checkTrackStats(pc, sender, true)),120 pc._pc.getReceivers().map(receiver => checkTrackStats(pc, receiver, false))));121}122// Commands run once at the beginning of each test, even when performing a123// renegotiation test.124var commandsPeerConnectionInitial = [125 function PC_SETUP_SIGNALING_CLIENT(test) {126 if (test.testOptions.steeplechase) {127 test.setupSignalingClient();128 test.registerSignalingCallback("ice_candidate", function (message) {129 var pc = test.pcRemote ? test.pcRemote : test.pcLocal;130 pc.storeOrAddIceCandidate(new RTCIceCandidate(message.ice_candidate));131 });132 test.registerSignalingCallback("end_of_trickle_ice", function (message) {133 test.signalingMessagesFinished();134 });135 }136 },137 function PC_LOCAL_SETUP_ICE_LOGGER(test) {138 test.pcLocal.logIceConnectionState();139 },140 function PC_REMOTE_SETUP_ICE_LOGGER(test) {141 test.pcRemote.logIceConnectionState();142 },143 function PC_LOCAL_SETUP_SIGNALING_LOGGER(test) {144 test.pcLocal.logSignalingState();145 },146 function PC_REMOTE_SETUP_SIGNALING_LOGGER(test) {147 test.pcRemote.logSignalingState();148 },149 function PC_LOCAL_SETUP_ADDSTREAM_HANDLER(test) {150 test.pcLocal.setupAddStreamEventHandler();151 },152 function PC_REMOTE_SETUP_ADDSTREAM_HANDLER(test) {153 test.pcRemote.setupAddStreamEventHandler();154 },155 function PC_LOCAL_CHECK_INITIAL_SIGNALINGSTATE(test) {156 is(test.pcLocal.signalingState, STABLE,157 "Initial local signalingState is 'stable'");158 },159 function PC_REMOTE_CHECK_INITIAL_SIGNALINGSTATE(test) {160 is(test.pcRemote.signalingState, STABLE,161 "Initial remote signalingState is 'stable'");162 },163 function PC_LOCAL_CHECK_INITIAL_ICE_STATE(test) {164 is(test.pcLocal.iceConnectionState, ICE_NEW,165 "Initial local ICE connection state is 'new'");166 },167 function PC_REMOTE_CHECK_INITIAL_ICE_STATE(test) {168 is(test.pcRemote.iceConnectionState, ICE_NEW,169 "Initial remote ICE connection state is 'new'");170 },171];172var commandsGetUserMedia = [173 function PC_LOCAL_GUM(test) {174 return test.pcLocal.getAllUserMedia(test.pcLocal.constraints);175 },176 function PC_REMOTE_GUM(test) {177 return test.pcRemote.getAllUserMedia(test.pcRemote.constraints);178 },179];180var commandsPeerConnectionOfferAnswer = [181 function PC_LOCAL_SETUP_ICE_HANDLER(test) {182 test.pcLocal.setupIceCandidateHandler(test);183 },184 function PC_REMOTE_SETUP_ICE_HANDLER(test) {185 test.pcRemote.setupIceCandidateHandler(test);186 },187 function PC_LOCAL_STEEPLECHASE_SIGNAL_EXPECTED_LOCAL_TRACKS(test) {188 if (test.testOptions.steeplechase) {189 send_message({"type": "local_expected_tracks",190 "expected_tracks": test.pcLocal.expectedLocalTrackInfoById});191 }192 },193 function PC_REMOTE_STEEPLECHASE_SIGNAL_EXPECTED_LOCAL_TRACKS(test) {194 if (test.testOptions.steeplechase) {195 send_message({"type": "remote_expected_tracks",196 "expected_tracks": test.pcRemote.expectedLocalTrackInfoById});197 }198 },199 function PC_LOCAL_GET_EXPECTED_REMOTE_TRACKS(test) {200 if (test.testOptions.steeplechase) {201 return test.getSignalingMessage("remote_expected_tracks").then(202 message => {203 test.pcLocal.expectedRemoteTrackInfoById = message.expected_tracks;204 });205 }206 // Deep copy, as similar to steeplechase as possible207 test.pcLocal.expectedRemoteTrackInfoById =208 JSON.parse(JSON.stringify(test.pcRemote.expectedLocalTrackInfoById));209 },210 function PC_REMOTE_GET_EXPECTED_REMOTE_TRACKS(test) {211 if (test.testOptions.steeplechase) {212 return test.getSignalingMessage("local_expected_tracks").then(213 message => {214 test.pcRemote.expectedRemoteTrackInfoById = message.expected_tracks;215 });216 }217 // Deep copy, as similar to steeplechase as possible218 test.pcRemote.expectedRemoteTrackInfoById =219 JSON.parse(JSON.stringify(test.pcLocal.expectedLocalTrackInfoById));220 },221 function PC_LOCAL_CREATE_OFFER(test) {222 return test.createOffer(test.pcLocal).then(offer => {223 is(test.pcLocal.signalingState, STABLE,224 "Local create offer does not change signaling state");225 });226 },227 function PC_LOCAL_STEEPLECHASE_SIGNAL_OFFER(test) {228 if (test.testOptions.steeplechase) {229 send_message({"type": "offer",230 "offer": test.originalOffer,231 "offer_constraints": test.pcLocal.constraints,232 "offer_options": test.pcLocal.offerOptions});233 test._local_offer = test.originalOffer;234 test._offer_constraints = test.pcLocal.constraints;235 test._offer_options = test.pcLocal.offerOptions;236 }237 },238 function PC_LOCAL_SET_LOCAL_DESCRIPTION(test) {239 return test.setLocalDescription(test.pcLocal, test.originalOffer, HAVE_LOCAL_OFFER)240 .then(() => {241 is(test.pcLocal.signalingState, HAVE_LOCAL_OFFER,242 "signalingState after local setLocalDescription is 'have-local-offer'");243 });244 },245 function PC_REMOTE_GET_OFFER(test) {246 if (!test.testOptions.steeplechase) {247 test._local_offer = test.originalOffer;248 test._offer_constraints = test.pcLocal.constraints;249 test._offer_options = test.pcLocal.offerOptions;250 return Promise.resolve();251 }252 return test.getSignalingMessage("offer")253 .then(message => {254 ok("offer" in message, "Got an offer message");255 test._local_offer = new RTCSessionDescription(message.offer);256 test._offer_constraints = message.offer_constraints;257 test._offer_options = message.offer_options;258 });259 },260 function PC_REMOTE_SET_REMOTE_DESCRIPTION(test) {261 return test.setRemoteDescription(test.pcRemote, test._local_offer, HAVE_REMOTE_OFFER)262 .then(() => {263 is(test.pcRemote.signalingState, HAVE_REMOTE_OFFER,264 "signalingState after remote setRemoteDescription is 'have-remote-offer'");265 });266 },267 function PC_LOCAL_SANE_LOCAL_SDP(test) {268 test.pcLocal.localRequiresTrickleIce =269 sdputils.verifySdp(test._local_offer, "offer",270 test._offer_constraints, test._offer_options,271 test.testOptions);272 },273 function PC_REMOTE_SANE_REMOTE_SDP(test) {274 test.pcRemote.remoteRequiresTrickleIce =275 sdputils.verifySdp(test._local_offer, "offer",276 test._offer_constraints, test._offer_options,277 test.testOptions);278 },279 function PC_REMOTE_CREATE_ANSWER(test) {280 return test.createAnswer(test.pcRemote)281 .then(answer => {282 is(test.pcRemote.signalingState, HAVE_REMOTE_OFFER,283 "Remote createAnswer does not change signaling state");284 if (test.testOptions.steeplechase) {285 send_message({"type": "answer",286 "answer": test.originalAnswer,287 "answer_constraints": test.pcRemote.constraints});288 test._remote_answer = test.pcRemote._last_answer;289 test._answer_constraints = test.pcRemote.constraints;290 }291 });292 },293 function PC_REMOTE_SET_LOCAL_DESCRIPTION(test) {294 return test.setLocalDescription(test.pcRemote, test.originalAnswer, STABLE)295 .then(() => {296 is(test.pcRemote.signalingState, STABLE,297 "signalingState after remote setLocalDescription is 'stable'");298 });299 },300 function PC_LOCAL_GET_ANSWER(test) {301 if (!test.testOptions.steeplechase) {302 test._remote_answer = test.originalAnswer;303 test._answer_constraints = test.pcRemote.constraints;304 return Promise.resolve();305 }306 return test.getSignalingMessage("answer").then(message => {307 ok("answer" in message, "Got an answer message");308 test._remote_answer = new RTCSessionDescription(message.answer);309 test._answer_constraints = message.answer_constraints;310 });311 },312 function PC_LOCAL_SET_REMOTE_DESCRIPTION(test) {313 return test.setRemoteDescription(test.pcLocal, test._remote_answer, STABLE)314 .then(() => {315 is(test.pcLocal.signalingState, STABLE,316 "signalingState after local setRemoteDescription is 'stable'");317 });318 },319 function PC_REMOTE_SANE_LOCAL_SDP(test) {320 test.pcRemote.localRequiresTrickleIce =321 sdputils.verifySdp(test._remote_answer, "answer",322 test._offer_constraints, test._offer_options,323 test.testOptions);324 },325 function PC_LOCAL_SANE_REMOTE_SDP(test) {326 test.pcLocal.remoteRequiresTrickleIce =327 sdputils.verifySdp(test._remote_answer, "answer",328 test._offer_constraints, test._offer_options,329 test.testOptions);330 },331 function PC_LOCAL_WAIT_FOR_ICE_CONNECTED(test) {332 return waitForIceConnected(test, test.pcLocal);333 },334 function PC_REMOTE_WAIT_FOR_ICE_CONNECTED(test) {335 return waitForIceConnected(test, test.pcRemote);336 },337 function PC_LOCAL_VERIFY_ICE_GATHERING(test) {338 return waitForAnIceCandidate(test.pcLocal);339 },340 function PC_REMOTE_VERIFY_ICE_GATHERING(test) {341 return waitForAnIceCandidate(test.pcRemote);342 },343 function PC_LOCAL_CHECK_MEDIA_TRACKS(test) {344 return test.pcLocal.checkMediaTracks();345 },346 function PC_REMOTE_CHECK_MEDIA_TRACKS(test) {347 return test.pcRemote.checkMediaTracks();348 },349 function PC_LOCAL_WAIT_FOR_MEDIA_FLOW(test) {350 return test.pcLocal.waitForMediaFlow();351 },352 function PC_REMOTE_WAIT_FOR_MEDIA_FLOW(test) {353 return test.pcRemote.waitForMediaFlow();354 },355 function PC_LOCAL_CHECK_STATS(test) {356 return test.pcLocal.getStats().then(stats => {357 test.pcLocal.checkStats(stats, test.testOptions.steeplechase);358 });359 },360 function PC_REMOTE_CHECK_STATS(test) {361 return test.pcRemote.getStats().then(stats => {362 test.pcRemote.checkStats(stats, test.testOptions.steeplechase);363 });364 },365 function PC_LOCAL_CHECK_ICE_CONNECTION_TYPE(test) {366 return test.pcLocal.getStats().then(stats => {367 test.pcLocal.checkStatsIceConnectionType(stats);368 });369 },370 function PC_REMOTE_CHECK_ICE_CONNECTION_TYPE(test) {371 return test.pcRemote.getStats().then(stats => {372 test.pcRemote.checkStatsIceConnectionType(stats);373 });374 },375 function PC_LOCAL_CHECK_ICE_CONNECTIONS(test) {376 return test.pcLocal.getStats().then(stats => {377 test.pcLocal.checkStatsIceConnections(stats,378 test._offer_constraints,379 test._offer_options,380 test.testOptions);381 });382 },383 function PC_REMOTE_CHECK_ICE_CONNECTIONS(test) {384 return test.pcRemote.getStats().then(stats => {385 test.pcRemote.checkStatsIceConnections(stats,386 test._offer_constraints,387 test._offer_options,388 test.testOptions);389 });390 },391 function PC_LOCAL_CHECK_MSID(test) {392 return test.pcLocal.checkMsids();393 },394 function PC_REMOTE_CHECK_MSID(test) {395 return test.pcRemote.checkMsids();396 },397 function PC_LOCAL_CHECK_STATS(test) {398 return checkAllTrackStats(test.pcLocal);399 },400 function PC_REMOTE_CHECK_STATS(test) {401 return checkAllTrackStats(test.pcRemote);402 },403 function PC_LOCAL_VERIFY_SDP_AFTER_END_OF_TRICKLE(test) {404 if (test.pcLocal.endOfTrickleSdp) {405 /* In case the endOfTrickleSdp promise is resolved already it will win the406 * race because it gets evaluated first. But if endOfTrickleSdp is still407 * pending the rejection will win the race. */408 return Promise.race([409 test.pcLocal.endOfTrickleSdp,410 Promise.reject("No SDP")411 ])412 .then(sdp => sdputils.checkSdpAfterEndOfTrickle(sdp, test.testOptions, test.pcLocal.label),413 () => info("pcLocal: Gathering is not complete yet, skipping post-gathering SDP check"));414 }415 },416 function PC_REMOTE_VERIFY_SDP_AFTER_END_OF_TRICKLE(test) {417 if (test.pcRemote.endOfTrickelSdp) {418 /* In case the endOfTrickleSdp promise is resolved already it will win the419 * race because it gets evaluated first. But if endOfTrickleSdp is still420 * pending the rejection will win the race. */421 return Promise.race([422 test.pcRemote.endOfTrickleSdp,423 Promise.reject("No SDP")424 ])425 .then(sdp => sdputils.checkSdpAfterEndOfTrickle(sdp, test.testOptions, test.pcRemote.label),426 () => info("pcRemote: Gathering is not complete yet, skipping post-gathering SDP check"));427 }428 }429];430function PC_LOCAL_REMOVE_VP8_FROM_OFFER(test) {431 isnot(test.originalOffer.sdp.search("H264/90000"), -1, "H.264 should be present in the SDP offer");432 test.originalOffer.sdp = sdputils.removeVP8(test.originalOffer.sdp);433 info("Updated H264 only offer: " + JSON.stringify(test.originalOffer));434};435function PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER(test) {436 test.originalOffer.sdp = sdputils.removeBundle(test.originalOffer.sdp);437 info("Updated no bundle offer: " + JSON.stringify(test.originalOffer));438};439function PC_LOCAL_REMOVE_RTCPMUX_FROM_OFFER(test) {440 test.originalOffer.sdp = sdputils.removeRtcpMux(test.originalOffer.sdp);441 info("Updated no RTCP-Mux offer: " + JSON.stringify(test.originalOffer));442};443var addRenegotiation = (chain, commands, checks) => {444 chain.append(commands);445 chain.append(commandsPeerConnectionOfferAnswer);446 if (checks) {447 chain.append(checks);448 }449};450var addRenegotiationAnswerer = (chain, commands, checks) => {451 chain.append(function SWAP_PC_LOCAL_PC_REMOTE(test) {452 var temp = test.pcLocal;453 test.pcLocal = test.pcRemote;454 test.pcRemote = temp;455 });456 addRenegotiation(chain, commands, checks);...

Full Screen

Full Screen

Position.js

Source:Position.js Github

copy

Full Screen

1/**2 * 处理棋子移动3 */4(function(){5 var Position = window.Position = function(){6 7 }8 // 如果bDel为false,则将棋子pc添加进棋局中的sq位置;如果bDel为true,则删除sq位置的棋子。9 Position.prototype.addPiece = function(sq,pc,bDel) {10 this.squares[sq] = bDel ? 0 : pc;11 //更新红方和黑方的分值12 if(pc < 16){13 var pcAdjust = pc - 8;14 this.vlWhite += bDel ? -PIECE_VALUE[pcAdjust][sq] : PIECE_VALUE[pcAdjust][sq];15 } else {16 var pcAdjust = pc - 16;17 this.vlBlack += bDel ? -PIECE_VALUE[pcAdjust][SQUARE_FLIP(sq)] : PIECE_VALUE[pcAdjust][SQUARE_FLIP(sq)];18 }19 }20 //尝试走棋21 Position.prototype.makeMove = function(mv){22 this.movePiece(mv);23 if(this.checked()){24 this.undoMovePiece();25 return false;26 }27 this.changeSide();28 this.distance ++;29 return true;30 }31 //取消尝试走的棋32 Position.prototype.undoMakeMove = function(){33 this.changeSide();34 this.distance --;35 this.undoMovePiece();36 37 }38 //移动棋子39 Position.prototype.movePiece = function(mv){40 var sqSrc = SRC(mv);41 var pcSrc = this.squares[sqSrc];42 var sqDst = DST(mv);43 var pcDst = this.squares[sqDst];44 this.pcList.push(pcDst); //记录被吃掉的子 (没有吃子时,记录 0);45 if (pcDst > 0) {46 // 终点有棋子,需要删除该棋子47 this.addPiece(sqDst, pcDst, DEL_PIECE);48 }49 //删除起点位置棋子50 this.addPiece(sqSrc,pcSrc,DEL_PIECE);51 //将起点位置的棋子添加到终点位置52 this.addPiece(sqDst,pcSrc,ADD_PIECE);53 /*console.log("movePiece:" + "黑棋--" + this.vlBlack + "红棋--" + this.vlWhite);*/54 //记录走法55 this.mvList.push(mv);56 }57 //取消移动棋子58 Position.prototype.undoMovePiece = function(){59 //从走法表中取出最后一个走法60 var mv = this.mvList.pop();61 //获取走法的起点,终点,棋子62 var sqSrc = SRC(mv);63 var sqDst = DST(mv);64 var pcDst = this.squares[sqDst];65 // 删除终点棋子66 this.addPiece(sqDst, pcDst, DEL_PIECE); 67 //将这个棋子添加到起点68 this.addPiece(sqSrc,pcDst,ADD_PIECE);69 //取出吃掉的子70 var pc = this.pcList.pop();71 if(pc > 0){72 this.addPiece(sqDst,pc,ADD_PIECE);73 }74 /*console.log("undomovePiece:" + "黑棋--" + this.vlBlack + "红棋--" + this.vlWhite);*/75 }76 //获得分数77 Position.prototype.evaluate = function(){78 return this.sdPlayer == PLAYER ? (this.vlWhite - this.vlBlack) : (this.vlBlack - this.vlWhite);79 }80 //改变走棋方81 Position.prototype.changeSide = function(){82 this.sdPlayer = 1 - this.sdPlayer;83 }84 //判断老将是否被攻击85 Position.prototype.checked = function(){86 var pcSelfSide = SIDE_TAG(this.sdPlayer);87 var pcOppSide = OPP_SIDE_TAG(this.sdPlayer);88 for(var sq = 0 ; sq < 256 ; sq ++){89 if(this.squares[sq] - pcSelfSide != PIECE_KING){90 continue;91 }92 //对方进兵时,是否能吃到我方的帅93 if(this.squares[SQUARE_FORWARD(sq,this.sdPlayer)] == pcOppSide + PIECE_PAWN){94 return true;95 }96 //对方平兵时,是否能吃到我方的帅97 if(this.squares[sq - 1] == pcOppSide + PIECE_PAWN || this.squares[sq + 1] == pcOppSide + PIECE_PAWN){98 return true;99 }100 //对方的马能否吃到我方的帅101 for(var i = 0 ; i < 4 ; i ++){102 //马脚位置103 var sqPin = sq + ADVISOR_DELTA[i];104 //马脚位置存在棋子105 if(this.squares[sqPin] != 0){106 continue;107 }108 for (var j = 0; j < 2; j ++) {109 var pcDst = this.squares[sq + KNIGHT_CHECK_DELTA[i][j]];110 if (pcDst == pcOppSide + PIECE_KNIGHT) {111 return true;112 }113 } 114 }115 //对方的炮、车是否能吃到我方的帅,或者将帅对脸116 for(var i = 0 ; i < 4 ; i ++){117 var delta = KING_DELTA[i];118 var sqDst = sq + delta;119 while(IN_BOARD(sqDst)){120 var pcDst = this.squares[sqDst];121 //遇到了棋子122 if(pcDst > 0){123 //如果棋子是车或者对方的帅,则返回true124 if(pcDst == pcOppSide + PIECE_ROOK || pcDst == pcOppSide + PIECE_KING){125 return true;126 }127 break;128 }129 sqDst += delta;130 }131 //此时若棋子还在棋盘内,则该位置为其它棋子132 sqDst += delta;133 while(IN_BOARD(sqDst)){134 var pcDst = this.squares[sqDst];135 if(pcDst > 0){136 //此时棋子为对方的炮,则可以被将军137 if(pcDst == pcOppSide + PIECE_CANNON){138 return true;139 }140 //无论是否是对方的炮,此时都该退出循环141 break;142 }143 sqDst += delta;144 }145 }146 return false;147 }148 return false;149 }150 //判断当前局面是否会导致被将死151 Position.prototype.isMate = function(){152 var mvs = gen(this.squares);153 //尝试所有的步骤,如果每一步都会被将军,那么说明已经被将死了154 for(var i = 0 , len = mvs.length ; i < len ; i ++){155 var mv = mvs[i];156 if(this.makeMove(mv)){157 this.undoMakeMove();158 return false;159 }160 }161 return true;162 }163 //杀棋分数164 Position.prototype.mateValue = function(){165 return this.distance - MATE_VALUE;166 }167 //获取历史表的指标168 Position.prototype.historyIndex = function(mv){169 return ((this.squares[SRC(mv)] - 8) << 8) + DST(mv);170 }171 //判断走法是否合法172 Position.prototype.legalMove = function(mv){173 var sqSrc = SRC(mv);174 var pcSrc = this.squares[sqSrc];175 var pcSelfSide = SIDE_TAG(this.sdPlayer);176 //如果起点为对方棋子,或者为空子,不合法177 if((pcSrc & pcSelfSide) == 0){178 return false;179 }180 var sqDst = DST(mv);181 var pcDst = this.squares[sqDst];182 //终点位置棋子为我方棋子183 if((pcDst & pcSelfSide) != 0){184 return false;185 }186 //根据棋子类型判断187 switch(pcSrc - pcSelfSide){188 case PIECE_KING: //将(帅)189 return IN_FORT(sqDst) && KING_SPAN(sqSrc,sqDst);190 case PIECE_ADVISOR: //士191 return IN_FORT(sqDst) && ADVISOR_SPAN(sqSrc,sqDst);192 case PIECE_BISHOP: //象193 return SAME_HALF(sqSrc,sqDst) && BISHOP_SPAN(sqSrc,sqDst) 194 && this.squares[BISHOP_PIN(sqSrc,sqDst)] == 0;195 case PIECE_KNIGHT: //马196 var sqPin = KNIGHT_SPAN(sqSrc,sqDst);197 return sqPin != sqSrc && this.squares[sqPin] == 0;198 case PIECE_ROOK: //车199 case PIECE_CANNON: //炮200 //车与炮均是直线走路,判断是否是同一行或者同一列201 var delta;//移动向量202 //同一行 203 if(SAME_RANK(sqSrc,sqDst)){204 delta = sqDst > sqSrc ? 1 : -1;205 } else if(SAME_FILE(sqSrc,sqDst)){206 delta = sqDst > sqSrc ? 16 : -16;207 } else {208 return false;209 }210 var sqPin = sqSrc + delta;211 //沿着终点的方向前进,直到到达终点或者遇到了其它棋子位置212 while(sqPin != sqDst && this.squares[sqPin] == 0){213 sqPin += delta;214 }215 //如果此时到达了终点,说明中途没有遇到一个棋子,此时若终点为空,则车或炮都合法,否则只有车合法216 if(sqPin == sqDst){217 return this.squares[sqDst] == 0 || pcSrc - pcSelfSide == PIECE_ROOK;218 }219 //没有到达终点,此时sqPin对应的位置棋子不为空,此时如果是车,则不合法,如果终点为空,也不合法220 if(pcDst == 0 || pcSrc - pcSelfSide != PIECE_CANNON){221 return false;222 }223 sqPin += delta;224 while(sqPin != sqDst && this.squares[sqPin] == 0){225 sqPin += delta;226 }227 //此时再次碰到棋子,如果该位置是终点,则炮合法,否则都不合法228 return sqPin == sqDst;229 case PIECE_PAWN: //兵(卒)230 //如果已经过河,且是向左向右走的,合法231 if(AWAY_HALF(sqSrc,this.sdPlayer) && 232 (sqDst - sqSrc == 1 || sqDst - sqSrc == -1)){233 return true;234 }235 var sqPin = SQUARE_FORWARD(sqSrc,this.sdPlayer);236 return sqPin == sqDst;237 default:238 return false;239 }240 }241 Position.prototype.clearBoard = function() {242 //开始走棋方243 this.sdPlayer = game.sm.whoIsFirst;244 this.squares = []; //棋盘数组245 for(var i = 0 ; i < 256 ; i++){246 this.squares.push(0);247 }248 this.vlWhite = this.vlBlack = 0;249 };250 Position.prototype.setIrrev = function(){251 //走法数组,存储每次的走法252 this.mvList = [0];253 //吃子数组,存放每次吃子254 this.pcList = [0];255 //深度,代表每次搜索时进行的深度,配合历史表使用256 this.distance = 0;257 }258 //解析fen259 Position.prototype.fromFen = function(fen){260 this.clearBoard();261 var index = 0;262 if(index == fen.length){263 return ;264 }265 var c = fen.charAt(index);266 var x = 3,y = 3;//x 代表列 y 代表行267 while(c != " "){268 if(c == "/"){//换行269 x = 3;270 y ++;271 } else if(c >= 1 && c <= 9){ // 空格272 x += (c.charCodeAt() - ("0").charCodeAt());273 } else if(c >= "A" && c <= "Z"){274 if(x <= 11){275 var pt = CHAR_TO_PIECE(c);276 if(pt >= 0){277 this.addPiece(COORD_XY(x,y),pt + 8,ADD_PIECE);278 }279 x ++;280 }281 } else if(c >= "a" && c <= "z"){282 if(x <= 11){283 var pt = CHAR_TO_PIECE(c.toUpperCase());284 if(pt >= 0){285 this.addPiece(COORD_XY(x,y),pt + 16,ADD_PIECE);286 }287 x ++;288 }289 }290 index++;291 if(index == fen.length){292 this.setIrrev();293 return ;294 }295 c = fen.charAt(index); 296 }297 this.setIrrev();298 console.log("黑子分数:" + this.vlBlack + " 红子分数:" + this.vlWhite);299 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var util = require('util');3var fs = require('fs');4var wpt = new WebPageTest('www.webpagetest.org');5var wpt = new WebPageTest('www.webpagetest.org');6var options = {7 videoParams: {8 }9};

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var page = wptools.page('Albert Einstein');3page.get(function(err, resp) {4 console.log(resp);5});6var wptools = require('wptools');7var page = wptools.page('Albert Einstein');8page.get(function(err, resp) {9 console.log(resp);10});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var WebPageTest = function(server, apiKey) {10 this.server = server;11 this.apiKey = apiKey;12 this.timeout = 60000;13 this.pollResults = 5000;14 this.pollRun = 5000;15 this.pollTesters = 5000;16 this.pollLocations = 5000;17 this.apiKeyParam = (this.apiKey) ? '&k=' + this.apiKey : '';18 this.apiKeyParam = (this.apiKey) ? '?k=' + this.apiKey : '';19};20WebPageTest.prototype.runTest = function(url, callback, options) {21 var self = this;22 var options = options || {};23 var location = options.location || 'Dulles:Chrome';24 var connectivity = options.connectivity || 'Cable';25 var bwDown = options.bwDown || 1000;26 var bwUp = options.bwUp || 1000;27 var latency = options.latency || 0;28 var plr = options.plr || 0;29 var ping = options.ping || 0;30 var mobile = options.mobile || 0;31 var fvonly = options.fvonly || 0;32 var video = options.video || 0;33 var timeline = options.timeline || 0;34 var netlog = options.netlog || 0;35 var noscript = options.noscript || 0;36 var noimages = options.noimages || 0;37 var blockads = options.blockads || 0;38 var standard = options.standard || 0;39 var script = options.script || '';40 var script = (script != '') ? '&script=' + script : '';41 var label = options.label || '';42 var label = (label != '') ? '&label=' + label : '';43 var runs = options.runs || 1;44 var fvonly = options.fvonly || 0;45 var notify = options.notify || '';46 var notify = (notify != '') ? '&notify=' + notify : '';

Full Screen

Using AI Code Generation

copy

Full Screen

1wpt.pc('test', 'test');2wpt.pc('test', 'test', function(error, data) {3 if (error) {4 console.log(error);5 } else {6 console.log(data);7 }8});9wpt.pc('test', 'test', {10});11wpt.pc('test', 'test', {12}, function(error, data) {13 if (error) {14 console.log(error);15 } else {16 console.log(data);17 }18});19wpt.getLocations();20wpt.getLocations(function(error, data) {21 if (error) {22 console.log(error);23 } else {24 console.log(data);25 }26});27wpt.getTestQueue();28wpt.getTestQueue(function(error, data) {29 if (error) {30 console.log(error);31 } else {32 console.log(data);33 }34});35wpt.getTestHistory();36wpt.getTestHistory(function(error, data) {37 if (error) {38 console.log(error);39 } else {40 console.log(data);41 }42});43wpt.getTestHistoryForLocation('test');44wpt.getTestHistoryForLocation('test

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4var webPageTest = new wpt(options);5 console.log(data);6});7### WebPageTest(options)8### .runTest(url, options, callback)

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful