我转到XCode中的Breakpoints面板,在'Breakpoints'中我单击一个断点并单击'Delete',但它不会删除断点.我尝试去"项目断点"并找到相同的断点并单击"删除".但它仍然没有突破断点.
为了在按钮上创建翻转效果,我创建了一个名为Button的NSButton子类.
Button.h:
#import <AppKit/AppKit.h>
@interface Button : NSButton {
}
- (void)mouseEntered:(NSEvent *)theEvent;
- (void)mouseExited:(NSEvent *)theEvent;
- (void)mouseDown:(NSEvent *)ev;
- (void)mouseUp:(NSEvent *)theEvent;
@end
Run Code Online (Sandbox Code Playgroud)
Button.m:#import"Button.h"
@implementation Button
- (id)initWithFrame:(NSRect)frameRect {
self = [super initWithFrame:frameRect];
if(self != nil) {
NSLog(@"btn init");
}
return self;
}
- (void)mouseEntered:(NSEvent *)theEvent{
NSLog(@"mouseEntered");
[self setImage:[NSImage imageNamed:@"lockIcon_2.png"]];
[self setNeedsDisplay];
}
- (void)mouseExited:(NSEvent *)theEvent{
[self setImage:[NSImage imageNamed:@"lockIcon_1.png"]];
NSLog(@"mouseExited");
[self setNeedsDisplay];
}
- (void)mouseDown:(NSEvent *)ev {
NSLog(@"mouseDown!");
}
- (void)mouseUp:(NSEvent *)ev {
NSLog(@"mouseUp!");
}
@end
Run Code Online (Sandbox Code Playgroud)
使用上面的代码,每次我点击一个按钮,我在日志中看到"mouseDown",但我没有看到"mouseEntered"或"mouseExited"(当然看不到图像更改)?? 可悲的是,我知道我错过了一些明显的东西,但我只是没有看到它...... ???
我必须写一些单元测试,但我有模拟ResultSet和jdbc的问题Connection.
我有这个方法:
@Test
public void test3() throws SQLException, IOException {
Connection jdbcConnection = Mockito.mock(Connection.class);
ResultSet resultSet = Mockito.mock(ResultSet.class);
Mockito.when(resultSet.next()).thenReturn(true).thenReturn(true).thenReturn(true).thenReturn(false);
Mockito.when(resultSet.getString(1)).thenReturn("table_r3").thenReturn("table_r1").thenReturn("table_r2");
Mockito.when(jdbcConnection
.createStatement()
.executeQuery("SELECT name FROM tables"))
.thenReturn(resultSet);
//when
List<String> nameOfTablesList = null;
try {
nameOfTablesList = Helper.getTablesName(jdbcConnection);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//then
Assert.assertEquals(nameOfTablesList.size(), 3);
}
Run Code Online (Sandbox Code Playgroud)
错误显示在行中executeQuery("SELECT name FROM tables"),听起来像这样:
java.lang.NullPointerException HelperTest.test3(HelperTest.java:71)
Run Code Online (Sandbox Code Playgroud)
任何想法都出错了?
我完成了我的 django 项目。并且 \xc4\xb1 想要在 aws 上部署我的项目。我从 github 拉取我的项目,然后在 aws(ubuntu) 上的虚拟计算机上运行 pipelinenv install,我每次都会收到此错误。
\nERROR:: --system is intended to be used for pre-existing Pipfile installation, not installation of specific packages. Aborting.\nRun Code Online (Sandbox Code Playgroud)\n我该如何解决这个问题
\n考虑到我的应用程序具有当前登录的管理员用户的用户ID和密码,是否可以从OSX网络设置中检索配置值?特别感兴趣的是"Advanced/Proxies"标签内容.
当在 Xcode 中运行大量测试时,我遇到了一个崩溃的测试。Xcode 调试器显示了崩溃的位置,但是似乎没有办法将该测试标记为失败并继续运行其余测试。
如何在 Xcode 中将崩溃的测试标记为失败并继续运行其余的测试?
cocoa ×2
unit-testing ×2
xcode ×2
breakpoints ×1
debugging ×1
django ×1
http-proxy ×1
image ×1
java ×1
jdbc ×1
macos ×1
mockito ×1
objective-c ×1
pipenv ×1
resultset ×1
ubuntu ×1