window.parameter.js 8.9 KB
Newer Older
D
dhc-123 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import window from '@ohos.window'


describe('window_test', function(){
    var wnd;
    beforeAll(function(){
    })
    beforeEach(function(){
    })
    afterEach(function(){
    })
    afterAll(function(){
    })
	
	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_1900
D
dhc-123 已提交
33 34
	* @tc.name      Test moveTestNegative.
	* @tc.desc      Test window.moveTo API function test.
D
dhc-123 已提交
35
	*/
D
test2  
dhc-123 已提交
36
	it('moveTestNegative', 0,function(){
D
dhc-123 已提交
37
		console.log('jsunittest moveTestNegative begin')
D
test2  
dhc-123 已提交
38
		window.getTopwindow().then(wnd => {
D
dhc-123 已提交
39
			console.log('jsunittest moveTestNegative getTopwindow wnd: ' + wnd)
D
test  
dhc-123 已提交
40
			wnd.moveTo(-200,-200).then(()=>{
D
dhc-123 已提交
41 42
				console.log('moveTo(-200,-200) success')
			})
D
test  
dhc-123 已提交
43
			wnd.moveTo(0,0).then(()=>{
D
dhc-123 已提交
44 45 46
				console.log('moveTo(0,0) success')
			})
		})
D
test3  
dhc-123 已提交
47
	})
D
dhc-123 已提交
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
	
	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_2000
	* @tc.name      Test resetSizeTestLoop.
	* @tc.desc      Test window.resetSize API function test.
	*/
	it('resetSizeLoop', 0, function(){
        var width = 100;
		var height = 100;
		console.log('jsunittest resetSizeLoop begin')
		window.getTopwindow().then(wnd =>{
		    console.log('jsunittest resetSizeLoop getTopWindow wnd: ' + wnd)
		    for (let i = 1; i <= 5; i++){
			    width = width * i;
			    height = height * i;
			    wnd.resetSize(width, height).then(()=>{
				   console.log('jsunittest  resetSizeTestLoop success')
			    })
		    }
		    wnd.resetSize(0,0).then(()=>{
			console.log('jsunittest resetSizeTsetLoop wnd.resetSize(0,0) success')
		    })
	   })
    })

	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_2100
	* @tc.name      Test setWindowTypeTestZero.
	* @tc.desc      Test window.setWindowType API function test.
	*/
	it('setWindowTypeTestZero', 0, function(){
		console.log('jsunittest setWindowTypeTestZero begin')
		window.getTopwindow().then(wnd => {
			console.log('jsunittest setWindowTypeTestZero getTopWindow wnd: ' + wnd)
			wnd.setWindowType(0).then(()=>{
				console.log('jsunittest setWindowTypeTestZero wnd.setWindowType(0) success')
			})
			wnd.moveTo(200,200).then(()=>{
				console.log('jsunittest  setWindowTypeTestZero wnd.moveTo(200,200) success')
			})
			wnd.resetSize(200,200).then(()=>{
				console.log('jsunittest setWindowTypeTestZero wnd.resetSize(200,200) success')
			})
		})
	})

	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_2200
	* @tc.name      Test setWindowTypeTestThirty.
	* @tc.desc      Test window.setWindowType API function test.
	*/
	it('setWindowTypeTestThirty', 0, function(){
		console.log('jsunittest setWindowTypeTestThirty begin')
		window.getTopwindow().then(wnd => {
			console.log('jsunittest setWindowTypeTestThirty getTopwindow wnd: ' + wnd)
			wnd.setWindowType(30).then(()=>{
				console.log('jsunittest setWindowTypeTestThirty wnd.setWindowType(30) success')
			})
			wnd.moveTo(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTestThirty wnd.moveTo(200, 200) success')
			})
			wnd.resetSize(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTestThirty wnd.resetSize(200, 200) success')
			})
		})
	})

	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_2300
	* @tc.name      Test setWindowTypeTestSeventy.
	* @tc.desc      Test window.setWindowType API function test.
	*/
	it('setWindowTypeTestSeventy', 0, function(){
		console.log('jsunittest setWindowTypeTestSeventy begin')
		window.getTopwindow().then(wnd => {
			console.log('jsunittest setWindowTypeTestSeventy getTopwindow wnd: ' + wnd)
			wnd.setWindowType(70).then(()=>{
				console.log('jsunittest setWindowTypeTestSeventy wnd.setWindowType(70) success')
			})
			wnd.moveTo(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTestSeventy wnd.moveTo(200, 200) success')
			})
			wnd.resetSize(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTestSeventy wnd.resetSize(200, 200) success')
			})	
		})
	})

	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_2400
	* @tc.name      Test setWindowTypeTestNinety.
	* @tc.desc      Test window.setWindowType API function test.
	*/
	it('setWindowTypeTestNinety', 0, function(){
		console.log('jsunittest setWindowTypeTestNinety begin')
		window.getTopwindow().then(wnd => {
			console.log('jsunittest setWindowTypeTestNinety getTopwindow wnd: ' + wnd)
			wnd.setWindowType(90).then(()=>{
				console.log('jsunittest setWindowTypeTestNinety wnd.setWindowType(90) success')
			})
			wnd.moveTo(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTestNinety wnd.moveTo(200, 200) success')
			})
			wnd.resetSize(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTestNinety wnd.resetSize(200, 200) success')
			})	
		})
	})

	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_2500
	* @tc.name      Test setWindowTypeTestOrderChange.
	* @tc.desc      Test window.setWindowType API function test.
	*/
	it('setWindowTypeTestOrderChange', 0, function(){
		console.log('jsunittest setWindowTypeTestOrderChange begin')
		window.getTopwindow().then(wnd => {
			console.log('jsunittest setWindowTypeTestOrderChange getTopwindow wnd: ' + wnd)
			wnd.setWindowType(0).then(()=>{
				console.log('jsunittest setWindowTypeTestOrderChange wnd.setWindowType(0) success')
			})
			wnd.resetSize(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTestOrderChange wnd.resetSize(200, 200) success')
			})
			wnd.moveTo(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTestOrderChange wnd.moveTo(200, 200) success')
			})	
		})
	})

	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_2600
	* @tc.name      Test setWindowTypeTest15.
	* @tc.desc      Test window.setWindowType API function test.
	*/
	it('setWindowTypeTest15', 0, function(){
		console.log('jsunittest setWindowTypeTest15 begin')
		window.getTopwindow().then(wnd => {
			console.log('jsunittest setWindowTypeTest15 getTopwindow wnd: ' + wnd)
			wnd.setWindowType(30).then(()=>{
				console.log('jsunittest setWindowTypeTest15 wnd.setWindowType(30) success')
			})
			wnd.resetSize(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTest15 wnd.resetSize(200, 200) success')
			})
			wnd.moveTo(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTest15 wnd.moveTo(200, 200) success')
			})	
		})
	})

	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_2700
	* @tc.name      Test setWindowTypeTest16.
	* @tc.desc      Test window.setWindowType API function test.
	*/
	it('setWindowTypeTest16', 0, function(){
		console.log('jsunittest setWindowTypeTest16 begin')
		window.getTopwindow().then(wnd => {
			console.log('jsunittest setWindowTypeTest16 getTopwindow wnd: ' + wnd)
			wnd.setWindowType(70).then(()=>{
				console.log('jsunittest setWindowTypeTest16 wnd.setWindowType(70) success')
			})
			wnd.resetSize(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTest16 wnd.resetSize(200, 200) success')
			})
			wnd.moveTo(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTest16 wnd.moveTo(200, 200) success')
			})	
		})
	})

	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_2800
	* @tc.name      Test setWindowTypeTest17.
	* @tc.desc      Test window.setWindowType API function test.
	*/
	it('setWindowTypeTest17', 0, function(){
		console.log('jsunittest setWindowTypeTest17 begin')
		window.getTopwindow().then(wnd => {
			console.log('jsunittest setWindowTypeTest17 getTopwindow wnd: ' + wnd)
			wnd.setWindowType(90).then(()=>{
				console.log('jsunittest setWindowTypeTest17 wnd.setWindowType(90) success')
			})
			wnd.resetSize(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTest17 wnd.resetSize(200, 200) success')
			})
			wnd.moveTo(200, 200).then(()=>{
				console.log('jsunittest setWindowTypeTest17 wnd.moveTo(200, 200) success')
			})	
		})
	})

	/**
	* @tc.number    GRAPHIC__FUNCTION_WINDOW_TESTWINDOW_JS_API_2900
	* @tc.name      Test moveTest6.
	* @tc.desc      Test window.moveTo API function test.
	*/
	it('moveTest6', 0, function(){
		console.log('jsunittest moveTest6 begin')
		window.getTopwindow().then(wnd => {
			console.log('jsunittest moveTest6 getTopwindow wnd: ' + wnd)
			wnd.moveTo(-200, 200).then(()=>{
D
dhc-123 已提交
251
				console.log('jsunittest moveTest6 wnd.moveTo(-200, 300) success')
D
dhc-123 已提交
252 253
			})
			wnd.moveTo(200, -300).then(()=>{
D
dhc-123 已提交
254
				console.log('jsunittest moveTest6 wnd.moveTo(200, -300) success')
D
dhc-123 已提交
255 256 257
			})	
		})
	})
D
test3  
dhc-123 已提交
258
})