当前位置: 首页>>代码示例>>Java>>正文


Java JFileChooserFixture.approve方法代码示例

本文整理汇总了Java中org.assertj.swing.fixture.JFileChooserFixture.approve方法的典型用法代码示例。如果您正苦于以下问题:Java JFileChooserFixture.approve方法的具体用法?Java JFileChooserFixture.approve怎么用?Java JFileChooserFixture.approve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.assertj.swing.fixture.JFileChooserFixture的用法示例。


在下文中一共展示了JFileChooserFixture.approve方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fileChooserOfAddDialogShouldChooseHelloWorldRtf

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
@Test
public void fileChooserOfAddDialogShouldChooseHelloWorldRtf() {

	MockUpUtils.setMockupMidoFile("mockups/empty.mido");
	MockUpUtils.setMockupPropertiesFile("mockups/empty.properties");
	startApplication();

	DialogFixture addDialog = openAddDialog();
	JFileChooserFixture fileChooser = openSearchDialog(addDialog,
			AddDialog.NAME_FILE_SEARCH_BUTTON);

	fileChooser.setCurrentDirectory(new File(currentPath + File.separator
			+ "testfiles"));
	String rtfPath = currentPath + File.separator + "testfiles"
			+ File.separator + "Hello World.rtf";
	fileChooser.selectFile(new File(rtfPath));
	fileChooser.approve();

	addDialog.textBox(AddDialog.NAME_FILE_TEXT_FIELD).requireText(rtfPath);
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:21,代码来源:AddFileFunctionalITCase.java

示例2: programChooserOfAddDialogShouldChooseSpecificProgram

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
@Test
public void programChooserOfAddDialogShouldChooseSpecificProgram() {

	MockUpUtils.setMockupMidoFile("mockups/empty.mido");
	MockUpUtils.setMockupPropertiesFile("mockups/empty.properties");
	startApplication();

	DialogFixture addDialog = openAddDialog();
	JFileChooserFixture fileChooser = openSearchDialog(addDialog,
			AddDialog.NAME_PROGRAM_SEARCH_BUTTON);

	fileChooser.setCurrentDirectory(new File(programDirectory));

	// issue in MAC implementation s.
	// https://github.com/joel-costigliola/assertj-swing/issues/192
	if (System.getProperty("os.name").contains("Mac")) {
		return;
	}
	fileChooser.selectFile(new File(programPath));

	fileChooser.approve();

	addDialog.textBox(AddDialog.NAME_PROGRAM_TEXT_FIELD).requireText(
			programPath);
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:26,代码来源:AddFileFunctionalITCase.java

示例3: fileChooserOfEditDialogShouldBeOpened

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
@Test
public void fileChooserOfEditDialogShouldBeOpened() {

	MockUpUtils.setMockupMidoFile("mockups/" + helloWorldMido);
	MockUpUtils.setMockupPropertiesFile("mockups/empty.properties");
	startApplication();

	DialogFixture editDialog = openEditDialog(0);
	JFileChooserFixture fileChooser = openSearchDialog(editDialog,
			AddDialog.NAME_FILE_SEARCH_BUTTON);

	fileChooser.setCurrentDirectory(new File(currentPath + "/testfiles"));

	// issue in MAC implementation s.
	// https://github.com/joel-costigliola/assertj-swing/issues/191
	if (System.getProperty("os.name").equals("Mac OS X")) {
		return;
	}
	fileChooser.selectFile(new File(currentPath
			+ "/testfiles/Hello World.rtf"));
	fileChooser.approve();

	editDialog.textBox(EditDialog.NAME_FILE_TEXT_FIELD).requireText(
			currentPath + File.separator + "testfiles" + File.separator
					+ "Hello World.rtf");
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:27,代码来源:EditFileFunctionalITCase.java

示例4: testFileOpen

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
private void testFileOpen() {
    findMenuItemByText("Open...").click();
    JFileChooserFixture openDialog = JFileChooserFinder.findFileChooser("open").using(robot);
    openDialog.cancel();

    findMenuItemByText("Open...").click();
    openDialog = JFileChooserFinder.findFileChooser("open").using(robot);
    openDialog.selectFile(new File(INPUT_DIR, "b.jpg"));
    openDialog.approve();
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:11,代码来源:AssertJSwingTest.java

示例5: testSaveUnnamed

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
private void testSaveUnnamed() {
    // new unsaved image, will be saved as save as
    runMenuCommand("Save");
    JFileChooserFixture saveDialog = findSaveFileChooser();
    // due to an assertj bug, the file must exist - TODO investigate, report
    saveDialog.selectFile(new File(BASE_TESTING_DIR, "saved.png"));
    saveDialog.approve();
    // say OK to the overwrite question
    findJOptionPane().yesButton().click();

    // TODO test save as menuitem and simple save (without file chooser)
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:13,代码来源:AssertJSwingTest.java

示例6: saveWithOverwrite

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
private void saveWithOverwrite(String fileName) {
    JFileChooserFixture saveDialog = findSaveFileChooser();
    saveDialog.selectFile(new File(BASE_TESTING_DIR, fileName));
    saveDialog.approve();
    // say OK to the overwrite question
    JOptionPaneFixture optionPane = findJOptionPane();
    optionPane.yesButton().click();
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:9,代码来源:AssertJSwingTest.java

示例7: screenshotChooserShouldRememberLastDirectory

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
@Test
public void screenshotChooserShouldRememberLastDirectory() {

	MockUpUtils.setMockupMidoFile("mockups/empty.mido");
	MockUpUtils
			.setMockupPropertiesFile("mockups/automation1_empty.properties");
	startApplication();

	DialogFixture preferencesDialog = openPreferences();
	JFileChooserFixture fileChooser = openScreenshotFileChooser(0,
			preferencesDialog);

	// choose a file
	fileChooser.setCurrentDirectory(new File(currentPath + File.separator
			+ "testfiles"));
	String cancelButtonImage1 = currentPath + File.separator + "testfiles"
			+ File.separator + "cancel_button.png";
	File cancelButtonImageFile1 = new File(cancelButtonImage1);
	fileChooser.selectFile(cancelButtonImageFile1);
	fileChooser.approve();

	saveDialog(preferencesDialog);

	// re-select file
	preferencesDialog = openPreferences();
	fileChooser = openScreenshotFileChooser(0, preferencesDialog);

	String cancelButtonImage2 = currentPath + File.separator + "testfiles"
			+ File.separator + "cancel_button2.png";
	File cancelButtonImageFile2 = new File(cancelButtonImage2);
	fileChooser.selectFile(cancelButtonImageFile2);
	fileChooser.approve();

	if (!sikulix.checkforStates("cancel_button2.png")) {
		fail();
	}
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:38,代码来源:GUIAutomationFunctionalITCase.java

示例8: fileChooserShouldRememberLastDirectory

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
@Test
public void fileChooserShouldRememberLastDirectory() {

	// issue in MAC implementation s.
	// https://github.com/joel-costigliola/assertj-swing/issues/191
	Assume.assumeFalse(System.getProperty("os.name").equals("Mac OS X"));

	MockUpUtils.setMockupMidoFile("mockups/empty.mido");
	MockUpUtils.setMockupPropertiesFile("mockups/empty.properties");
	startApplication();

	DialogFixture addDialog = openAddDialog();
	JFileChooserFixture fileChooser = openSearchDialog(addDialog,
			AddDialog.NAME_FILE_SEARCH_BUTTON);

	// choose a file
	fileChooser.setCurrentDirectory(new File(currentPath + File.separator
			+ "testfiles"));
	String rtfPath = currentPath + File.separator + "testfiles"
			+ File.separator + "Hello World.rtf";
	File rtfFile = new File(rtfPath);
	fileChooser.selectFile(rtfFile);
	fileChooser.approve();

	saveDialog(addDialog);

	// re-select file
	addDialog = openAddDialog();
	fileChooser = openSearchDialog(addDialog,
			AddDialog.NAME_FILE_SEARCH_BUTTON);

	fileChooser.selectFile(rtfFile);
	fileChooser.approve();

	addDialog.textBox(AddDialog.NAME_FILE_TEXT_FIELD).requireText(rtfPath);
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:37,代码来源:AddFileFunctionalITCase.java

示例9: programChooserShouldRememberLastDirectory

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
@Test
public void programChooserShouldRememberLastDirectory() {

	// issue in MAC implementation s.
	// https://github.com/joel-costigliola/assertj-swing/issues/191
	Assume.assumeFalse(System.getProperty("os.name").equals("Mac OS X"));

	MockUpUtils.setMockupMidoFile("mockups/empty.mido");
	MockUpUtils.setMockupPropertiesFile("mockups/empty.properties");
	startApplication();

	DialogFixture addDialog = openAddDialog();
	JFileChooserFixture fileChooser = openSearchDialog(addDialog,
			AddDialog.NAME_PROGRAM_SEARCH_BUTTON);

	// choose a file
	fileChooser.setCurrentDirectory(new File(currentPath + File.separator
			+ "testfiles"));
	String rtfPath = currentPath + File.separator + "testfiles"
			+ File.separator + "Hello World.rtf";
	File rtfFile = new File(rtfPath);
	fileChooser.selectFile(rtfFile);
	fileChooser.approve();

	saveDialog(addDialog);

	// re-select file
	addDialog = openAddDialog();
	fileChooser = openSearchDialog(addDialog,
			AddDialog.NAME_PROGRAM_SEARCH_BUTTON);

	fileChooser.selectFile(rtfFile);
	fileChooser.approve();

	addDialog.textBox(AddDialog.NAME_PROGRAM_TEXT_FIELD).requireText(
			rtfPath);
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:38,代码来源:AddFileFunctionalITCase.java

示例10: fileChooserOfAddDialogShouldChooseHelloWorldRtfByKeyboard

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
@Test
public void fileChooserOfAddDialogShouldChooseHelloWorldRtfByKeyboard() {

	// issue in sending keys on mac
	Assume.assumeFalse(System.getProperty("os.name").equals("Mac OS X"));

	MockUpUtils.setMockupMidoFile("mockups/empty.mido");
	MockUpUtils.setMockupPropertiesFile("mockups/empty.properties");
	startApplication();

	DialogFixture addDialog = openAddDialog();
	JFileChooserFixture fileChooser = openSearchDialogOnEnter(addDialog,
			AddDialog.NAME_FILE_SEARCH_BUTTON);

	fileChooser.setCurrentDirectory(new File(currentPath + File.separator
			+ "testfiles"));
	String rtfPath = currentPath + File.separator + "testfiles"
			+ File.separator + "Hello World 1.rtf";

	// issue in MAC implementation s.
	// https://github.com/joel-costigliola/assertj-swing/issues/191
	if (System.getProperty("os.name").equals("Mac OS X")) {
		return;
	}

	fileChooser.selectFile(new File(rtfPath));
	fileChooser.approve();
	addDialog.textBox(AddDialog.NAME_FILE_TEXT_FIELD).requireText(rtfPath);
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:30,代码来源:AddFileFunctionalITCase.java

示例11: midautoFileShouldBeExported

import org.assertj.swing.fixture.JFileChooserFixture; //导入方法依赖的package包/类
@Test
public void midautoFileShouldBeExported() {

	String testFilePath = "testfiles";
	String testFileName = "ExportTest.midauto";

	MockUpUtils.setMockupPropertiesFile("mockups/RemoteINBus_1.properties");
	MockUpUtils.setMockupMidoFile("mockups/Hello_World_12_empty.mido");
	startApplication();

	// export to file
	JFileChooserFixture fileChooser = openExportDialog();
	fileChooser.setCurrentDirectory(new File(testFilePath));
	fileChooser.fileNameTextBox().enterText("ExportTest");
	fileChooser.approve();

	try {

		// unzip exported file
		File midautoFile = new File(testFilePath + File.separator
				+ testFileName);
		ZipFile midautoZipFile = new ZipFile(midautoFile);
		FileUtils.unzipFile(midautoZipFile, testFilePath);
		midautoZipFile.close();

		// compare file contents
		File midoFile = new File(testFilePath + File.separator
				+ "file_list.mido");
		midoFile = removeLineFromFile(midoFile, Model.COMMENT_SIGN + "");

		boolean midoCorrect = org.apache.commons.io.FileUtils
				.contentEquals(midoFile, new File("mockups"
						+ File.separator + "Hello_World_12_empty.mido"));

		File propertiesFile = new File(testFilePath
				+ "/midiautomator.properties");
		propertiesFile = removeLineFromFile(propertiesFile,
				MidiAutomatorProperties.KEY_VERSION);
		propertiesFile = removeLineFromFile(propertiesFile, "#");
		boolean propertiesCorrect = org.apache.commons.io.FileUtils
				.contentEquals(propertiesFile, new File("mockups"
						+ File.separator + "RemoteINBus_1.properties"));

		// delete exported files
		Files.delete(midoFile);
		Files.delete(propertiesFile);
		Files.delete(midautoFile);

		// test if contents are equal
		assertTrue(midoCorrect);
		assertTrue(propertiesCorrect);

	} catch (IOException e) {
		e.printStackTrace();
	}

}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:58,代码来源:ImportExportFunctionalITCase.java


注:本文中的org.assertj.swing.fixture.JFileChooserFixture.approve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。